aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/server_async.cc
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2017-08-24 10:42:27 -0700
committerGravatar Vijay Pai <vpai@google.com>2017-10-19 14:29:13 -0700
commit088112fea12ec364990909cda3a96e7d792480b3 (patch)
tree1fde83a8b7332891ccbb409da0ac97abd3ebe68d /test/cpp/qps/server_async.cc
parentac581ee24b24d9088d8755ce45daa4ec471ab951 (diff)
Create inproc version of QPS test and add a few simple tests of this to standard testing suite.
Diffstat (limited to 'test/cpp/qps/server_async.cc')
-rw-r--r--test/cpp/qps/server_async.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 4a82f98199..776371a2c6 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -74,14 +74,17 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
ResponseType *)>
process_rpc)
: Server(config) {
- char *server_address = NULL;
-
- gpr_join_host_port(&server_address, "::", port());
-
ServerBuilder builder;
- builder.AddListeningPort(server_address,
- Server::CreateServerCredentials(config));
- gpr_free(server_address);
+
+ auto port_num = port();
+ // Negative port number means inproc server, so no listen port needed
+ if (port_num >= 0) {
+ char *server_address = NULL;
+ gpr_join_host_port(&server_address, "::", port_num);
+ builder.AddListeningPort(server_address,
+ Server::CreateServerCredentials(config));
+ gpr_free(server_address);
+ }
register_service(&builder, &async_service_);
@@ -183,6 +186,11 @@ class AsyncQpsServerTest final : public grpc::testing::Server {
return count;
}
+ std::shared_ptr<Channel> InProcessChannel(
+ const ChannelArguments &args) override {
+ return server_->InProcessChannel(args);
+ }
+
private:
void ShutdownThreadFunc() {
// TODO (vpai): Remove this deadline and allow Shutdown to finish properly