aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Dan Born <dborn+github@google.com>2016-01-20 14:16:29 -0800
committerGravatar Dan Born <dborn+github@google.com>2016-01-20 14:16:29 -0800
commitbeeb4c2ad75533848ac0fca545a3b4785d8fce57 (patch)
treeeed3a91f80967ab90ae4cbc559503015bd3a0483 /test
parentb13a69da41ddad7880f409c53d1f55982ee79ac5 (diff)
parent4c3c397bbea2acf023950f7470fe36d2e7322cc0 (diff)
Merge branch 'master' into tcp_listener
Diffstat (limited to 'test')
-rwxr-xr-xtest/core/bad_client/gen_build_yaml.py13
-rwxr-xr-xtest/core/bad_ssl/gen_build_yaml.py11
-rw-r--r--test/core/end2end/end2end_nosec_tests.c2
-rw-r--r--test/core/end2end/end2end_tests.c2
-rwxr-xr-xtest/core/end2end/gen_build_yaml.py36
-rw-r--r--test/core/fling/client.c9
-rw-r--r--test/core/iomgr/tcp_posix_test.c2
-rw-r--r--test/core/security/jwt_verifier_test.c2
-rw-r--r--test/core/support/avl_test.c19
-rw-r--r--test/core/support/cpu_test.c2
-rw-r--r--test/core/transport/chttp2/bin_encoder_test.c6
-rw-r--r--test/cpp/end2end/async_end2end_test.cc28
-rw-r--r--test/cpp/end2end/client_crash_test.cc21
-rw-r--r--test/cpp/end2end/client_crash_test_server.cc12
-rw-r--r--test/cpp/end2end/end2end_test.cc42
-rw-r--r--test/cpp/end2end/generic_end2end_test.cc23
-rw-r--r--test/cpp/end2end/mock_test.cc32
-rw-r--r--test/cpp/end2end/server_crash_test.cc18
-rw-r--r--test/cpp/end2end/server_crash_test_client.cc12
-rw-r--r--test/cpp/end2end/shutdown_test.cc20
-rw-r--r--test/cpp/end2end/streaming_throughput_test.cc18
-rw-r--r--test/cpp/end2end/thread_stress_test.cc27
-rw-r--r--test/cpp/end2end/zookeeper_test.cc20
-rw-r--r--test/cpp/interop/interop_client.cc8
-rw-r--r--test/cpp/interop/interop_client.h4
-rw-r--r--test/cpp/interop/metrics_client.cc4
-rw-r--r--test/cpp/interop/reconnect_interop_client.cc6
-rw-r--r--test/cpp/interop/reconnect_interop_server.cc8
-rw-r--r--test/cpp/interop/server.cc6
-rw-r--r--test/cpp/interop/stress_interop_client.cc2
-rw-r--r--test/cpp/interop/stress_test.cc6
-rw-r--r--test/cpp/qps/client.h168
-rw-r--r--test/cpp/qps/client_async.cc156
-rw-r--r--test/cpp/qps/client_sync.cc28
-rw-r--r--test/cpp/qps/driver.cc2
-rw-r--r--test/cpp/qps/driver.h2
-rw-r--r--test/cpp/qps/generic_async_streaming_ping_pong_test.cc82
-rw-r--r--test/cpp/qps/histogram.h2
-rw-r--r--test/cpp/qps/perf_db.proto71
-rw-r--r--test/cpp/qps/perf_db_client.h2
-rw-r--r--test/cpp/qps/qps_driver.cc18
-rw-r--r--test/cpp/qps/qps_worker.cc31
-rw-r--r--test/cpp/qps/qps_worker.h4
-rw-r--r--test/cpp/qps/server.h9
-rw-r--r--test/cpp/qps/server_async.cc151
-rw-r--r--test/cpp/qps/server_sync.cc2
-rw-r--r--test/cpp/qps/worker.cc5
-rw-r--r--test/cpp/util/cli_call.cc10
-rw-r--r--test/cpp/util/cli_call_test.cc16
-rw-r--r--test/cpp/util/echo.proto47
-rw-r--r--test/cpp/util/echo_duplicate.proto42
-rw-r--r--test/cpp/util/grpc_cli.cc9
-rw-r--r--test/cpp/util/messages.proto60
-rw-r--r--test/cpp/util/metrics_server.cc4
-rw-r--r--test/cpp/util/metrics_server.h7
-rw-r--r--test/cpp/util/subprocess.cc4
-rw-r--r--test/proto/benchmarks/control.proto158
-rw-r--r--test/proto/benchmarks/payloads.proto55
-rw-r--r--test/proto/benchmarks/services.proto65
-rw-r--r--test/proto/benchmarks/stats.proto70
-rw-r--r--test/proto/empty.proto43
-rw-r--r--test/proto/messages.proto167
-rw-r--r--test/proto/metrics.proto56
-rw-r--r--test/proto/test.proto86
64 files changed, 746 insertions, 1307 deletions
diff --git a/test/core/bad_client/gen_build_yaml.py b/test/core/bad_client/gen_build_yaml.py
index a86a50065d..c538bffd71 100755
--- a/test/core/bad_client/gen_build_yaml.py
+++ b/test/core/bad_client/gen_build_yaml.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python2.7
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -35,15 +35,15 @@
import collections
import yaml
-TestOptions = collections.namedtuple('TestOptions', 'flaky')
-default_test_options = TestOptions(False)
+TestOptions = collections.namedtuple('TestOptions', 'flaky cpu_cost')
+default_test_options = TestOptions(False, 1.0)
# maps test names to options
BAD_CLIENT_TESTS = {
'badreq': default_test_options,
- 'connection_prefix': default_test_options,
- 'headers': default_test_options,
- 'initial_settings_frame': default_test_options,
+ 'connection_prefix': default_test_options._replace(cpu_cost=0.2),
+ 'headers': default_test_options._replace(cpu_cost=0.2),
+ 'initial_settings_frame': default_test_options._replace(cpu_cost=0.2),
'server_registered_method': default_test_options,
'simple_request': default_test_options,
'window_overflow': default_test_options,
@@ -75,6 +75,7 @@ def main():
'targets': [
{
'name': '%s_bad_client_test' % t,
+ 'cpu_cost': BAD_CLIENT_TESTS[t].cpu_cost,
'build': 'test',
'language': 'c',
'secure': 'no',
diff --git a/test/core/bad_ssl/gen_build_yaml.py b/test/core/bad_ssl/gen_build_yaml.py
index 15189d8b79..cc097a8fdf 100755
--- a/test/core/bad_ssl/gen_build_yaml.py
+++ b/test/core/bad_ssl/gen_build_yaml.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python2.7
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -35,13 +35,13 @@
import collections
import yaml
-TestOptions = collections.namedtuple('TestOptions', 'flaky')
-default_test_options = TestOptions(False)
+TestOptions = collections.namedtuple('TestOptions', 'flaky cpu_cost')
+default_test_options = TestOptions(False, 1.0)
# maps test names to options
BAD_CLIENT_TESTS = {
- 'cert': default_test_options,
- 'alpn': default_test_options,
+ 'cert': default_test_options._replace(cpu_cost=0.1),
+ 'alpn': default_test_options._replace(cpu_cost=0.1),
}
def main():
@@ -84,6 +84,7 @@ def main():
for t in sorted(BAD_CLIENT_TESTS.keys())] + [
{
'name': 'bad_ssl_%s_test' % t,
+ 'cpu_cost': BAD_CLIENT_TESTS[t].cpu_cost,
'build': 'test',
'language': 'c',
'src': ['test/core/bad_ssl/bad_ssl_test.c'],
diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c
index d9df5fd7f0..9ff46d62e4 100644
--- a/test/core/end2end/end2end_nosec_tests.c
+++ b/test/core/end2end/end2end_nosec_tests.c
@@ -258,7 +258,7 @@ void grpc_end2end_tests(int argc, char **argv,
trailing_metadata(config);
continue;
}
- gpr_log(GPR_DEBUG, "not a test: '%%s'", argv[i]);
+ gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]);
abort();
}
}
diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c
index 7b1471eb89..397ff446a9 100644
--- a/test/core/end2end/end2end_tests.c
+++ b/test/core/end2end/end2end_tests.c
@@ -264,7 +264,7 @@ void grpc_end2end_tests(int argc, char **argv,
trailing_metadata(config);
continue;
}
- gpr_log(GPR_DEBUG, "not a test: '%%s'", argv[i]);
+ gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]);
abort();
}
}
diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py
index 6a4038da73..f24dbe72cf 100755
--- a/test/core/end2end/gen_build_yaml.py
+++ b/test/core/end2end/gen_build_yaml.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python2.7
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -77,40 +77,42 @@ END2END_FIXTURES = {
}
TestOptions = collections.namedtuple(
- 'TestOptions', 'needs_fullstack needs_dns proxyable secure traceable')
-default_test_options = TestOptions(False, False, True, False, True)
+ 'TestOptions', 'needs_fullstack needs_dns proxyable secure traceable cpu_cost')
+default_test_options = TestOptions(False, False, True, False, True, 1.0)
connectivity_test_options = default_test_options._replace(needs_fullstack=True)
+LOWCPU = 0.1
+
# maps test names to options
END2END_TESTS = {
'bad_hostname': default_test_options,
'binary_metadata': default_test_options,
'call_creds': default_test_options._replace(secure=True),
- 'cancel_after_accept': default_test_options,
- 'cancel_after_client_done': default_test_options,
- 'cancel_after_invoke': default_test_options,
- 'cancel_before_invoke': default_test_options,
- 'cancel_in_a_vacuum': default_test_options,
- 'cancel_with_status': default_test_options,
- 'channel_connectivity': connectivity_test_options._replace(proxyable=False),
+ 'cancel_after_accept': default_test_options._replace(cpu_cost=LOWCPU),
+ 'cancel_after_client_done': default_test_options._replace(cpu_cost=LOWCPU),
+ 'cancel_after_invoke': default_test_options._replace(cpu_cost=LOWCPU),
+ 'cancel_before_invoke': default_test_options._replace(cpu_cost=LOWCPU),
+ 'cancel_in_a_vacuum': default_test_options._replace(cpu_cost=LOWCPU),
+ 'cancel_with_status': default_test_options._replace(cpu_cost=LOWCPU),
+ 'channel_connectivity': connectivity_test_options._replace(proxyable=False, cpu_cost=LOWCPU),
'channel_ping': connectivity_test_options._replace(proxyable=False),
- 'compressed_payload': default_test_options._replace(proxyable=False),
+ 'compressed_payload': default_test_options._replace(proxyable=False, cpu_cost=LOWCPU),
'default_host': default_test_options._replace(needs_fullstack=True,
needs_dns=True),
'disappearing_server': connectivity_test_options,
'empty_batch': default_test_options,
- 'graceful_server_shutdown': default_test_options,
+ 'graceful_server_shutdown': default_test_options._replace(cpu_cost=LOWCPU),
'hpack_size': default_test_options._replace(proxyable=False,
traceable=False),
'high_initial_seqno': default_test_options,
'invoke_large_request': default_test_options,
'large_metadata': default_test_options,
'max_concurrent_streams': default_test_options._replace(proxyable=False),
- 'max_message_length': default_test_options,
+ 'max_message_length': default_test_options._replace(cpu_cost=LOWCPU),
'metadata': default_test_options,
'negative_deadline': default_test_options,
'no_op': default_test_options,
- 'payload': default_test_options,
+ 'payload': default_test_options._replace(cpu_cost=LOWCPU),
'ping_pong_streaming': default_test_options,
'registered_call': default_test_options,
'request_with_flags': default_test_options._replace(proxyable=False),
@@ -118,7 +120,7 @@ END2END_TESTS = {
'server_finishes_request': default_test_options,
'shutdown_finishes_calls': default_test_options,
'shutdown_finishes_tags': default_test_options,
- 'simple_delayed_request': connectivity_test_options,
+ 'simple_delayed_request': connectivity_test_options._replace(cpu_cost=LOWCPU),
'simple_request': default_test_options,
'trailing_metadata': default_test_options,
}
@@ -252,12 +254,13 @@ def main():
END2END_FIXTURES[f].platforms, 'mac')),
'flaky': False,
'language': 'c',
+ 'cpu_cost': END2END_TESTS[t].cpu_cost,
}
for f in sorted(END2END_FIXTURES.keys())
for t in sorted(END2END_TESTS.keys()) if compatible(f, t)
] + [
{
- 'name': '%s_test' % f,
+ 'name': '%s_nosec_test' % f,
'args': [t],
'exclude_configs': [],
'platforms': END2END_FIXTURES[f].platforms,
@@ -266,6 +269,7 @@ def main():
END2END_FIXTURES[f].platforms, 'mac')),
'flaky': False,
'language': 'c',
+ 'cpu_cost': END2END_TESTS[t].cpu_cost,
}
for f in sorted(END2END_FIXTURES.keys())
if not END2END_FIXTURES[f].secure
diff --git a/test/core/fling/client.c b/test/core/fling/client.c
index 99b30d6c4a..95e2ea1f10 100644
--- a/test/core/fling/client.c
+++ b/test/core/fling/client.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -201,13 +201,16 @@ int main(int argc, char **argv) {
sc.init();
- for (i = 0; i < 1000; i++) {
+ gpr_timespec end_warmup = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(3);
+ gpr_timespec end_profiling = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(30);
+
+ while (gpr_time_cmp(gpr_now(end_warmup.clock_type), end_warmup) < 0) {
sc.do_one_step();
}
gpr_log(GPR_INFO, "start profiling");
grpc_profiler_start("client.prof");
- for (i = 0; i < 100000; i++) {
+ while (gpr_time_cmp(gpr_now(end_profiling.clock_type), end_profiling) < 0) {
start = now();
sc.do_one_step();
stop = now();
diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c
index b59ba1014b..e0136b3cd7 100644
--- a/test/core/iomgr/tcp_posix_test.c
+++ b/test/core/iomgr/tcp_posix_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c
index 9f37e0374c..f396398cef 100644
--- a/test/core/security/jwt_verifier_test.c
+++ b/test/core/security/jwt_verifier_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/support/avl_test.c b/test/core/support/avl_test.c
index 6530fe4269..d8d8b36806 100644
--- a/test/core/support/avl_test.c
+++ b/test/core/support/avl_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -3611,32 +3611,33 @@ static void test_badcase3(void) {
gpr_avl_unref(avl);
}
-static void test_stress(void) {
+static void test_stress(int amount_of_stress) {
int added[1024];
int i, j;
int deletions = 0;
gpr_avl avl;
- gpr_log(GPR_DEBUG, "test_stress");
+ unsigned seed = (unsigned)time(NULL);
+
+ gpr_log(GPR_DEBUG, "test_stress amount=%d seed=%u", amount_of_stress, seed);
srand((unsigned)time(NULL));
avl = gpr_avl_create(&int_int_vtable);
memset(added, 0, sizeof(added));
- for (i = 1; deletions < 1000; i++) {
+ for (i = 1; deletions < amount_of_stress; i++) {
int idx = rand() % (int)GPR_ARRAY_SIZE(added);
GPR_ASSERT(i);
if (rand() < RAND_MAX / 2) {
added[idx] = i;
- fprintf(stderr, "avl = gpr_avl_add(avl, box(%d), box(%d)); /* d=%d */\n",
- idx, i, deletions);
+ printf("avl = gpr_avl_add(avl, box(%d), box(%d)); /* d=%d */\n", idx, i,
+ deletions);
avl = gpr_avl_add(avl, box(idx), box(i));
} else {
deletions += (added[idx] != 0);
added[idx] = 0;
- fprintf(stderr, "avl = remove_int(avl, %d); /* d=%d */\n", idx,
- deletions);
+ printf("avl = remove_int(avl, %d); /* d=%d */\n", idx, deletions);
avl = remove_int(avl, idx);
}
for (j = 0; j < (int)GPR_ARRAY_SIZE(added); j++) {
@@ -3665,7 +3666,7 @@ int main(int argc, char *argv[]) {
test_badcase1();
test_badcase2();
test_badcase3();
- test_stress();
+ test_stress(10);
return 0;
}
diff --git a/test/core/support/cpu_test.c b/test/core/support/cpu_test.c
index a5c52442ad..da16f13fd8 100644
--- a/test/core/support/cpu_test.c
+++ b/test/core/support/cpu_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.c
index 1ffd8ed3cb..d1838075be 100644
--- a/test/core/transport/chttp2/bin_encoder_test.c
+++ b/test/core/transport/chttp2/bin_encoder_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,10 @@
#include <string.h>
+/* This is here for grpc_is_binary_header
+ * TODO(murgatroid99): Remove this
+ */
+#include <grpc/grpc.h>
#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index af0b7fdb57..cfda571326 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,29 +33,29 @@
#include <memory>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
#include <gtest/gtest.h>
+#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
#include "test/cpp/util/string_ref_helper.h"
#ifdef GPR_POSIX_SOCKET
#include "src/core/iomgr/pollset_posix.h"
#endif
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
using std::chrono::system_clock;
namespace grpc {
@@ -186,7 +186,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<bool> {
build_bad.AddListeningPort(server_address_.str(),
grpc::InsecureServerCredentials());
build_bad.RegisterAsyncService(&service_);
- grpc::cpp::test::util::TestService::Service sync_service;
+ grpc::testing::EchoTestService::Service sync_service;
build_bad.RegisterService(&sync_service);
GPR_ASSERT(build_bad.BuildAndStart() == nullptr);
@@ -211,7 +211,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<bool> {
void ResetStub() {
std::shared_ptr<Channel> channel =
CreateChannel(server_address_.str(), InsecureChannelCredentials());
- stub_ = grpc::cpp::test::util::TestService::NewStub(channel);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel);
}
void SendRpc(int num_rpcs) {
@@ -249,9 +249,9 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<bool> {
}
std::unique_ptr<ServerCompletionQueue> cq_;
- std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
- grpc::cpp::test::util::TestService::AsyncService service_;
+ grpc::testing::EchoTestService::AsyncService service_;
std::ostringstream server_address_;
};
@@ -761,8 +761,8 @@ TEST_P(AsyncEnd2endTest, ServerCheckDone) {
TEST_P(AsyncEnd2endTest, UnimplementedRpc) {
std::shared_ptr<Channel> channel =
CreateChannel(server_address_.str(), InsecureChannelCredentials());
- std::unique_ptr<grpc::cpp::test::util::UnimplementedService::Stub> stub;
- stub = grpc::cpp::test::util::UnimplementedService::NewStub(channel);
+ std::unique_ptr<grpc::testing::UnimplementedService::Stub> stub;
+ stub = grpc::testing::UnimplementedService::NewStub(channel);
EchoRequest send_request;
EchoResponse recv_response;
Status recv_status;
diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc
index 116785bbf2..5ca5cd7e99 100644
--- a/test/cpp/end2end/client_crash_test.cc
+++ b/test/cpp/end2end/client_crash_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,25 +31,25 @@
*
*/
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
#include <gtest/gtest.h>
+#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
#include "test/cpp/util/subprocess.h"
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
using std::chrono::system_clock;
static std::string g_root;
@@ -63,8 +63,7 @@ class CrashTest : public ::testing::Test {
protected:
CrashTest() {}
- std::unique_ptr<grpc::cpp::test::util::TestService::Stub>
- CreateServerAndStub() {
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> CreateServerAndStub() {
auto port = grpc_pick_unused_port_or_die();
std::ostringstream addr_stream;
addr_stream << "localhost:" << port;
@@ -73,7 +72,7 @@ class CrashTest : public ::testing::Test {
g_root + "/client_crash_test_server", "--address=" + addr,
}));
GPR_ASSERT(server_);
- return grpc::cpp::test::util::TestService::NewStub(
+ return grpc::testing::EchoTestService::NewStub(
CreateChannel(addr, InsecureChannelCredentials()));
}
diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc
index 7ffeecca70..1ec641cb5a 100644
--- a/test/cpp/end2end/client_crash_test_server.cc
+++ b/test/cpp/end2end/client_crash_test_server.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,20 +31,20 @@
*
*/
+#include <gflags/gflags.h>
#include <iostream>
#include <memory>
#include <string>
-#include <gflags/gflags.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
-#include "test/cpp/util/echo.grpc.pb.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
DEFINE_string(address, "", "Address to bind to");
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
// In some distros, gflags is in the namespace google, and in some others,
// in gflags. This hack is enabling us to find both.
@@ -57,7 +57,7 @@ namespace grpc {
namespace testing {
class ServiceImpl GRPC_FINAL
- : public ::grpc::cpp::test::util::TestService::Service {
+ : public ::grpc::testing::EchoTestService::Service {
Status BidiStream(ServerContext* context,
ServerReaderWriter<EchoResponse, EchoRequest>* stream)
GRPC_OVERRIDE {
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index bbeac7a30b..f8027bcf0b 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,9 +34,6 @@
#include <mutex>
#include <thread>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
@@ -46,18 +43,21 @@
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
#include <gtest/gtest.h>
#include "src/core/security/credentials.h"
+#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
#include "test/cpp/util/string_ref_helper.h"
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
using std::chrono::system_clock;
namespace grpc {
@@ -196,10 +196,10 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor {
const char TestAuthMetadataProcessor::kGoodGuy[] = "Dr Jekyll";
const char TestAuthMetadataProcessor::kIdentityPropName[] = "novel identity";
-class Proxy : public ::grpc::cpp::test::util::TestService::Service {
+class Proxy : public ::grpc::testing::EchoTestService::Service {
public:
Proxy(std::shared_ptr<Channel> channel)
- : stub_(grpc::cpp::test::util::TestService::NewStub(channel)) {}
+ : stub_(grpc::testing::EchoTestService::NewStub(channel)) {}
Status Echo(ServerContext* server_context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE {
@@ -209,10 +209,10 @@ class Proxy : public ::grpc::cpp::test::util::TestService::Service {
}
private:
- std::unique_ptr< ::grpc::cpp::test::util::TestService::Stub> stub_;
+ std::unique_ptr< ::grpc::testing::EchoTestService::Stub> stub_;
};
-class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
+class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public:
TestServiceImpl() : signal_client_(false), host_() {}
explicit TestServiceImpl(const grpc::string& host)
@@ -344,7 +344,7 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
};
class TestServiceImplDupPkg
- : public ::grpc::cpp::test::util::duplicate::TestService::Service {
+ : public ::grpc::testing::duplicate::EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE {
@@ -435,12 +435,12 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> {
channel_ = CreateChannel(proxyaddr.str(), InsecureChannelCredentials());
}
- stub_ = grpc::cpp::test::util::TestService::NewStub(channel_);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel_);
}
bool is_server_started_;
std::shared_ptr<Channel> channel_;
- std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::unique_ptr<Server> proxy_server_;
std::unique_ptr<Proxy> proxy_service_;
@@ -451,8 +451,7 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> {
TestServiceImplDupPkg dup_pkg_service_;
};
-static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub,
- int num_rpcs) {
+static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs) {
EchoRequest request;
EchoResponse response;
request.set_message("Hello hello hello hello");
@@ -562,9 +561,8 @@ TEST_P(End2endTest, DiffPackageServices) {
EXPECT_EQ(response.message(), request.message());
EXPECT_TRUE(s.ok());
- std::unique_ptr<grpc::cpp::test::util::duplicate::TestService::Stub>
- dup_pkg_stub(
- grpc::cpp::test::util::duplicate::TestService::NewStub(channel_));
+ std::unique_ptr<grpc::testing::duplicate::EchoTestService::Stub> dup_pkg_stub(
+ grpc::testing::duplicate::EchoTestService::NewStub(channel_));
ClientContext context2;
s = dup_pkg_stub->Echo(&context2, request, &response);
EXPECT_EQ("no package", response.message());
@@ -783,8 +781,8 @@ TEST_P(End2endTest, ChannelStateTimeout) {
// Talking to a non-existing service.
TEST_P(End2endTest, NonExistingService) {
ResetChannel();
- std::unique_ptr<grpc::cpp::test::util::UnimplementedService::Stub> stub;
- stub = grpc::cpp::test::util::UnimplementedService::NewStub(channel_);
+ std::unique_ptr<grpc::testing::UnimplementedService::Stub> stub;
+ stub = grpc::testing::UnimplementedService::NewStub(channel_);
EchoRequest request;
EchoResponse response;
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index 350e67b523..c5d9de3f29 100644
--- a/test/cpp/end2end/generic_end2end_test.cc
+++ b/test/cpp/end2end/generic_end2end_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,27 +33,27 @@
#include <memory>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
-#include <grpc++/impl/proto_utils.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/generic/async_generic_service.h>
#include <grpc++/generic/generic_stub.h>
+#include <grpc++/impl/proto_utils.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/support/slice.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
#include <gtest/gtest.h>
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
using std::chrono::system_clock;
namespace grpc {
@@ -134,7 +134,7 @@ class GenericEnd2endTest : public ::testing::Test {
void client_fail(int i) { verify_ok(&cli_cq_, i, false); }
void SendRpc(int num_rpcs) {
- const grpc::string kMethodName("/grpc.cpp.test.util.TestService/Echo");
+ const grpc::string kMethodName("/grpc.cpp.test.util.EchoTestService/Echo");
for (int i = 0; i < num_rpcs; i++) {
EchoRequest send_request;
EchoRequest recv_request;
@@ -193,7 +193,7 @@ class GenericEnd2endTest : public ::testing::Test {
CompletionQueue cli_cq_;
std::unique_ptr<ServerCompletionQueue> srv_cq_;
- std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<grpc::GenericStub> generic_stub_;
std::unique_ptr<Server> server_;
AsyncGenericService generic_service_;
@@ -215,7 +215,8 @@ TEST_F(GenericEnd2endTest, SequentialRpcs) {
TEST_F(GenericEnd2endTest, SimpleBidiStreaming) {
ResetStub();
- const grpc::string kMethodName("/grpc.cpp.test.util.TestService/BidiStream");
+ const grpc::string kMethodName(
+ "/grpc.cpp.test.util.EchoTestService/BidiStream");
EchoRequest send_request;
EchoRequest recv_request;
EchoResponse send_response;
diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc
index bd34cfba67..1d29096b86 100644
--- a/test/cpp/end2end/mock_test.cc
+++ b/test/cpp/end2end/mock_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,25 +33,25 @@
#include <thread>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
#include <gtest/gtest.h>
+#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
-using grpc::cpp::test::util::TestService;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
+using grpc::testing::EchoTestService;
using std::chrono::system_clock;
namespace grpc {
@@ -98,7 +98,7 @@ class MockClientReaderWriter<EchoRequest, EchoResponse> GRPC_FINAL
};
// Mocked stub.
-class MockStub : public TestService::StubInterface {
+class MockStub : public EchoTestService::StubInterface {
public:
MockStub() {}
~MockStub() {}
@@ -154,7 +154,7 @@ class MockStub : public TestService::StubInterface {
class FakeClient {
public:
- explicit FakeClient(TestService::StubInterface* stub) : stub_(stub) {}
+ explicit FakeClient(EchoTestService::StubInterface* stub) : stub_(stub) {}
void DoEcho() {
ClientContext context;
@@ -197,13 +197,13 @@ class FakeClient {
EXPECT_TRUE(s.ok());
}
- void ResetStub(TestService::StubInterface* stub) { stub_ = stub; }
+ void ResetStub(EchoTestService::StubInterface* stub) { stub_ = stub; }
private:
- TestService::StubInterface* stub_;
+ EchoTestService::StubInterface* stub_;
};
-class TestServiceImpl : public TestService::Service {
+class TestServiceImpl : public EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE {
@@ -245,10 +245,10 @@ class MockTest : public ::testing::Test {
void ResetStub() {
std::shared_ptr<Channel> channel =
CreateChannel(server_address_.str(), InsecureChannelCredentials());
- stub_ = grpc::cpp::test::util::TestService::NewStub(channel);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel);
}
- std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::ostringstream server_address_;
TestServiceImpl service_;
diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc
index 4b6793abe6..9bf9423666 100644
--- a/test/cpp/end2end/server_crash_test.cc
+++ b/test/cpp/end2end/server_crash_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,25 +31,25 @@
*
*/
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
#include <gtest/gtest.h>
+#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
#include "test/cpp/util/subprocess.h"
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
using std::chrono::system_clock;
static std::string g_root;
@@ -60,7 +60,7 @@ namespace testing {
namespace {
class ServiceImpl GRPC_FINAL
- : public ::grpc::cpp::test::util::TestService::Service {
+ : public ::grpc::testing::EchoTestService::Service {
public:
ServiceImpl() : bidi_stream_count_(0), response_stream_count_(0) {}
diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc
index 2baefcbf42..b0e6ac6f56 100644
--- a/test/cpp/end2end/server_crash_test_client.cc
+++ b/test/cpp/end2end/server_crash_test_client.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,22 +31,22 @@
*
*/
+#include <gflags/gflags.h>
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
-#include <gflags/gflags.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
-#include "test/cpp/util/echo.grpc.pb.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
DEFINE_string(address, "", "Address to connect to");
DEFINE_string(mode, "", "Test mode to use");
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
// In some distros, gflags is in the namespace google, and in some others,
// in gflags. This hack is enabling us to find both.
@@ -57,7 +57,7 @@ using namespace gflags;
int main(int argc, char** argv) {
ParseCommandLineFlags(&argc, &argv, true);
- auto stub = grpc::cpp::test::util::TestService::NewStub(
+ auto stub = grpc::testing::EchoTestService::NewStub(
grpc::CreateChannel(FLAGS_address, grpc::InsecureChannelCredentials()));
EchoRequest request;
diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc
index b1b18b2a7f..dbbda3ac51 100644
--- a/test/cpp/end2end/shutdown_test.cc
+++ b/test/cpp/end2end/shutdown_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,28 +33,28 @@
#include <thread>
-#include <grpc/grpc.h>
-#include <grpc/support/sync.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
+#include <grpc/grpc.h>
+#include <grpc/support/sync.h>
#include <gtest/gtest.h>
#include "src/core/support/env.h"
-#include "test/core/util/test_config.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
-#include "test/cpp/util/echo.grpc.pb.h"
+#include "test/core/util/test_config.h"
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
namespace grpc {
namespace testing {
-class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
+class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public:
explicit TestServiceImpl(gpr_event* ev) : ev_(ev) {}
@@ -94,7 +94,7 @@ class ShutdownTest : public ::testing::Test {
void ResetStub() {
string target = "dns:localhost:" + to_string(port_);
channel_ = CreateChannel(target, InsecureChannelCredentials());
- stub_ = grpc::cpp::test::util::TestService::NewStub(channel_);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel_);
}
string to_string(const int number) {
@@ -115,7 +115,7 @@ class ShutdownTest : public ::testing::Test {
protected:
std::shared_ptr<Channel> channel_;
- std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
bool shutdown_;
int port_;
diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc
index b7e103a1ae..4777b88747 100644
--- a/test/cpp/end2end/streaming_throughput_test.cc
+++ b/test/cpp/end2end/streaming_throughput_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,9 +31,9 @@
*
*/
+#include <time.h>
#include <mutex>
#include <thread>
-#include <time.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
@@ -49,13 +49,13 @@
#include <grpc/support/time.h>
#include <gtest/gtest.h>
+#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
using std::chrono::system_clock;
const char* kLargeString =
@@ -99,7 +99,7 @@ const char* kLargeString =
namespace grpc {
namespace testing {
-class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
+class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public:
static void BidiStream_Sender(
ServerReaderWriter<EchoResponse, EchoRequest>* stream,
@@ -161,10 +161,10 @@ class End2endTest : public ::testing::Test {
void ResetStub() {
std::shared_ptr<Channel> channel =
CreateChannel(server_address_.str(), InsecureChannelCredentials());
- stub_ = grpc::cpp::test::util::TestService::NewStub(channel);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel);
}
- std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::ostringstream server_address_;
TestServiceImpl service_;
diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc
index fb82b96135..4e8860e843 100644
--- a/test/cpp/end2end/thread_stress_test.cc
+++ b/test/cpp/end2end/thread_stress_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,24 +34,24 @@
#include <mutex>
#include <thread>
-#include <grpc/grpc.h>
-#include <grpc/support/thd.h>
-#include <grpc/support/time.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
+#include <grpc/grpc.h>
+#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
#include <gtest/gtest.h>
+#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo_duplicate.grpc.pb.h"
-#include "test/cpp/util/echo.grpc.pb.h"
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
using std::chrono::system_clock;
namespace grpc {
@@ -74,7 +74,7 @@ void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request,
} // namespace
-class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
+class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public:
TestServiceImpl() : signal_client_(false) {}
@@ -159,7 +159,7 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
};
class TestServiceImplDupPkg
- : public ::grpc::cpp::test::util::duplicate::TestService::Service {
+ : public ::grpc::testing::duplicate::EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE {
@@ -191,10 +191,10 @@ class End2endTest : public ::testing::Test {
void ResetStub() {
std::shared_ptr<Channel> channel =
CreateChannel(server_address_.str(), InsecureChannelCredentials());
- stub_ = grpc::cpp::test::util::TestService::NewStub(channel);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel);
}
- std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::ostringstream server_address_;
const int kMaxMessageSize_;
@@ -202,8 +202,7 @@ class End2endTest : public ::testing::Test {
TestServiceImplDupPkg dup_pkg_service_;
};
-static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub,
- int num_rpcs) {
+static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs) {
EchoRequest request;
EchoResponse response;
request.set_message("Hello");
diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc
index 41482717d2..bbf1b0edc1 100644
--- a/test/cpp/end2end/zookeeper_test.cc
+++ b/test/cpp/end2end/zookeeper_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,24 +37,24 @@
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
-#include <gtest/gtest.h>
#include <grpc/grpc.h>
#include <grpc/grpc_zookeeper.h>
+#include <gtest/gtest.h>
#include <zookeeper/zookeeper.h>
-#include "test/core/util/test_config.h"
-#include "test/core/util/port.h"
-#include "test/cpp/util/echo.grpc.pb.h"
#include "src/core/support/env.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
+#include "test/core/util/port.h"
+#include "test/core/util/test_config.h"
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
namespace grpc {
namespace testing {
class ZookeeperTestServiceImpl
- : public ::grpc::cpp::test::util::TestService::Service {
+ : public ::grpc::testing::EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE {
@@ -158,7 +158,7 @@ class ZookeeperTest : public ::testing::Test {
void ResetStub() {
string target = "zookeeper://" + zookeeper_address_ + "/test";
channel_ = CreateChannel(target, InsecureChannelCredentials());
- stub_ = grpc::cpp::test::util::TestService::NewStub(channel_);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel_);
}
string to_string(const int number) {
@@ -168,7 +168,7 @@ class ZookeeperTest : public ::testing::Test {
}
std::shared_ptr<Channel> channel_;
- std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server1_;
std::unique_ptr<Server> server2_;
ZookeeperTestServiceImpl service_;
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc
index a758e73def..b06310781a 100644
--- a/test/cpp/interop/interop_client.cc
+++ b/test/cpp/interop/interop_client.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,10 +47,10 @@
#include <grpc/support/useful.h>
#include "src/core/transport/byte_stream.h"
+#include "src/proto/grpc/testing/empty.grpc.pb.h"
+#include "src/proto/grpc/testing/test.grpc.pb.h"
+#include "src/proto/grpc/testing/messages.grpc.pb.h"
#include "test/cpp/interop/client_helper.h"
-#include "test/proto/empty.grpc.pb.h"
-#include "test/proto/messages.grpc.pb.h"
-#include "test/proto/test.grpc.pb.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h
index 97a6fd77cf..3ecd380398 100644
--- a/test/cpp/interop/interop_client.h
+++ b/test/cpp/interop/interop_client.h
@@ -38,8 +38,8 @@
#include <grpc/grpc.h>
#include <grpc++/channel.h>
-#include "test/proto/messages.grpc.pb.h"
-#include "test/proto/test.grpc.pb.h"
+#include "src/proto/grpc/testing/messages.grpc.pb.h"
+#include "src/proto/grpc/testing/test.grpc.pb.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/interop/metrics_client.cc b/test/cpp/interop/metrics_client.cc
index 2865c855a2..0c140ffd85 100644
--- a/test/cpp/interop/metrics_client.cc
+++ b/test/cpp/interop/metrics_client.cc
@@ -39,8 +39,8 @@
#include "test/cpp/util/metrics_server.h"
#include "test/cpp/util/test_config.h"
-#include "test/proto/metrics.grpc.pb.h"
-#include "test/proto/metrics.pb.h"
+#include "src/proto/grpc/testing/metrics.grpc.pb.h"
+#include "src/proto/grpc/testing/metrics.pb.h"
DEFINE_string(metrics_server_address, "",
"The metrics server addresses in the fomrat <hostname>:<port>");
diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc
index d332dcad84..1f6b352db1 100644
--- a/test/cpp/interop/reconnect_interop_client.cc
+++ b/test/cpp/interop/reconnect_interop_client.cc
@@ -41,9 +41,9 @@
#include <grpc++/client_context.h>
#include "test/cpp/util/create_test_channel.h"
#include "test/cpp/util/test_config.h"
-#include "test/proto/test.grpc.pb.h"
-#include "test/proto/empty.grpc.pb.h"
-#include "test/proto/messages.grpc.pb.h"
+#include "src/proto/grpc/testing/test.grpc.pb.h"
+#include "src/proto/grpc/testing/empty.grpc.pb.h"
+#include "src/proto/grpc/testing/messages.grpc.pb.h"
DEFINE_int32(server_control_port, 0, "Server port for control rpcs.");
DEFINE_int32(server_retry_port, 0, "Server port for testing reconnection.");
diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc
index d08385a74c..3602b8c2b0 100644
--- a/test/cpp/interop/reconnect_interop_server.cc
+++ b/test/cpp/interop/reconnect_interop_server.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,9 +48,9 @@
#include "test/core/util/reconnect_server.h"
#include "test/cpp/util/test_config.h"
-#include "test/proto/test.grpc.pb.h"
-#include "test/proto/empty.grpc.pb.h"
-#include "test/proto/messages.grpc.pb.h"
+#include "src/proto/grpc/testing/test.grpc.pb.h"
+#include "src/proto/grpc/testing/empty.grpc.pb.h"
+#include "src/proto/grpc/testing/messages.grpc.pb.h"
DEFINE_int32(control_port, 0, "Server port for controlling the server.");
DEFINE_int32(retry_port, 0,
diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc
index c0e1ec943d..cdca060c23 100644
--- a/test/cpp/interop/server.cc
+++ b/test/cpp/interop/server.cc
@@ -50,9 +50,9 @@
#include "test/cpp/interop/server_helper.h"
#include "test/cpp/util/test_config.h"
-#include "test/proto/test.grpc.pb.h"
-#include "test/proto/empty.grpc.pb.h"
-#include "test/proto/messages.grpc.pb.h"
+#include "src/proto/grpc/testing/test.grpc.pb.h"
+#include "src/proto/grpc/testing/empty.grpc.pb.h"
+#include "src/proto/grpc/testing/messages.grpc.pb.h"
DEFINE_bool(use_tls, false, "Whether to use tls.");
DEFINE_int32(port, 0, "Server port.");
diff --git a/test/cpp/interop/stress_interop_client.cc b/test/cpp/interop/stress_interop_client.cc
index 04671fb935..b581e9b33c 100644
--- a/test/cpp/interop/stress_interop_client.cc
+++ b/test/cpp/interop/stress_interop_client.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc
index 22ef5a5491..702354dc87 100644
--- a/test/cpp/interop/stress_test.cc
+++ b/test/cpp/interop/stress_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,8 +47,8 @@
#include "test/cpp/interop/stress_interop_client.h"
#include "test/cpp/util/metrics_server.h"
#include "test/cpp/util/test_config.h"
-#include "test/proto/metrics.grpc.pb.h"
-#include "test/proto/metrics.pb.h"
+#include "src/proto/grpc/testing/metrics.grpc.pb.h"
+#include "src/proto/grpc/testing/metrics.pb.h"
extern "C" {
extern void gpr_default_log(gpr_log_func_args* args);
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index b24a90adac..97487fd0b2 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,12 +37,15 @@
#include <condition_variable>
#include <mutex>
+#include <grpc++/support/byte_buffer.h>
+#include <grpc++/support/slice.h>
+
#include "test/cpp/qps/histogram.h"
#include "test/cpp/qps/interarrival.h"
#include "test/cpp/qps/timer.h"
#include "test/cpp/util/create_test_channel.h"
-#include "test/proto/benchmarks/payloads.grpc.pb.h"
-#include "test/proto/benchmarks/services.grpc.pb.h"
+#include "src/proto/grpc/testing/payloads.grpc.pb.h"
+#include "src/proto/grpc/testing/services.grpc.pb.h"
namespace grpc {
@@ -66,37 +69,64 @@ namespace testing {
typedef std::chrono::high_resolution_clock grpc_time_source;
typedef std::chrono::time_point<grpc_time_source> grpc_time;
-class Client {
+template <class RequestType>
+class ClientRequestCreator {
public:
- explicit Client(const ClientConfig& config)
- : channels_(config.client_channels()),
- timer_(new Timer),
- interarrival_timer_() {
- for (int i = 0; i < config.client_channels(); i++) {
- channels_[i].init(config.server_targets(i % config.server_targets_size()),
- config);
- }
- if (config.payload_config().has_bytebuf_params()) {
- GPR_ASSERT(false); // not yet implemented
- } else if (config.payload_config().has_simple_params()) {
- request_.set_response_type(grpc::testing::PayloadType::COMPRESSABLE);
- request_.set_response_size(
- config.payload_config().simple_params().resp_size());
- request_.mutable_payload()->set_type(
+ ClientRequestCreator(RequestType* req, const PayloadConfig&) {
+ // this template must be specialized
+ // fail with an assertion rather than a compile-time
+ // check since these only happen at the beginning anyway
+ GPR_ASSERT(false);
+ }
+};
+
+template <>
+class ClientRequestCreator<SimpleRequest> {
+ public:
+ ClientRequestCreator(SimpleRequest* req,
+ const PayloadConfig& payload_config) {
+ if (payload_config.has_bytebuf_params()) {
+ GPR_ASSERT(false); // not appropriate for this specialization
+ } else if (payload_config.has_simple_params()) {
+ req->set_response_type(grpc::testing::PayloadType::COMPRESSABLE);
+ req->set_response_size(payload_config.simple_params().resp_size());
+ req->mutable_payload()->set_type(
grpc::testing::PayloadType::COMPRESSABLE);
- int size = config.payload_config().simple_params().req_size();
+ int size = payload_config.simple_params().req_size();
std::unique_ptr<char[]> body(new char[size]);
- request_.mutable_payload()->set_body(body.get(), size);
- } else if (config.payload_config().has_complex_params()) {
- GPR_ASSERT(false); // not yet implemented
+ req->mutable_payload()->set_body(body.get(), size);
+ } else if (payload_config.has_complex_params()) {
+ GPR_ASSERT(false); // not appropriate for this specialization
} else {
// default should be simple proto without payloads
- request_.set_response_type(grpc::testing::PayloadType::COMPRESSABLE);
- request_.set_response_size(0);
- request_.mutable_payload()->set_type(
+ req->set_response_type(grpc::testing::PayloadType::COMPRESSABLE);
+ req->set_response_size(0);
+ req->mutable_payload()->set_type(
grpc::testing::PayloadType::COMPRESSABLE);
}
}
+};
+
+template <>
+class ClientRequestCreator<ByteBuffer> {
+ public:
+ ClientRequestCreator(ByteBuffer* req, const PayloadConfig& payload_config) {
+ if (payload_config.has_bytebuf_params()) {
+ std::unique_ptr<char[]> buf(
+ new char[payload_config.bytebuf_params().req_size()]);
+ gpr_slice s = gpr_slice_from_copied_buffer(
+ buf.get(), payload_config.bytebuf_params().req_size());
+ Slice slice(s, Slice::STEAL_REF);
+ *req = ByteBuffer(&slice, 1);
+ } else {
+ GPR_ASSERT(false); // not appropriate for this specialization
+ }
+ }
+};
+
+class Client {
+ public:
+ Client() : timer_(new Timer), interarrival_timer_() {}
virtual ~Client() {}
ClientStats Mark(bool reset) {
@@ -134,37 +164,8 @@ class Client {
}
protected:
- SimpleRequest request_;
bool closed_loop_;
- class ClientChannelInfo {
- public:
- ClientChannelInfo() {}
- ClientChannelInfo(const ClientChannelInfo& i) {
- // The copy constructor is to satisfy old compilers
- // that need it for using std::vector . It is only ever
- // used for empty entries
- GPR_ASSERT(!i.channel_ && !i.stub_);
- }
- void init(const grpc::string& target, const ClientConfig& config) {
- // We have to use a 2-phase init like this with a default
- // constructor followed by an initializer function to make
- // old compilers happy with using this in std::vector
- channel_ = CreateTestChannel(
- target, config.security_params().server_host_override(),
- config.has_security_params(),
- !config.security_params().use_test_ca());
- stub_ = BenchmarkService::NewStub(channel_);
- }
- Channel* get_channel() { return channel_.get(); }
- BenchmarkService::Stub* get_stub() { return stub_.get(); }
-
- private:
- std::shared_ptr<Channel> channel_;
- std::unique_ptr<BenchmarkService::Stub> stub_;
- };
- std::vector<ClientChannelInfo> channels_;
-
void StartThreads(size_t num_threads) {
for (size_t i = 0; i < num_threads; i++) {
threads_.emplace_back(new Thread(this, i));
@@ -295,8 +296,6 @@ class Client {
}
}
- BenchmarkService::Stub* stub_;
- ClientConfig config_;
std::mutex mu_;
std::condition_variable cv_;
bool done_;
@@ -314,11 +313,66 @@ class Client {
std::vector<grpc_time> next_time_;
};
+template <class StubType, class RequestType>
+class ClientImpl : public Client {
+ public:
+ ClientImpl(const ClientConfig& config,
+ std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)>
+ create_stub)
+ : channels_(config.client_channels()), create_stub_(create_stub) {
+ for (int i = 0; i < config.client_channels(); i++) {
+ channels_[i].init(config.server_targets(i % config.server_targets_size()),
+ config, create_stub_);
+ }
+
+ ClientRequestCreator<RequestType> create_req(&request_,
+ config.payload_config());
+ }
+ virtual ~ClientImpl() {}
+
+ protected:
+ RequestType request_;
+
+ class ClientChannelInfo {
+ public:
+ ClientChannelInfo() {}
+ ClientChannelInfo(const ClientChannelInfo& i) {
+ // The copy constructor is to satisfy old compilers
+ // that need it for using std::vector . It is only ever
+ // used for empty entries
+ GPR_ASSERT(!i.channel_ && !i.stub_);
+ }
+ void init(const grpc::string& target, const ClientConfig& config,
+ std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)>
+ create_stub) {
+ // We have to use a 2-phase init like this with a default
+ // constructor followed by an initializer function to make
+ // old compilers happy with using this in std::vector
+ channel_ = CreateTestChannel(
+ target, config.security_params().server_host_override(),
+ config.has_security_params(),
+ !config.security_params().use_test_ca());
+ stub_ = create_stub(channel_);
+ }
+ Channel* get_channel() { return channel_.get(); }
+ StubType* get_stub() { return stub_.get(); }
+
+ private:
+ std::shared_ptr<Channel> channel_;
+ std::unique_ptr<StubType> stub_;
+ };
+ std::vector<ClientChannelInfo> channels_;
+ std::function<std::unique_ptr<StubType>(const std::shared_ptr<Channel>&)>
+ create_stub_;
+};
+
std::unique_ptr<Client> CreateSynchronousUnaryClient(const ClientConfig& args);
std::unique_ptr<Client> CreateSynchronousStreamingClient(
const ClientConfig& args);
std::unique_ptr<Client> CreateAsyncUnaryClient(const ClientConfig& args);
std::unique_ptr<Client> CreateAsyncStreamingClient(const ClientConfig& args);
+std::unique_ptr<Client> CreateGenericAsyncStreamingClient(
+ const ClientConfig& args);
} // namespace testing
} // namespace grpc
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index 9594179822..f270cd0987 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,21 +37,22 @@
#include <list>
#include <memory>
#include <mutex>
+#include <sstream>
#include <string>
#include <thread>
#include <vector>
-#include <sstream>
+#include <gflags/gflags.h>
+#include <grpc++/client_context.h>
+#include <grpc++/generic/generic_stub.h>
#include <grpc/grpc.h>
#include <grpc/support/histogram.h>
#include <grpc/support/log.h>
-#include <gflags/gflags.h>
-#include <grpc++/client_context.h>
-#include "test/cpp/qps/timer.h"
#include "test/cpp/qps/client.h"
+#include "test/cpp/qps/timer.h"
#include "test/cpp/util/create_test_channel.h"
-#include "test/proto/benchmarks/services.grpc.pb.h"
+#include "src/proto/grpc/testing/services.grpc.pb.h"
namespace grpc {
namespace testing {
@@ -147,13 +148,22 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
typedef std::forward_list<ClientRpcContext*> context_list;
-class AsyncClient : public Client {
+template <class StubType, class RequestType>
+class AsyncClient : public ClientImpl<StubType, RequestType> {
+ // Specify which protected members we are using since there is no
+ // member name resolution until the template types are fully resolved
public:
- explicit AsyncClient(
- const ClientConfig& config,
- std::function<ClientRpcContext*(int, BenchmarkService::Stub*,
- const SimpleRequest&)> setup_ctx)
- : Client(config),
+ using Client::SetupLoadTest;
+ using Client::NextIssueTime;
+ using Client::closed_loop_;
+ using ClientImpl<StubType, RequestType>::channels_;
+ using ClientImpl<StubType, RequestType>::request_;
+ AsyncClient(const ClientConfig& config,
+ std::function<ClientRpcContext*(int, StubType*,
+ const RequestType&)> setup_ctx,
+ std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)>
+ create_stub)
+ : ClientImpl<StubType, RequestType>(config, create_stub),
channel_lock_(new std::mutex[config.client_channels()]),
contexts_(config.client_channels()),
max_outstanding_per_channel_(config.outstanding_rpcs_per_channel()),
@@ -343,10 +353,16 @@ class AsyncClient : public Client {
int pref_channel_inc_;
};
-class AsyncUnaryClient GRPC_FINAL : public AsyncClient {
+static std::unique_ptr<BenchmarkService::Stub> BenchmarkStubCreator(
+ std::shared_ptr<Channel> ch) {
+ return BenchmarkService::NewStub(ch);
+}
+
+class AsyncUnaryClient GRPC_FINAL
+ : public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
public:
explicit AsyncUnaryClient(const ClientConfig& config)
- : AsyncClient(config, SetupCtx) {
+ : AsyncClient(config, SetupCtx, BenchmarkStubCreator) {
StartThreads(config.async_client_threads());
}
~AsyncUnaryClient() GRPC_OVERRIDE { EndThreads(); }
@@ -437,10 +453,11 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext {
stream_;
};
-class AsyncStreamingClient GRPC_FINAL : public AsyncClient {
+class AsyncStreamingClient GRPC_FINAL
+ : public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
public:
explicit AsyncStreamingClient(const ClientConfig& config)
- : AsyncClient(config, SetupCtx) {
+ : AsyncClient(config, SetupCtx, BenchmarkStubCreator) {
// async streaming currently only supports closed loop
GPR_ASSERT(closed_loop_);
@@ -467,12 +484,119 @@ class AsyncStreamingClient GRPC_FINAL : public AsyncClient {
}
};
+class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
+ public:
+ ClientRpcContextGenericStreamingImpl(
+ int channel_id, grpc::GenericStub* stub, const ByteBuffer& req,
+ std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>(
+ grpc::GenericStub*, grpc::ClientContext*,
+ const grpc::string& method_name, CompletionQueue*, void*)> start_req,
+ std::function<void(grpc::Status, ByteBuffer*)> on_done)
+ : ClientRpcContext(channel_id),
+ context_(),
+ stub_(stub),
+ req_(req),
+ response_(),
+ next_state_(&ClientRpcContextGenericStreamingImpl::ReqSent),
+ callback_(on_done),
+ start_req_(start_req),
+ start_(Timer::Now()) {}
+ ~ClientRpcContextGenericStreamingImpl() GRPC_OVERRIDE {}
+ bool RunNextState(bool ok, Histogram* hist) GRPC_OVERRIDE {
+ return (this->*next_state_)(ok, hist);
+ }
+ ClientRpcContext* StartNewClone() GRPC_OVERRIDE {
+ return new ClientRpcContextGenericStreamingImpl(channel_id_, stub_, req_,
+ start_req_, callback_);
+ }
+ void Start(CompletionQueue* cq) GRPC_OVERRIDE {
+ const grpc::string kMethodName(
+ "/grpc.testing.BenchmarkService/StreamingCall");
+ stream_ = start_req_(stub_, &context_, kMethodName, cq,
+ ClientRpcContext::tag(this));
+ }
+
+ private:
+ bool ReqSent(bool ok, Histogram*) { return StartWrite(ok); }
+ bool StartWrite(bool ok) {
+ if (!ok) {
+ return (false);
+ }
+ start_ = Timer::Now();
+ next_state_ = &ClientRpcContextGenericStreamingImpl::WriteDone;
+ stream_->Write(req_, ClientRpcContext::tag(this));
+ return true;
+ }
+ bool WriteDone(bool ok, Histogram*) {
+ if (!ok) {
+ return (false);
+ }
+ next_state_ = &ClientRpcContextGenericStreamingImpl::ReadDone;
+ stream_->Read(&response_, ClientRpcContext::tag(this));
+ return true;
+ }
+ bool ReadDone(bool ok, Histogram* hist) {
+ hist->Add((Timer::Now() - start_) * 1e9);
+ return StartWrite(ok);
+ }
+ grpc::ClientContext context_;
+ grpc::GenericStub* stub_;
+ ByteBuffer req_;
+ ByteBuffer response_;
+ bool (ClientRpcContextGenericStreamingImpl::*next_state_)(bool, Histogram*);
+ std::function<void(grpc::Status, ByteBuffer*)> callback_;
+ std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>(
+ grpc::GenericStub*, grpc::ClientContext*, const grpc::string&,
+ CompletionQueue*, void*)> start_req_;
+ grpc::Status status_;
+ double start_;
+ std::unique_ptr<grpc::GenericClientAsyncReaderWriter> stream_;
+};
+
+static std::unique_ptr<grpc::GenericStub> GenericStubCreator(
+ std::shared_ptr<Channel> ch) {
+ return std::unique_ptr<grpc::GenericStub>(new grpc::GenericStub(ch));
+}
+
+class GenericAsyncStreamingClient GRPC_FINAL
+ : public AsyncClient<grpc::GenericStub, ByteBuffer> {
+ public:
+ explicit GenericAsyncStreamingClient(const ClientConfig& config)
+ : AsyncClient(config, SetupCtx, GenericStubCreator) {
+ // async streaming currently only supports closed loop
+ GPR_ASSERT(closed_loop_);
+
+ StartThreads(config.async_client_threads());
+ }
+
+ ~GenericAsyncStreamingClient() GRPC_OVERRIDE { EndThreads(); }
+
+ private:
+ static void CheckDone(grpc::Status s, ByteBuffer* response) {}
+ static std::unique_ptr<grpc::GenericClientAsyncReaderWriter> StartReq(
+ grpc::GenericStub* stub, grpc::ClientContext* ctx,
+ const grpc::string& method_name, CompletionQueue* cq, void* tag) {
+ auto stream = stub->Call(ctx, method_name, cq, tag);
+ return stream;
+ };
+ static ClientRpcContext* SetupCtx(int channel_id, grpc::GenericStub* stub,
+ const ByteBuffer& req) {
+ return new ClientRpcContextGenericStreamingImpl(
+ channel_id, stub, req, GenericAsyncStreamingClient::StartReq,
+ GenericAsyncStreamingClient::CheckDone);
+ }
+};
+
std::unique_ptr<Client> CreateAsyncUnaryClient(const ClientConfig& args) {
return std::unique_ptr<Client>(new AsyncUnaryClient(args));
}
std::unique_ptr<Client> CreateAsyncStreamingClient(const ClientConfig& args) {
return std::unique_ptr<Client>(new AsyncStreamingClient(args));
}
+std::unique_ptr<Client> CreateGenericAsyncStreamingClient(
+ const ClientConfig& args) {
+ return std::unique_ptr<Client>(new GenericAsyncStreamingClient(args));
+}
} // namespace testing
} // namespace grpc
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index 10d680860a..92fbf240ce 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,38 +35,44 @@
#include <chrono>
#include <memory>
#include <mutex>
+#include <sstream>
#include <string>
#include <thread>
#include <vector>
-#include <sstream>
#include <gflags/gflags.h>
+#include <grpc++/client_context.h>
+#include <grpc++/server.h>
+#include <grpc++/server_builder.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/histogram.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
-#include <grpc++/client_context.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
#include <gtest/gtest.h>
-#include "test/cpp/util/create_test_channel.h"
+#include "src/core/profiling/timers.h"
+#include "src/proto/grpc/testing/services.grpc.pb.h"
#include "test/cpp/qps/client.h"
#include "test/cpp/qps/histogram.h"
#include "test/cpp/qps/interarrival.h"
#include "test/cpp/qps/timer.h"
-#include "test/proto/benchmarks/services.grpc.pb.h"
-
-#include "src/core/profiling/timers.h"
namespace grpc {
namespace testing {
-class SynchronousClient : public Client {
+static std::unique_ptr<BenchmarkService::Stub> BenchmarkStubCreator(
+ std::shared_ptr<Channel> ch) {
+ return BenchmarkService::NewStub(ch);
+}
+
+class SynchronousClient
+ : public ClientImpl<BenchmarkService::Stub, SimpleRequest> {
public:
- SynchronousClient(const ClientConfig& config) : Client(config) {
+ SynchronousClient(const ClientConfig& config)
+ : ClientImpl<BenchmarkService::Stub, SimpleRequest>(
+ config, BenchmarkStubCreator) {
num_threads_ =
config.outstanding_rpcs_per_channel() * config.client_channels();
responses_.resize(num_threads_);
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 20dc65046b..acb265b308 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -48,7 +48,7 @@
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/histogram.h"
#include "test/cpp/qps/qps_worker.h"
-#include "test/proto/benchmarks/services.grpc.pb.h"
+#include "src/proto/grpc/testing/services.grpc.pb.h"
using std::list;
using std::thread;
diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h
index 50bf17ceab..2a7cf805e5 100644
--- a/test/cpp/qps/driver.h
+++ b/test/cpp/qps/driver.h
@@ -37,7 +37,7 @@
#include <memory>
#include "test/cpp/qps/histogram.h"
-#include "test/proto/benchmarks/control.grpc.pb.h"
+#include "src/proto/grpc/testing/control.grpc.pb.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/generic_async_streaming_ping_pong_test.cc b/test/cpp/qps/generic_async_streaming_ping_pong_test.cc
new file mode 100644
index 0000000000..2b2e1c820f
--- /dev/null
+++ b/test/cpp/qps/generic_async_streaming_ping_pong_test.cc
@@ -0,0 +1,82 @@
+/*
+ *
+ * Copyright 2015-2016, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <set>
+
+#include <grpc/support/log.h>
+
+#include "test/cpp/qps/driver.h"
+#include "test/cpp/qps/report.h"
+#include "test/cpp/util/benchmark_config.h"
+
+namespace grpc {
+namespace testing {
+
+static const int WARMUP = 5;
+static const int BENCHMARK = 10;
+
+static void RunGenericAsyncStreamingPingPong() {
+ gpr_log(GPR_INFO, "Running Generic Async Streaming Ping Pong");
+
+ ClientConfig client_config;
+ client_config.set_client_type(ASYNC_CLIENT);
+ client_config.set_outstanding_rpcs_per_channel(1);
+ client_config.set_client_channels(1);
+ client_config.set_async_client_threads(1);
+ client_config.set_rpc_type(STREAMING);
+ client_config.mutable_load_params()->mutable_closed_loop();
+ auto bbuf = client_config.mutable_payload_config()->mutable_bytebuf_params();
+ bbuf->set_resp_size(0);
+ bbuf->set_req_size(0);
+
+ ServerConfig server_config;
+ server_config.set_server_type(ASYNC_SERVER);
+ server_config.set_host("localhost");
+ server_config.set_async_server_threads(1);
+
+ const auto result =
+ RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
+
+ GetReporter()->ReportQPS(*result);
+ GetReporter()->ReportLatency(*result);
+}
+
+} // namespace testing
+} // namespace grpc
+
+int main(int argc, char** argv) {
+ grpc::testing::InitBenchmark(&argc, &argv, true);
+
+ grpc::testing::RunGenericAsyncStreamingPingPong();
+ return 0;
+}
diff --git a/test/cpp/qps/histogram.h b/test/cpp/qps/histogram.h
index 4161eac826..acb415f0a1 100644
--- a/test/cpp/qps/histogram.h
+++ b/test/cpp/qps/histogram.h
@@ -35,7 +35,7 @@
#define TEST_QPS_HISTOGRAM_H
#include <grpc/support/histogram.h>
-#include "test/proto/benchmarks/stats.grpc.pb.h"
+#include "src/proto/grpc/testing/stats.grpc.pb.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/perf_db.proto b/test/cpp/qps/perf_db.proto
deleted file mode 100644
index 8a691ddded..0000000000
--- a/test/cpp/qps/perf_db.proto
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-import "test/proto/benchmarks/control.proto";
-
-package grpc.testing;
-
-service PerfDbTransfer {
- // Sends client info
- rpc RecordSingleClientData(SingleUserRecordRequest)
- returns (SingleUserRecordReply) {
- }
-}
-
-// Metrics to be stored
-message Metrics {
- double qps = 1;
- double qps_per_core = 2;
- double perc_lat_50 = 3;
- double perc_lat_90 = 4;
- double perc_lat_95 = 5;
- double perc_lat_99 = 6;
- double perc_lat_99_point_9 = 7;
- double server_system_time = 8;
- double server_user_time = 9;
- double client_system_time = 10;
- double client_user_time = 11;
-}
-
-// Request for storing a single user's data
-message SingleUserRecordRequest {
- string hashed_id = 1;
- string test_name = 2;
- string sys_info = 3;
- string tag = 4;
- Metrics metrics = 5;
- ClientConfig client_config = 6;
- ServerConfig server_config = 7;
-}
-
-// Reply to request for storing single user's data
-message SingleUserRecordReply {
-}
diff --git a/test/cpp/qps/perf_db_client.h b/test/cpp/qps/perf_db_client.h
index 72ebe79c3c..ece020aa9b 100644
--- a/test/cpp/qps/perf_db_client.h
+++ b/test/cpp/qps/perf_db_client.h
@@ -42,7 +42,7 @@
#include <grpc++/client_context.h>
#include <grpc++/create_channel.h>
#include <grpc++/security/credentials.h>
-#include "test/cpp/qps/perf_db.grpc.pb.h"
+#include "src/proto/grpc/testing/perf_db.grpc.pb.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc
index c7096391e6..9816a09592 100644
--- a/test/cpp/qps/qps_driver.cc
+++ b/test/cpp/qps/qps_driver.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -62,6 +62,8 @@ DEFINE_int32(client_channels, 1, "Number of client channels");
DEFINE_int32(simple_req_size, -1, "Simple proto request payload size");
DEFINE_int32(simple_resp_size, -1, "Simple proto response payload size");
+DEFINE_int32(bbuf_req_size, -1, "Byte-buffer request payload size");
+DEFINE_int32(bbuf_resp_size, -1, "Byte-buffer response payload size");
DEFINE_string(client_type, "SYNC_CLIENT", "Client type");
DEFINE_int32(async_client_threads, 1, "Async client threads");
@@ -109,6 +111,13 @@ static void QpsDriver() {
if (FLAGS_simple_req_size >= 0) {
params->set_req_size(FLAGS_simple_req_size);
}
+ } else if (FLAGS_bbuf_resp_size >= 0) {
+ auto params =
+ client_config.mutable_payload_config()->mutable_bytebuf_params();
+ params->set_resp_size(FLAGS_bbuf_resp_size);
+ if (FLAGS_bbuf_req_size >= 0) {
+ params->set_req_size(FLAGS_bbuf_req_size);
+ }
} else {
// set a reasonable default: proto but no payload
client_config.mutable_payload_config()->mutable_simple_params();
@@ -156,6 +165,13 @@ static void QpsDriver() {
server_config.mutable_security_params()->CopyFrom(security);
}
+ // Make sure that if we are performing a generic (bytebuf) test
+ // that we are also using async streaming
+ GPR_ASSERT(!client_config.payload_config().has_bytebuf_params() ||
+ (client_config.client_type() == ASYNC_CLIENT &&
+ client_config.rpc_type() == STREAMING &&
+ server_config.server_type() == ASYNC_SERVER));
+
const auto result = RunScenario(
client_config, FLAGS_num_clients, server_config, FLAGS_num_servers,
FLAGS_warmup_seconds, FLAGS_benchmark_seconds, FLAGS_local_workers);
diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc
index dc59eab7ef..c0276d05b3 100644
--- a/test/cpp/qps/qps_worker.cc
+++ b/test/cpp/qps/qps_worker.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,26 +36,26 @@
#include <cassert>
#include <memory>
#include <mutex>
+#include <sstream>
#include <string>
#include <thread>
#include <vector>
-#include <sstream>
+#include <grpc++/client_context.h>
+#include <grpc++/security/server_credentials.h>
+#include <grpc++/server.h>
+#include <grpc++/server_builder.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/histogram.h>
-#include <grpc/support/log.h>
#include <grpc/support/host_port.h>
-#include <grpc++/client_context.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/security/server_credentials.h>
+#include <grpc/support/log.h>
+#include "src/proto/grpc/testing/services.pb.h"
#include "test/core/util/grpc_profiler.h"
#include "test/cpp/qps/client.h"
#include "test/cpp/qps/server.h"
#include "test/cpp/util/create_test_channel.h"
-#include "test/proto/benchmarks/services.pb.h"
namespace grpc {
namespace testing {
@@ -69,7 +69,9 @@ static std::unique_ptr<Client> CreateClient(const ClientConfig& config) {
case ClientType::ASYNC_CLIENT:
return (config.rpc_type() == RpcType::UNARY)
? CreateAsyncUnaryClient(config)
- : CreateAsyncStreamingClient(config);
+ : (config.payload_config().has_bytebuf_params()
+ ? CreateGenericAsyncStreamingClient(config)
+ : CreateAsyncStreamingClient(config));
default:
abort();
}
@@ -95,7 +97,8 @@ static std::unique_ptr<Server> CreateServer(const ServerConfig& config) {
class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
public:
- explicit WorkerServiceImpl() : acquired_(false) {}
+ explicit WorkerServiceImpl(int server_port)
+ : acquired_(false), server_port_(server_port) {}
Status RunClient(ServerContext* ctx,
ServerReaderWriter<ClientStatus, ClientArgs>* stream)
@@ -194,6 +197,9 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
if (!args.has_setup()) {
return Status(StatusCode::INVALID_ARGUMENT, "");
}
+ if (server_port_ != 0) {
+ args.mutable_setup()->set_port(server_port_);
+ }
auto server = CreateServer(args.setup());
if (!server) {
return Status(StatusCode::INVALID_ARGUMENT, "");
@@ -217,10 +223,11 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
std::mutex mu_;
bool acquired_;
+ int server_port_;
};
-QpsWorker::QpsWorker(int driver_port) {
- impl_.reset(new WorkerServiceImpl());
+QpsWorker::QpsWorker(int driver_port, int server_port) {
+ impl_.reset(new WorkerServiceImpl(server_port));
char* server_address = NULL;
gpr_join_host_port(&server_address, "::", driver_port);
diff --git a/test/cpp/qps/qps_worker.h b/test/cpp/qps/qps_worker.h
index 0db88ad3d1..27de69fa65 100644
--- a/test/cpp/qps/qps_worker.h
+++ b/test/cpp/qps/qps_worker.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,7 @@ class WorkerServiceImpl;
class QpsWorker {
public:
- explicit QpsWorker(int driver_port);
+ explicit QpsWorker(int driver_port, int server_port = 0);
~QpsWorker();
private:
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h
index 6e81edc8ff..32a3e85026 100644
--- a/test/cpp/qps/server.h
+++ b/test/cpp/qps/server.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,8 +40,8 @@
#include "test/core/end2end/data/ssl_test_data.h"
#include "test/core/util/port.h"
#include "test/cpp/qps/timer.h"
-#include "test/proto/messages.grpc.pb.h"
-#include "test/proto/benchmarks/control.grpc.pb.h"
+#include "src/proto/grpc/testing/messages.grpc.pb.h"
+#include "src/proto/grpc/testing/control.grpc.pb.h"
namespace grpc {
namespace testing {
@@ -75,12 +75,11 @@ class Server {
}
static bool SetPayload(PayloadType type, int size, Payload* payload) {
- PayloadType response_type = type;
// TODO(yangg): Support UNCOMPRESSABLE payload.
if (type != PayloadType::COMPRESSABLE) {
return false;
}
- payload->set_type(response_type);
+ payload->set_type(type);
std::unique_ptr<char[]> body(new char[size]());
payload->set_body(body.get(), size);
return true;
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index c151918ce4..d530dac86b 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,26 +38,42 @@
#include <thread>
#include <gflags/gflags.h>
+#include <grpc++/generic/async_generic_service.h>
+#include <grpc++/security/server_credentials.h>
+#include <grpc++/server.h>
+#include <grpc++/server_builder.h>
+#include <grpc++/server_context.h>
+#include <grpc++/support/config.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
-#include <grpc++/support/config.h>
-#include <grpc++/server.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
-#include <grpc++/security/server_credentials.h>
#include <gtest/gtest.h>
#include "test/cpp/qps/server.h"
-#include "test/proto/benchmarks/services.grpc.pb.h"
+#include "src/proto/grpc/testing/services.grpc.pb.h"
namespace grpc {
namespace testing {
+template <class RequestType, class ResponseType, class ServiceType,
+ class ServerContextType>
class AsyncQpsServerTest : public Server {
public:
- explicit AsyncQpsServerTest(const ServerConfig &config) : Server(config) {
+ AsyncQpsServerTest(
+ const ServerConfig &config,
+ std::function<void(ServerBuilder *, ServiceType *)> register_service,
+ std::function<void(ServiceType *, ServerContextType *, RequestType *,
+ ServerAsyncResponseWriter<ResponseType> *,
+ CompletionQueue *, ServerCompletionQueue *, void *)>
+ request_unary_function,
+ std::function<void(ServiceType *, ServerContextType *,
+ ServerAsyncReaderWriter<ResponseType, RequestType> *,
+ CompletionQueue *, ServerCompletionQueue *, void *)>
+ request_streaming_function,
+ std::function<grpc::Status(const PayloadConfig &, const RequestType *,
+ ResponseType *)> process_rpc)
+ : Server(config) {
char *server_address = NULL;
gpr_join_host_port(&server_address, config.host().c_str(), port());
@@ -67,7 +83,8 @@ class AsyncQpsServerTest : public Server {
Server::CreateServerCredentials(config));
gpr_free(server_address);
- builder.RegisterAsyncService(&async_service_);
+ register_service(&builder, &async_service_);
+
for (int i = 0; i < config.async_server_threads(); i++) {
srv_cqs_.emplace_back(builder.AddCompletionQueue());
}
@@ -75,22 +92,29 @@ class AsyncQpsServerTest : public Server {
server_ = builder.BuildAndStart();
using namespace std::placeholders;
+
+ auto process_rpc_bound =
+ std::bind(process_rpc, config.payload_config(), _1, _2);
+
for (int i = 0; i < 10000 / config.async_server_threads(); i++) {
for (int j = 0; j < config.async_server_threads(); j++) {
- auto request_unary = std::bind(
- &BenchmarkService::AsyncService::RequestUnaryCall, &async_service_,
- _1, _2, _3, srv_cqs_[j].get(), srv_cqs_[j].get(), _4);
- auto request_streaming = std::bind(
- &BenchmarkService::AsyncService::RequestStreamingCall,
- &async_service_, _1, _2, srv_cqs_[j].get(), srv_cqs_[j].get(), _3);
- contexts_.push_front(
- new ServerRpcContextUnaryImpl<SimpleRequest, SimpleResponse>(
- request_unary, ProcessRPC));
- contexts_.push_front(
- new ServerRpcContextStreamingImpl<SimpleRequest, SimpleResponse>(
- request_streaming, ProcessRPC));
+ if (request_unary_function) {
+ auto request_unary =
+ std::bind(request_unary_function, &async_service_, _1, _2, _3,
+ srv_cqs_[j].get(), srv_cqs_[j].get(), _4);
+ contexts_.push_front(
+ new ServerRpcContextUnaryImpl(request_unary, process_rpc_bound));
+ }
+ if (request_streaming_function) {
+ auto request_streaming =
+ std::bind(request_streaming_function, &async_service_, _1, _2,
+ srv_cqs_[j].get(), srv_cqs_[j].get(), _3);
+ contexts_.push_front(new ServerRpcContextStreamingImpl(
+ request_streaming, process_rpc_bound));
+ }
}
}
+
for (int i = 0; i < config.async_server_threads(); i++) {
shutdown_state_.emplace_back(new PerThreadShutdownState());
}
@@ -155,16 +179,15 @@ class AsyncQpsServerTest : public Server {
return reinterpret_cast<ServerRpcContext *>(tag);
}
- template <class RequestType, class ResponseType>
class ServerRpcContextUnaryImpl GRPC_FINAL : public ServerRpcContext {
public:
ServerRpcContextUnaryImpl(
- std::function<void(ServerContext *, RequestType *,
+ std::function<void(ServerContextType *, RequestType *,
grpc::ServerAsyncResponseWriter<ResponseType> *,
void *)> request_method,
std::function<grpc::Status(const RequestType *, ResponseType *)>
invoke_method)
- : srv_ctx_(new ServerContext),
+ : srv_ctx_(new ServerContextType),
next_state_(&ServerRpcContextUnaryImpl::invoker),
request_method_(request_method),
invoke_method_(invoke_method),
@@ -177,7 +200,7 @@ class AsyncQpsServerTest : public Server {
return (this->*next_state_)(ok);
}
void Reset() GRPC_OVERRIDE {
- srv_ctx_.reset(new ServerContext);
+ srv_ctx_.reset(new ServerContextType);
req_ = RequestType();
response_writer_ =
grpc::ServerAsyncResponseWriter<ResponseType>(srv_ctx_.get());
@@ -205,10 +228,10 @@ class AsyncQpsServerTest : public Server {
response_writer_.Finish(response, status, AsyncQpsServerTest::tag(this));
return true;
}
- std::unique_ptr<ServerContext> srv_ctx_;
+ std::unique_ptr<ServerContextType> srv_ctx_;
RequestType req_;
bool (ServerRpcContextUnaryImpl::*next_state_)(bool);
- std::function<void(ServerContext *, RequestType *,
+ std::function<void(ServerContextType *, RequestType *,
grpc::ServerAsyncResponseWriter<ResponseType> *, void *)>
request_method_;
std::function<grpc::Status(const RequestType *, ResponseType *)>
@@ -216,16 +239,16 @@ class AsyncQpsServerTest : public Server {
grpc::ServerAsyncResponseWriter<ResponseType> response_writer_;
};
- template <class RequestType, class ResponseType>
class ServerRpcContextStreamingImpl GRPC_FINAL : public ServerRpcContext {
public:
ServerRpcContextStreamingImpl(
- std::function<void(ServerContext *, grpc::ServerAsyncReaderWriter<
- ResponseType, RequestType> *,
- void *)> request_method,
+ std::function<void(
+ ServerContextType *,
+ grpc::ServerAsyncReaderWriter<ResponseType, RequestType> *, void *)>
+ request_method,
std::function<grpc::Status(const RequestType *, ResponseType *)>
invoke_method)
- : srv_ctx_(new ServerContext),
+ : srv_ctx_(new ServerContextType),
next_state_(&ServerRpcContextStreamingImpl::request_done),
request_method_(request_method),
invoke_method_(invoke_method),
@@ -237,7 +260,7 @@ class AsyncQpsServerTest : public Server {
return (this->*next_state_)(ok);
}
void Reset() GRPC_OVERRIDE {
- srv_ctx_.reset(new ServerContext);
+ srv_ctx_.reset(new ServerContextType);
req_ = RequestType();
stream_ = grpc::ServerAsyncReaderWriter<ResponseType, RequestType>(
srv_ctx_.get());
@@ -286,11 +309,11 @@ class AsyncQpsServerTest : public Server {
}
bool finish_done(bool ok) { return false; /* reset the context */ }
- std::unique_ptr<ServerContext> srv_ctx_;
+ std::unique_ptr<ServerContextType> srv_ctx_;
RequestType req_;
bool (ServerRpcContextStreamingImpl::*next_state_)(bool);
std::function<void(
- ServerContext *,
+ ServerContextType *,
grpc::ServerAsyncReaderWriter<ResponseType, RequestType> *, void *)>
request_method_;
std::function<grpc::Status(const RequestType *, ResponseType *)>
@@ -298,20 +321,10 @@ class AsyncQpsServerTest : public Server {
grpc::ServerAsyncReaderWriter<ResponseType, RequestType> stream_;
};
- static Status ProcessRPC(const SimpleRequest *request,
- SimpleResponse *response) {
- if (request->response_size() > 0) {
- if (!SetPayload(request->response_type(), request->response_size(),
- response->mutable_payload())) {
- return Status(grpc::StatusCode::INTERNAL, "Error creating payload.");
- }
- }
- return Status::OK;
- }
std::vector<std::thread> threads_;
std::unique_ptr<grpc::Server> server_;
std::vector<std::unique_ptr<grpc::ServerCompletionQueue>> srv_cqs_;
- BenchmarkService::AsyncService async_service_;
+ ServiceType async_service_;
std::forward_list<ServerRpcContext *> contexts_;
class PerThreadShutdownState {
@@ -335,8 +348,52 @@ class AsyncQpsServerTest : public Server {
std::vector<std::unique_ptr<PerThreadShutdownState>> shutdown_state_;
};
+static void RegisterBenchmarkService(ServerBuilder *builder,
+ BenchmarkService::AsyncService *service) {
+ builder->RegisterAsyncService(service);
+}
+static void RegisterGenericService(ServerBuilder *builder,
+ grpc::AsyncGenericService *service) {
+ builder->RegisterAsyncGenericService(service);
+}
+
+static Status ProcessSimpleRPC(const PayloadConfig &,
+ const SimpleRequest *request,
+ SimpleResponse *response) {
+ if (request->response_size() > 0) {
+ if (!Server::SetPayload(request->response_type(), request->response_size(),
+ response->mutable_payload())) {
+ return Status(grpc::StatusCode::INTERNAL, "Error creating payload.");
+ }
+ }
+ return Status::OK;
+}
+
+static Status ProcessGenericRPC(const PayloadConfig &payload_config,
+ const ByteBuffer *request,
+ ByteBuffer *response) {
+ int resp_size = payload_config.bytebuf_params().resp_size();
+ std::unique_ptr<char> buf(new char[resp_size]);
+ gpr_slice s = gpr_slice_from_copied_buffer(buf.get(), resp_size);
+ Slice slice(s, Slice::STEAL_REF);
+ *response = ByteBuffer(&slice, 1);
+ return Status::OK;
+}
+
std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config) {
- return std::unique_ptr<Server>(new AsyncQpsServerTest(config));
+ return std::unique_ptr<Server>(new AsyncQpsServerTest<
+ SimpleRequest, SimpleResponse, BenchmarkService::AsyncService,
+ grpc::ServerContext>(
+ config, RegisterBenchmarkService,
+ &BenchmarkService::AsyncService::RequestUnaryCall,
+ &BenchmarkService::AsyncService::RequestStreamingCall, ProcessSimpleRPC));
+}
+std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig &config) {
+ return std::unique_ptr<Server>(
+ new AsyncQpsServerTest<ByteBuffer, ByteBuffer, grpc::AsyncGenericService,
+ grpc::GenericServerContext>(
+ config, RegisterGenericService, nullptr,
+ &grpc::AsyncGenericService::RequestCall, ProcessGenericRPC));
}
} // namespace testing
diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc
index 3a15bec888..97a1ff5255 100644
--- a/test/cpp/qps/server_sync.cc
+++ b/test/cpp/qps/server_sync.cc
@@ -45,7 +45,7 @@
#include "test/cpp/qps/server.h"
#include "test/cpp/qps/timer.h"
-#include "test/proto/benchmarks/services.grpc.pb.h"
+#include "src/proto/grpc/testing/services.grpc.pb.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc
index 430ffb7cdc..a1e73e9abe 100644
--- a/test/cpp/qps/worker.cc
+++ b/test/cpp/qps/worker.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
#include "test/cpp/util/test_config.h"
DEFINE_int32(driver_port, 0, "Port for communication with driver");
+DEFINE_int32(server_port, 0, "Port for operation as a server");
static bool got_sigint = false;
@@ -53,7 +54,7 @@ namespace grpc {
namespace testing {
static void RunServer() {
- QpsWorker worker(FLAGS_driver_port);
+ QpsWorker worker(FLAGS_driver_port, FLAGS_server_port);
while (!got_sigint) {
gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc
index 0de388d3ca..5e29e7a1d3 100644
--- a/test/cpp/util/cli_call.cc
+++ b/test/cpp/util/cli_call.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,13 +35,13 @@
#include <iostream>
-#include <grpc/grpc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
-#include <grpc++/support/byte_buffer.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
#include <grpc++/generic/generic_stub.h>
+#include <grpc++/support/byte_buffer.h>
+#include <grpc/grpc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/slice.h>
namespace grpc {
namespace testing {
diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc
index 32cd8e4103..5fdf519320 100644
--- a/test/cpp/util/cli_call_test.cc
+++ b/test/cpp/util/cli_call_test.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -44,16 +44,16 @@
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
-#include "test/cpp/util/echo.grpc.pb.h"
+#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/cpp/util/string_ref_helper.h"
-using grpc::cpp::test::util::EchoRequest;
-using grpc::cpp::test::util::EchoResponse;
+using grpc::testing::EchoRequest;
+using grpc::testing::EchoResponse;
namespace grpc {
namespace testing {
-class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
+class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE {
@@ -91,11 +91,11 @@ class CliCallTest : public ::testing::Test {
void ResetStub() {
channel_ =
CreateChannel(server_address_.str(), InsecureChannelCredentials());
- stub_ = grpc::cpp::test::util::TestService::NewStub(channel_);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel_);
}
std::shared_ptr<Channel> channel_;
- std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::ostringstream server_address_;
TestServiceImpl service_;
@@ -115,7 +115,7 @@ TEST_F(CliCallTest, SimpleRpc) {
EXPECT_EQ(response.message(), request.message());
EXPECT_TRUE(s.ok());
- const grpc::string kMethod("/grpc.cpp.test.util.TestService/Echo");
+ const grpc::string kMethod("/grpc.testing.EchoTestService/Echo");
grpc::string request_bin, response_bin, expected_response_bin;
EXPECT_TRUE(request.SerializeToString(&request_bin));
EXPECT_TRUE(response.SerializeToString(&expected_response_bin));
diff --git a/test/cpp/util/echo.proto b/test/cpp/util/echo.proto
deleted file mode 100644
index 8ea2f59897..0000000000
--- a/test/cpp/util/echo.proto
+++ /dev/null
@@ -1,47 +0,0 @@
-
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-import "test/cpp/util/messages.proto";
-
-package grpc.cpp.test.util;
-
-service TestService {
- rpc Echo(EchoRequest) returns (EchoResponse);
- rpc RequestStream(stream EchoRequest) returns (EchoResponse);
- rpc ResponseStream(EchoRequest) returns (stream EchoResponse);
- rpc BidiStream(stream EchoRequest) returns (stream EchoResponse);
- rpc Unimplemented(EchoRequest) returns (EchoResponse);
-}
-
-service UnimplementedService {
- rpc Unimplemented(EchoRequest) returns (EchoResponse);
-}
diff --git a/test/cpp/util/echo_duplicate.proto b/test/cpp/util/echo_duplicate.proto
deleted file mode 100644
index 9c1d67825a..0000000000
--- a/test/cpp/util/echo_duplicate.proto
+++ /dev/null
@@ -1,42 +0,0 @@
-
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// This is a partial copy of echo.proto with a different package name.
-
-syntax = "proto3";
-
-import "test/cpp/util/messages.proto";
-
-package grpc.cpp.test.util.duplicate;
-
-service TestService {
- rpc Echo(grpc.cpp.test.util.EchoRequest)
- returns (grpc.cpp.test.util.EchoResponse);
-}
diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc
index 3f40b242fc..f9b9f0c40a 100644
--- a/test/cpp/util/grpc_cli.cc
+++ b/test/cpp/util/grpc_cli.cc
@@ -41,8 +41,9 @@
body: "hello world"
}
b. under grpc/ run
- protoc --proto_path=test/proto/ \
- --encode=grpc.testing.SimpleRequest test/proto/messages.proto \
+ protoc --proto_path=src/proto/grpc/testing/ \
+ --encode=grpc.testing.SimpleRequest
+ src/proto/grpc/testing/messages.proto \
< input.txt > input.bin
2. Start a server
make interop_server && bins/opt/interop_server --port=50051
@@ -51,8 +52,8 @@
/grpc.testing.TestService/UnaryCall --enable_ssl=false \
--input_binary_file=input.bin --output_binary_file=output.bin
4. Decode response
- protoc --proto_path=test/proto/ \
- --decode=grpc.testing.SimpleResponse test/proto/messages.proto \
+ protoc --proto_path=src/proto/grpc/testing/ \
+ --decode=grpc.testing.SimpleResponse src/proto/grpc/testing/messages.proto \
< output.bin > output.txt
5. Now the text form of response should be in output.txt
Optionally, metadata can be passed to server via flag --metadata, e.g.
diff --git a/test/cpp/util/messages.proto b/test/cpp/util/messages.proto
deleted file mode 100644
index a022707be9..0000000000
--- a/test/cpp/util/messages.proto
+++ /dev/null
@@ -1,60 +0,0 @@
-
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package grpc.cpp.test.util;
-
-message RequestParams {
- bool echo_deadline = 1;
- int32 client_cancel_after_us = 2;
- int32 server_cancel_after_us = 3;
- bool echo_metadata = 4;
- bool check_auth_context = 5;
- int32 response_message_length = 6;
- bool echo_peer = 7;
- string expected_client_identity = 8; // will force check_auth_context.
-}
-
-message EchoRequest {
- string message = 1;
- RequestParams param = 2;
-}
-
-message ResponseParams {
- int64 request_deadline = 1;
- string host = 2;
- string peer = 3;
-}
-
-message EchoResponse {
- string message = 1;
- ResponseParams param = 2;
-}
diff --git a/test/cpp/util/metrics_server.cc b/test/cpp/util/metrics_server.cc
index 426295f9b4..40028d3957 100644
--- a/test/cpp/util/metrics_server.cc
+++ b/test/cpp/util/metrics_server.cc
@@ -35,8 +35,8 @@
#include <grpc++/server_builder.h>
-#include "test/proto/metrics.grpc.pb.h"
-#include "test/proto/metrics.pb.h"
+#include "src/proto/grpc/testing/metrics.grpc.pb.h"
+#include "src/proto/grpc/testing/metrics.pb.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/util/metrics_server.h b/test/cpp/util/metrics_server.h
index edde37dc4c..ce05e0be64 100644
--- a/test/cpp/util/metrics_server.h
+++ b/test/cpp/util/metrics_server.h
@@ -36,11 +36,12 @@
#include <map>
#include <mutex>
-#include "test/proto/metrics.grpc.pb.h"
-#include "test/proto/metrics.pb.h"
+#include "src/proto/grpc/testing/metrics.grpc.pb.h"
+#include "src/proto/grpc/testing/metrics.pb.h"
/*
- * This implements a Metrics server defined in test/proto/metrics.proto. Any
+ * This implements a Metrics server defined in
+ * src/proto/grpc/testing/metrics.proto. Any
* test service can use this to export Metrics (TODO (sreek): Only Gauges for
* now).
*
diff --git a/test/cpp/util/subprocess.cc b/test/cpp/util/subprocess.cc
index d758f629ac..33f3820a2b 100644
--- a/test/cpp/util/subprocess.cc
+++ b/test/cpp/util/subprocess.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,4 +56,4 @@ int SubProcess::Join() { return gpr_subprocess_join(subprocess_); }
void SubProcess::Interrupt() { gpr_subprocess_interrupt(subprocess_); }
-} // namespace grpc \ No newline at end of file
+} // namespace grpc
diff --git a/test/proto/benchmarks/control.proto b/test/proto/benchmarks/control.proto
deleted file mode 100644
index 42a5dd0a85..0000000000
--- a/test/proto/benchmarks/control.proto
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-import "test/proto/benchmarks/payloads.proto";
-import "test/proto/benchmarks/stats.proto";
-
-package grpc.testing;
-
-enum ClientType {
- SYNC_CLIENT = 0;
- ASYNC_CLIENT = 1;
-}
-
-enum ServerType {
- SYNC_SERVER = 0;
- ASYNC_SERVER = 1;
-}
-
-enum RpcType {
- UNARY = 0;
- STREAMING = 1;
-}
-
-// Parameters of poisson process distribution, which is a good representation
-// of activity coming in from independent identical stationary sources.
-message PoissonParams {
- // The rate of arrivals (a.k.a. lambda parameter of the exp distribution).
- double offered_load = 1;
-}
-
-message UniformParams {
- double interarrival_lo = 1;
- double interarrival_hi = 2;
-}
-
-message DeterministicParams {
- double offered_load = 1;
-}
-
-message ParetoParams {
- double interarrival_base = 1;
- double alpha = 2;
-}
-
-// Once an RPC finishes, immediately start a new one.
-// No configuration parameters needed.
-message ClosedLoopParams {
-}
-
-message LoadParams {
- oneof load {
- ClosedLoopParams closed_loop = 1;
- PoissonParams poisson = 2;
- UniformParams uniform = 3;
- DeterministicParams determ = 4;
- ParetoParams pareto = 5;
- };
-}
-
-// presence of SecurityParams implies use of TLS
-message SecurityParams {
- bool use_test_ca = 1;
- string server_host_override = 2;
-}
-
-message ClientConfig {
- // List of targets to connect to. At least one target needs to be specified.
- repeated string server_targets = 1;
- ClientType client_type = 2;
- SecurityParams security_params = 3;
- // How many concurrent RPCs to start for each channel.
- // For synchronous client, use a separate thread for each outstanding RPC.
- int32 outstanding_rpcs_per_channel = 4;
- // Number of independent client channels to create.
- // i-th channel will connect to server_target[i % server_targets.size()]
- int32 client_channels = 5;
- // Only for async client. Number of threads to use to start/manage RPCs.
- int32 async_client_threads = 7;
- RpcType rpc_type = 8;
- // The requested load for the entire client (aggregated over all the threads).
- LoadParams load_params = 10;
- PayloadConfig payload_config = 11;
- HistogramParams histogram_params = 12;
-}
-
-message ClientStatus {
- ClientStats stats = 1;
-}
-
-// Request current stats
-message Mark {
- // if true, the stats will be reset after taking their snapshot.
- bool reset = 1;
-}
-
-message ClientArgs {
- oneof argtype {
- ClientConfig setup = 1;
- Mark mark = 2;
- }
-}
-
-message ServerConfig {
- ServerType server_type = 1;
- SecurityParams security_params = 2;
- // Host on which to listen.
- string host = 3;
- // Port on which to listen. Zero means pick unused port.
- int32 port = 4;
- // Only for async server. Number of threads used to serve the requests.
- int32 async_server_threads = 7;
- // restrict core usage, currently unused
- int32 core_limit = 8;
- PayloadConfig payload_config = 9;
-}
-
-message ServerArgs {
- oneof argtype {
- ServerConfig setup = 1;
- Mark mark = 2;
- }
-}
-
-message ServerStatus {
- ServerStats stats = 1;
- // the port bound by the server
- int32 port = 2;
- // Number of cores on the server. See gpr_cpu_num_cores.
- int32 cores = 3;
-}
diff --git a/test/proto/benchmarks/payloads.proto b/test/proto/benchmarks/payloads.proto
deleted file mode 100644
index 7e5b2c61ff..0000000000
--- a/test/proto/benchmarks/payloads.proto
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package grpc.testing;
-
-message ByteBufferParams {
- int32 req_size = 1;
- int32 resp_size = 2;
-}
-
-message SimpleProtoParams {
- int32 req_size = 1;
- int32 resp_size = 2;
-}
-
-message ComplexProtoParams {
- // TODO (vpai): Fill this in once the details of complex, representative
- // protos are decided
-}
-
-message PayloadConfig {
- oneof payload {
- ByteBufferParams bytebuf_params = 1;
- SimpleProtoParams simple_params = 2;
- ComplexProtoParams complex_params = 3;
- }
-}
diff --git a/test/proto/benchmarks/services.proto b/test/proto/benchmarks/services.proto
deleted file mode 100644
index ff295ed970..0000000000
--- a/test/proto/benchmarks/services.proto
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// An integration test service that covers all the method signature permutations
-// of unary/streaming requests/responses.
-syntax = "proto3";
-
-import "test/proto/messages.proto";
-import "test/proto/benchmarks/control.proto";
-
-package grpc.testing;
-
-service BenchmarkService {
- // One request followed by one response.
- // The server returns the client payload as-is.
- rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
-
- // One request followed by one response.
- // The server returns the client payload as-is.
- rpc StreamingCall(stream SimpleRequest) returns (stream SimpleResponse);
-}
-
-service WorkerService {
- // Start server with specified workload.
- // First request sent specifies the ServerConfig followed by ServerStatus
- // response. After that, a "Mark" can be sent anytime to request the latest
- // stats. Closing the stream will initiate shutdown of the test server
- // and once the shutdown has finished, the OK status is sent to terminate
- // this RPC.
- rpc RunServer(stream ServerArgs) returns (stream ServerStatus);
-
- // Start client with specified workload.
- // First request sent specifies the ClientConfig followed by ClientStatus
- // response. After that, a "Mark" can be sent anytime to request the latest
- // stats. Closing the stream will initiate shutdown of the test client
- // and once the shutdown has finished, the OK status is sent to terminate
- // this RPC.
- rpc RunClient(stream ClientArgs) returns (stream ClientStatus);
-}
diff --git a/test/proto/benchmarks/stats.proto b/test/proto/benchmarks/stats.proto
deleted file mode 100644
index 7e02707dbb..0000000000
--- a/test/proto/benchmarks/stats.proto
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package grpc.testing;
-
-message ServerStats {
- // wall clock time change in seconds since last reset
- double time_elapsed = 1;
-
- // change in user time (in seconds) used by the server since last reset
- double time_user = 2;
-
- // change in server time (in seconds) used by the server process and all
- // threads since last reset
- double time_system = 3;
-}
-
-// Histogram params based on grpc/support/histogram.c
-message HistogramParams {
- double resolution = 1; // first bucket is [0, 1 + resolution)
- double max_possible = 2; // use enough buckets to allow this value
-}
-
-// Histogram data based on grpc/support/histogram.c
-message HistogramData {
- repeated uint32 bucket = 1;
- double min_seen = 2;
- double max_seen = 3;
- double sum = 4;
- double sum_of_squares = 5;
- double count = 6;
-}
-
-message ClientStats {
- // Latency histogram. Data points are in nanoseconds.
- HistogramData latencies = 1;
-
- // See ServerStats for details.
- double time_elapsed = 2;
- double time_user = 3;
- double time_system = 4;
-}
diff --git a/test/proto/empty.proto b/test/proto/empty.proto
deleted file mode 100644
index 6d0eb937d6..0000000000
--- a/test/proto/empty.proto
+++ /dev/null
@@ -1,43 +0,0 @@
-
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package grpc.testing;
-
-// An empty message that you can re-use to avoid defining duplicated empty
-// messages in your project. A typical example is to use it as argument or the
-// return value of a service API. For instance:
-//
-// service Foo {
-// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
-// };
-//
-message Empty {}
diff --git a/test/proto/messages.proto b/test/proto/messages.proto
deleted file mode 100644
index 193b6c4171..0000000000
--- a/test/proto/messages.proto
+++ /dev/null
@@ -1,167 +0,0 @@
-
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Message definitions to be used by integration test service definitions.
-
-syntax = "proto3";
-
-package grpc.testing;
-
-// The type of payload that should be returned.
-enum PayloadType {
- // Compressable text format.
- COMPRESSABLE = 0;
-
- // Uncompressable binary format.
- UNCOMPRESSABLE = 1;
-
- // Randomly chosen from all other formats defined in this enum.
- RANDOM = 2;
-}
-
-// Compression algorithms
-enum CompressionType {
- // No compression
- NONE = 0;
- GZIP = 1;
- DEFLATE = 2;
-}
-
-// A block of data, to simply increase gRPC message size.
-message Payload {
- // The type of data in body.
- PayloadType type = 1;
- // Primary contents of payload.
- bytes body = 2;
-}
-
-// A protobuf representation for grpc status. This is used by test
-// clients to specify a status that the server should attempt to return.
-message EchoStatus {
- int32 code = 1;
- string message = 2;
-}
-
-// Unary request.
-message SimpleRequest {
- // Desired payload type in the response from the server.
- // If response_type is RANDOM, server randomly chooses one from other formats.
- PayloadType response_type = 1;
-
- // Desired payload size in the response from the server.
- // If response_type is COMPRESSABLE, this denotes the size before compression.
- int32 response_size = 2;
-
- // Optional input payload sent along with the request.
- Payload payload = 3;
-
- // Whether SimpleResponse should include username.
- bool fill_username = 4;
-
- // Whether SimpleResponse should include OAuth scope.
- bool fill_oauth_scope = 5;
-
- // Compression algorithm to be used by the server for the response (stream)
- CompressionType response_compression = 6;
-
- // Whether server should return a given status
- EchoStatus response_status = 7;
-}
-
-// Unary response, as configured by the request.
-message SimpleResponse {
- // Payload to increase message size.
- Payload payload = 1;
- // The user the request came from, for verifying authentication was
- // successful when the client expected it.
- string username = 2;
- // OAuth scope.
- string oauth_scope = 3;
-}
-
-// Client-streaming request.
-message StreamingInputCallRequest {
- // Optional input payload sent along with the request.
- Payload payload = 1;
-
- // Not expecting any payload from the response.
-}
-
-// Client-streaming response.
-message StreamingInputCallResponse {
- // Aggregated size of payloads received from the client.
- int32 aggregated_payload_size = 1;
-}
-
-// Configuration for a particular response.
-message ResponseParameters {
- // Desired payload sizes in responses from the server.
- // If response_type is COMPRESSABLE, this denotes the size before compression.
- int32 size = 1;
-
- // Desired interval between consecutive responses in the response stream in
- // microseconds.
- int32 interval_us = 2;
-}
-
-// Server-streaming request.
-message StreamingOutputCallRequest {
- // Desired payload type in the response from the server.
- // If response_type is RANDOM, the payload from each response in the stream
- // might be of different types. This is to simulate a mixed type of payload
- // stream.
- PayloadType response_type = 1;
-
- // Configuration for each expected response message.
- repeated ResponseParameters response_parameters = 2;
-
- // Optional input payload sent along with the request.
- Payload payload = 3;
-
- // Compression algorithm to be used by the server for the response (stream)
- CompressionType response_compression = 6;
-
- // Whether server should return a given status
- EchoStatus response_status = 7;
-}
-
-// Server-streaming response, as configured by the request and parameters.
-message StreamingOutputCallResponse {
- // Payload to increase response size.
- Payload payload = 1;
-}
-
-// For reconnect interop test only.
-// Server tells client whether its reconnects are following the spec and the
-// reconnect backoffs it saw.
-message ReconnectInfo {
- bool passed = 1;
- repeated int32 backoff_ms = 2;
-}
diff --git a/test/proto/metrics.proto b/test/proto/metrics.proto
deleted file mode 100644
index f5a08e056a..0000000000
--- a/test/proto/metrics.proto
+++ /dev/null
@@ -1,56 +0,0 @@
-
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// An integration test service that covers all the method signature permutations
-// of unary/streaming requests/responses.
-syntax = "proto3";
-
-package grpc.testing;
-
-message GaugeResponse {
- string name = 1;
- oneof value {
- int64 long_value = 2;
- double double_vale = 3;
- string string_value = 4;
- }
-}
-
-message GaugeRequest {
- string name = 1;
-}
-
-message EmptyMessage {
-}
-
-service MetricsService {
- rpc GetAllGauges(EmptyMessage) returns (stream GaugeResponse);
- rpc GetGauge(GaugeRequest) returns (GaugeResponse);
-}
diff --git a/test/proto/test.proto b/test/proto/test.proto
deleted file mode 100644
index d3166a6540..0000000000
--- a/test/proto/test.proto
+++ /dev/null
@@ -1,86 +0,0 @@
-
-// Copyright 2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// An integration test service that covers all the method signature permutations
-// of unary/streaming requests/responses.
-
-syntax = "proto3";
-
-import "test/proto/empty.proto";
-import "test/proto/messages.proto";
-
-package grpc.testing;
-
-// A simple service to test the various types of RPCs and experiment with
-// performance with various types of payload.
-service TestService {
- // One empty request followed by one empty response.
- rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty);
-
- // One request followed by one response.
- rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
-
- // One request followed by a sequence of responses (streamed download).
- // The server returns the payload with client desired type and sizes.
- rpc StreamingOutputCall(StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-
- // A sequence of requests followed by one response (streamed upload).
- // The server returns the aggregated size of client payload as the result.
- rpc StreamingInputCall(stream StreamingInputCallRequest)
- returns (StreamingInputCallResponse);
-
- // A sequence of requests with each request served by the server immediately.
- // As one request could lead to multiple responses, this interface
- // demonstrates the idea of full duplexing.
- rpc FullDuplexCall(stream StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-
- // A sequence of requests followed by a sequence of responses.
- // The server buffers all the client requests and then serves them in order. A
- // stream of responses are returned to the client when the server starts with
- // first request.
- rpc HalfDuplexCall(stream StreamingOutputCallRequest)
- returns (stream StreamingOutputCallResponse);
-}
-
-
-// A simple service NOT implemented at servers so clients can test for
-// that case.
-service UnimplementedService {
- // A call that no server should implement
- rpc UnimplementedCall(grpc.testing.Empty) returns(grpc.testing.Empty);
-}
-
-// A service used to control reconnect server.
-service ReconnectService {
- rpc Start(grpc.testing.Empty) returns (grpc.testing.Empty);
- rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo);
-}