aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-01-14 14:02:32 -0800
committerGravatar David Garcia Quintas <dgq@google.com>2016-01-14 14:02:32 -0800
commit48794a4e831d2b1572d8048229e36b7e42b24a3b (patch)
tree8c8b46ef71fc005fcc9009b5b8ed31d41c6365f1
parent9b454a3428897e9af8319e6824d43ddbdb6bea83 (diff)
parent88447cbbad44aaf009c27480581672b3047e43a1 (diff)
Merge branch 'grpclb_api' of github.com:dgquintas/grpc into grpclb_api
-rw-r--r--Makefile47
-rw-r--r--build.yaml17
-rw-r--r--include/grpc++/generic/async_generic_service.h5
-rw-r--r--include/grpc++/support/byte_buffer.h13
-rw-r--r--include/grpc++/support/slice.h6
-rw-r--r--setup.py16
-rw-r--r--src/cpp/util/byte_buffer.cc12
-rw-r--r--src/proto/grpc/testing/duplicate/echo_duplicate.proto6
-rw-r--r--src/proto/grpc/testing/echo.proto6
-rw-r--r--src/python/grpcio/commands.py50
-rw-r--r--test/cpp/end2end/async_end2end_test.cc18
-rw-r--r--test/cpp/end2end/client_crash_test.cc18
-rw-r--r--test/cpp/end2end/client_crash_test_server.cc9
-rw-r--r--test/cpp/end2end/end2end_test.cc34
-rw-r--r--test/cpp/end2end/generic_end2end_test.cc17
-rw-r--r--test/cpp/end2end/mock_test.cc30
-rw-r--r--test/cpp/end2end/server_crash_test.cc17
-rw-r--r--test/cpp/end2end/server_crash_test_client.cc8
-rw-r--r--test/cpp/end2end/shutdown_test.cc18
-rw-r--r--test/cpp/end2end/streaming_throughput_test.cc16
-rw-r--r--test/cpp/end2end/thread_stress_test.cc24
-rw-r--r--test/cpp/end2end/zookeeper_test.cc19
-rw-r--r--test/cpp/qps/client.h166
-rw-r--r--test/cpp/qps/client_async.cc156
-rw-r--r--test/cpp/qps/client_sync.cc30
-rw-r--r--test/cpp/qps/generic_async_streaming_ping_pong_test.cc82
-rw-r--r--test/cpp/qps/qps_driver.cc13
-rw-r--r--test/cpp/qps/qps_worker.cc20
-rw-r--r--test/cpp/qps/server.h7
-rw-r--r--test/cpp/qps/server_async.cc151
-rw-r--r--test/cpp/util/cli_call.cc12
-rw-r--r--test/cpp/util/cli_call_test.cc12
-rwxr-xr-xtools/distrib/python/submit.py17
-rw-r--r--tools/run_tests/sources_and_headers.json17
-rw-r--r--tools/run_tests/tests.json17
35 files changed, 801 insertions, 305 deletions
diff --git a/Makefile b/Makefile
index 9cf2edcbe3..cb7f02d000 100644
--- a/Makefile
+++ b/Makefile
@@ -903,6 +903,7 @@ cxx_slice_test: $(BINDIR)/$(CONFIG)/cxx_slice_test
cxx_string_ref_test: $(BINDIR)/$(CONFIG)/cxx_string_ref_test
cxx_time_test: $(BINDIR)/$(CONFIG)/cxx_time_test
end2end_test: $(BINDIR)/$(CONFIG)/end2end_test
+generic_async_streaming_ping_pong_test: $(BINDIR)/$(CONFIG)/generic_async_streaming_ping_pong_test
generic_end2end_test: $(BINDIR)/$(CONFIG)/generic_end2end_test
grpc_cli: $(BINDIR)/$(CONFIG)/grpc_cli
grpc_cpp_plugin: $(BINDIR)/$(CONFIG)/grpc_cpp_plugin
@@ -1257,6 +1258,7 @@ buildtests_cxx: buildtests_zookeeper privatelibs_cxx \
$(BINDIR)/$(CONFIG)/cxx_string_ref_test \
$(BINDIR)/$(CONFIG)/cxx_time_test \
$(BINDIR)/$(CONFIG)/end2end_test \
+ $(BINDIR)/$(CONFIG)/generic_async_streaming_ping_pong_test \
$(BINDIR)/$(CONFIG)/generic_end2end_test \
$(BINDIR)/$(CONFIG)/grpc_cli \
$(BINDIR)/$(CONFIG)/grpclb_api_test \
@@ -1557,6 +1559,8 @@ test_cxx: test_zookeeper buildtests_cxx
$(Q) $(BINDIR)/$(CONFIG)/cxx_time_test || ( echo test cxx_time_test failed ; exit 1 )
$(E) "[RUN] Testing end2end_test"
$(Q) $(BINDIR)/$(CONFIG)/end2end_test || ( echo test end2end_test failed ; exit 1 )
+ $(E) "[RUN] Testing generic_async_streaming_ping_pong_test"
+ $(Q) $(BINDIR)/$(CONFIG)/generic_async_streaming_ping_pong_test || ( echo test generic_async_streaming_ping_pong_test failed ; exit 1 )
$(E) "[RUN] Testing generic_end2end_test"
$(Q) $(BINDIR)/$(CONFIG)/generic_end2end_test || ( echo test generic_end2end_test failed ; exit 1 )
$(E) "[RUN] Testing grpclb_api_test"
@@ -9354,6 +9358,49 @@ endif
endif
+GENERIC_ASYNC_STREAMING_PING_PONG_TEST_SRC = \
+ test/cpp/qps/generic_async_streaming_ping_pong_test.cc \
+
+GENERIC_ASYNC_STREAMING_PING_PONG_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GENERIC_ASYNC_STREAMING_PING_PONG_TEST_SRC))))
+ifeq ($(NO_SECURE),true)
+
+# You can't build secure targets if you don't have OpenSSL.
+
+$(BINDIR)/$(CONFIG)/generic_async_streaming_ping_pong_test: openssl_dep_error
+
+else
+
+
+
+
+ifeq ($(NO_PROTOBUF),true)
+
+# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
+
+$(BINDIR)/$(CONFIG)/generic_async_streaming_ping_pong_test: protobuf_dep_error
+
+else
+
+$(BINDIR)/$(CONFIG)/generic_async_streaming_ping_pong_test: $(PROTOBUF_DEP) $(GENERIC_ASYNC_STREAMING_PING_PONG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+ $(E) "[LD] Linking $@"
+ $(Q) mkdir -p `dirname $@`
+ $(Q) $(LDXX) $(LDFLAGS) $(GENERIC_ASYNC_STREAMING_PING_PONG_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/generic_async_streaming_ping_pong_test
+
+endif
+
+endif
+
+$(OBJDIR)/$(CONFIG)/test/cpp/qps/generic_async_streaming_ping_pong_test.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
+deps_generic_async_streaming_ping_pong_test: $(GENERIC_ASYNC_STREAMING_PING_PONG_TEST_OBJS:.o=.dep)
+
+ifneq ($(NO_SECURE),true)
+ifneq ($(NO_DEPS),true)
+-include $(GENERIC_ASYNC_STREAMING_PING_PONG_TEST_OBJS:.o=.dep)
+endif
+endif
+
+
GENERIC_END2END_TEST_SRC = \
test/cpp/end2end/generic_end2end_test.cc \
diff --git a/build.yaml b/build.yaml
index 449c2885b2..8710003c05 100644
--- a/build.yaml
+++ b/build.yaml
@@ -1966,6 +1966,23 @@ targets:
- grpc
- gpr_test_util
- gpr
+- name: generic_async_streaming_ping_pong_test
+ build: test
+ language: c++
+ src:
+ - test/cpp/qps/generic_async_streaming_ping_pong_test.cc
+ deps:
+ - qps
+ - grpc++_test_util
+ - grpc_test_util
+ - grpc++
+ - grpc
+ - gpr_test_util
+ - gpr
+ platforms:
+ - mac
+ - linux
+ - posix
- name: generic_end2end_test
build: test
language: c++
diff --git a/include/grpc++/generic/async_generic_service.h b/include/grpc++/generic/async_generic_service.h
index 8578d850ff..33045b8d85 100644
--- a/include/grpc++/generic/async_generic_service.h
+++ b/include/grpc++/generic/async_generic_service.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
@@ -61,6 +61,7 @@ class AsyncGenericService GRPC_FINAL {
// TODO(yangg) Once we can add multiple completion queues to the server
// in c core, add a CompletionQueue* argument to the ctor here.
// TODO(yangg) support methods list.
+ AsyncGenericService() : server_(nullptr) {}
AsyncGenericService(const grpc::string& methods) : server_(nullptr) {}
void RequestCall(GenericServerContext* ctx,
@@ -75,4 +76,4 @@ class AsyncGenericService GRPC_FINAL {
} // namespace grpc
-#endif // GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H
+#endif // GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H \ No newline at end of file
diff --git a/include/grpc++/support/byte_buffer.h b/include/grpc++/support/byte_buffer.h
index 9d19b07708..84042cbef8 100644
--- a/include/grpc++/support/byte_buffer.h
+++ b/include/grpc++/support/byte_buffer.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
@@ -55,8 +55,14 @@ class ByteBuffer GRPC_FINAL {
/// Construct buffer from \a slices, of which there are \a nslices.
ByteBuffer(const Slice* slices, size_t nslices);
+ /// Constuct a byte buffer by referencing elements of existing buffer
+ /// \a buf. Wrapper of core function grpc_byte_buffer_copy
+ ByteBuffer(const ByteBuffer& buf);
+
~ByteBuffer();
+ ByteBuffer& operator=(const ByteBuffer&);
+
/// Dump (read) the buffer contents into \a slices.
void Dump(std::vector<Slice>* slices) const;
@@ -69,9 +75,6 @@ class ByteBuffer GRPC_FINAL {
private:
friend class SerializationTraits<ByteBuffer, void>;
- ByteBuffer(const ByteBuffer&);
- ByteBuffer& operator=(const ByteBuffer&);
-
// takes ownership
void set_buffer(grpc_byte_buffer* buf) {
if (buffer_) {
@@ -104,4 +107,4 @@ class SerializationTraits<ByteBuffer, void> {
} // namespace grpc
-#endif // GRPCXX_SUPPORT_BYTE_BUFFER_H
+#endif // GRPCXX_SUPPORT_BYTE_BUFFER_H \ No newline at end of file
diff --git a/include/grpc++/support/slice.h b/include/grpc++/support/slice.h
index be316e7c94..30325ef90b 100644
--- a/include/grpc++/support/slice.h
+++ b/include/grpc++/support/slice.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
@@ -39,7 +39,7 @@
namespace grpc {
-/// A wrapper around \a grpc_slice.
+/// A wrapper around \a gpr_slice.
///
/// A slice represents a contiguous reference counted array of bytes.
/// It is cheap to take references to a slice, and it is cheap to create a
@@ -85,4 +85,4 @@ class Slice GRPC_FINAL {
} // namespace grpc
-#endif // GRPCXX_SUPPORT_SLICE_H
+#endif // GRPCXX_SUPPORT_SLICE_H \ No newline at end of file
diff --git a/setup.py b/setup.py
index 93b1a3ae47..b70fab3398 100644
--- a/setup.py
+++ b/setup.py
@@ -54,6 +54,8 @@ sys.path.insert(0, PYTHON_STEM)
import commands
import grpc_core_dependencies
+LICENSE = '3-clause BSD'
+
# Environment variable to determine whether or not the Cython extension should
# *use* Cython or use the generated C files. Note that this requires the C files
# to have been generated by building first *with* Cython support.
@@ -79,15 +81,10 @@ EXTENSION_LIBRARIES = ()
if not "darwin" in sys.platform:
EXTENSION_LIBRARIES += ('rt',)
-EXTRA_COMPILE_ARGS = ()
-if not "win" in sys.platform:
- EXTRA_COMPILE_ARGS = ('-pthread',)
-
DEFINE_MACROS = (('OPENSSL_NO_ASM', 1),)
def cython_extensions(package_names, module_names, include_dirs, libraries,
- define_macros, extra_compile_args,
- build_with_cython=False):
+ define_macros, build_with_cython=False):
if ENABLE_CYTHON_TRACING:
define_macros = define_macros + [('CYTHON_TRACE_NOGIL', 1)]
file_extension = 'pyx' if build_with_cython else 'c'
@@ -99,7 +96,6 @@ def cython_extensions(package_names, module_names, include_dirs, libraries,
name=module_name,
sources=[module_file] + grpc_core_dependencies.CORE_SOURCE_FILES,
include_dirs=include_dirs, libraries=libraries,
- extra_compile_args=extra_compile_args,
define_macros=define_macros,
) for (module_name, module_file) in zip(module_names, module_files)
]
@@ -115,7 +111,7 @@ def cython_extensions(package_names, module_names, include_dirs, libraries,
CYTHON_EXTENSION_MODULES = cython_extensions(
list(CYTHON_EXTENSION_PACKAGE_NAMES), list(CYTHON_EXTENSION_MODULE_NAMES),
list(EXTENSION_INCLUDE_DIRECTORIES), list(EXTENSION_LIBRARIES),
- list(DEFINE_MACROS), list(EXTRA_COMPILE_ARGS), bool(BUILD_WITH_CYTHON))
+ list(DEFINE_MACROS), bool(BUILD_WITH_CYTHON))
PACKAGE_DIRECTORIES = {
'': PYTHON_STEM,
@@ -135,6 +131,7 @@ COMMAND_CLASS = {
'build_proto_modules': commands.BuildProtoModules,
'build_project_metadata': commands.BuildProjectMetadata,
'build_py': commands.BuildPy,
+ 'build_ext': commands.BuildExt,
'gather': commands.Gather,
'run_interop': commands.RunInterop,
}
@@ -186,7 +183,8 @@ else:
setuptools.setup(
name='grpcio',
- version='0.12.0b1',
+ version='0.12.0b5',
+ license=LICENSE,
ext_modules=CYTHON_EXTENSION_MODULES,
packages=list(PACKAGES),
package_dir=PACKAGE_DIRECTORIES,
diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc
index 755234d7e8..2952f94b24 100644
--- a/src/cpp/util/byte_buffer.cc
+++ b/src/cpp/util/byte_buffer.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
@@ -69,6 +69,7 @@ void ByteBuffer::Dump(std::vector<Slice>* slices) const {
while (grpc_byte_buffer_reader_next(&reader, &s)) {
slices->push_back(Slice(s, Slice::STEAL_REF));
}
+ grpc_byte_buffer_reader_destroy(&reader);
}
size_t ByteBuffer::Length() const {
@@ -79,4 +80,13 @@ size_t ByteBuffer::Length() const {
}
}
+ByteBuffer::ByteBuffer(const ByteBuffer& buf)
+ : buffer_(grpc_byte_buffer_copy(buf.buffer_)) {}
+
+ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) {
+ Clear(); // first remove existing data
+ buffer_ = grpc_byte_buffer_copy(buf.buffer_); // then copy
+ return *this;
+}
+
} // namespace grpc
diff --git a/src/proto/grpc/testing/duplicate/echo_duplicate.proto b/src/proto/grpc/testing/duplicate/echo_duplicate.proto
index d5891db4ce..9978ca4ac0 100644
--- a/src/proto/grpc/testing/duplicate/echo_duplicate.proto
+++ b/src/proto/grpc/testing/duplicate/echo_duplicate.proto
@@ -1,5 +1,5 @@
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,6 @@ import "src/proto/grpc/testing/echo_messages.proto";
package grpc.testing.duplicate;
-service TestService {
+service EchoTestService {
rpc Echo(grpc.testing.EchoRequest) returns (grpc.testing.EchoResponse);
-}
+} \ No newline at end of file
diff --git a/src/proto/grpc/testing/echo.proto b/src/proto/grpc/testing/echo.proto
index 0896f50a99..47d4c26732 100644
--- a/src/proto/grpc/testing/echo.proto
+++ b/src/proto/grpc/testing/echo.proto
@@ -1,5 +1,5 @@
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,7 @@ import "src/proto/grpc/testing/echo_messages.proto";
package grpc.testing;
-service TestService {
+service EchoTestService {
rpc Echo(EchoRequest) returns (EchoResponse);
rpc RequestStream(stream EchoRequest) returns (EchoResponse);
rpc ResponseStream(EchoRequest) returns (stream EchoResponse);
@@ -44,4 +44,4 @@ service TestService {
service UnimplementedService {
rpc Unimplemented(EchoRequest) returns (EchoResponse);
-}
+} \ No newline at end of file
diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py
index 81dab1b518..e1a3f4bed3 100644
--- a/src/python/grpcio/commands.py
+++ b/src/python/grpcio/commands.py
@@ -40,6 +40,17 @@ import setuptools
from setuptools.command import build_py
from setuptools.command import test
+# Because we need to support building without Cython but simultaneously need to
+# subclass its command class when we need to and because distutils requires a
+# special hook to acquire a command class, we attempt to import Cython's
+# build_ext, and if that fails we import setuptools'.
+try:
+ # Due to the strange way Cython's Distutils module re-imports build_ext, we
+ # import the build_ext class directly.
+ from Cython.Distutils.build_ext import build_ext
+except ImportError:
+ from setuptools.command.build_ext import build_ext
+
PYTHON_STEM = os.path.dirname(os.path.abspath(__file__))
CONF_PY_ADDENDUM = """
@@ -51,6 +62,10 @@ html_theme = 'sphinx_rtd_theme'
"""
+class CommandError(Exception):
+ """Simple exception class for GRPC custom commands."""
+
+
class SphinxDocumentation(setuptools.Command):
"""Command to generate documentation via sphinx."""
@@ -104,10 +119,10 @@ class BuildProtoModules(setuptools.Command):
def run(self):
if not self.protoc_command:
- raise Exception('could not find protoc')
+ raise CommandError('could not find protoc')
if not self.grpc_python_plugin_command:
- raise Exception('could not find grpc_python_plugin '
- '(protoc plugin for GRPC Python)')
+ raise CommandError('could not find grpc_python_plugin '
+ '(protoc plugin for GRPC Python)')
include_regex = re.compile(self.include)
exclude_regex = re.compile(self.exclude) if self.exclude else None
paths = []
@@ -130,7 +145,7 @@ class BuildProtoModules(setuptools.Command):
subprocess.check_output(' '.join(command), cwd=root_directory, shell=True,
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
- raise Exception('Command:\n{}\nMessage:\n{}\nOutput:\n{}'.format(
+ raise CommandError('Command:\n{}\nMessage:\n{}\nOutput:\n{}'.format(
command, e.message, e.output))
@@ -156,13 +171,34 @@ class BuildPy(build_py.build_py):
"""Custom project build command."""
def run(self):
- # TODO(atash): make this warn if the proto modules couldn't be built rather
- # than cause build failure
- self.run_command('build_proto_modules')
+ try:
+ self.run_command('build_proto_modules')
+ except CommandError as error:
+ sys.stderr.write('warning: %s\n' % error.message)
self.run_command('build_project_metadata')
build_py.build_py.run(self)
+class BuildExt(build_ext):
+ """Custom build_ext command to enable compiler-specific flags."""
+
+ C_OPTIONS = {
+ 'unix': ('-pthread', '-std=gnu99'),
+ 'msvc': (),
+ }
+ LINK_OPTIONS = {}
+
+ def build_extensions(self):
+ compiler = self.compiler.compiler_type
+ if compiler in BuildExt.C_OPTIONS:
+ for extension in self.extensions:
+ extension.extra_compile_args += list(BuildExt.C_OPTIONS[compiler])
+ if compiler in BuildExt.LINK_OPTIONS:
+ for extension in self.extensions:
+ extension.extra_link_args += list(BuildExt.LINK_OPTIONS[compiler])
+ build_ext.build_extensions(self)
+
+
class Gather(setuptools.Command):
"""Command to gather project dependencies."""
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index 62023b24fd..cfda571326 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -33,21 +33,21 @@
#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 "test/core/util/port.h"
-#include "test/core/util/test_config.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/string_ref_helper.h"
#ifdef GPR_POSIX_SOCKET
@@ -186,7 +186,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<bool> {
build_bad.AddListeningPort(server_address_.str(),
grpc::InsecureServerCredentials());
build_bad.RegisterAsyncService(&service_);
- grpc::testing::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::testing::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::testing::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
- grpc::testing::TestService::AsyncService service_;
+ grpc::testing::EchoTestService::AsyncService service_;
std::ostringstream server_address_;
};
diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc
index 68c63b2f93..d0efabc5ca 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,21 +31,21 @@
*
*/
-#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 "test/core/util/port.h"
-#include "test/core/util/test_config.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/subprocess.h"
using grpc::testing::EchoRequest;
@@ -63,7 +63,7 @@ class CrashTest : public ::testing::Test {
protected:
CrashTest() {}
- std::unique_ptr<grpc::testing::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;
@@ -72,7 +72,7 @@ class CrashTest : public ::testing::Test {
g_root + "/client_crash_test_server", "--address=" + addr,
}));
GPR_ASSERT(server_);
- return grpc::testing::TestService::NewStub(
+ return grpc::testing::EchoTestService::NewStub(
CreateChannel(addr, InsecureChannelCredentials()));
}
@@ -155,4 +155,4 @@ int main(int argc, char** argv) {
}
}
return 0;
-}
+} \ No newline at end of file
diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc
index f9a9c187a7..8219631c74 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,10 +31,10 @@
*
*/
+#include <gflags/gflags.h>
#include <iostream>
#include <memory>
#include <string>
-#include <gflags/gflags.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
@@ -56,7 +56,8 @@ using namespace gflags;
namespace grpc {
namespace testing {
-class ServiceImpl GRPC_FINAL : public ::grpc::testing::TestService::Service {
+class ServiceImpl GRPC_FINAL
+ : public ::grpc::testing::EchoTestService::Service {
Status BidiStream(ServerContext* context,
ServerReaderWriter<EchoResponse, EchoRequest>* stream)
GRPC_OVERRIDE {
@@ -89,4 +90,4 @@ int main(int argc, char** argv) {
grpc::testing::RunServer();
return 0;
-}
+} \ No newline at end of file
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index 28f8a8ec46..82eb566908 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,14 +43,17 @@
#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 "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
-#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/cpp/util/string_ref_helper.h"
using grpc::testing::EchoRequest;
@@ -196,10 +196,10 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor {
const char TestAuthMetadataProcessor::kGoodGuy[] = "Dr Jekyll";
const char TestAuthMetadataProcessor::kIdentityPropName[] = "novel identity";
-class Proxy : public ::grpc::testing::TestService::Service {
+class Proxy : public ::grpc::testing::EchoTestService::Service {
public:
Proxy(std::shared_ptr<Channel> channel)
- : stub_(grpc::testing::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::testing::TestService::Service {
}
private:
- std::unique_ptr< ::grpc::testing::TestService::Stub> stub_;
+ std::unique_ptr< ::grpc::testing::EchoTestService::Stub> stub_;
};
-class TestServiceImpl : public ::grpc::testing::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::testing::TestService::Service {
};
class TestServiceImplDupPkg
- : public ::grpc::testing::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::testing::TestService::NewStub(channel_);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel_);
}
bool is_server_started_;
std::shared_ptr<Channel> channel_;
- std::unique_ptr<grpc::testing::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,7 +451,7 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> {
TestServiceImplDupPkg dup_pkg_service_;
};
-static void SendRpc(grpc::testing::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");
@@ -561,8 +561,8 @@ TEST_P(End2endTest, DiffPackageServices) {
EXPECT_EQ(response.message(), request.message());
EXPECT_TRUE(s.ok());
- std::unique_ptr<grpc::testing::duplicate::TestService::Stub> dup_pkg_stub(
- grpc::testing::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());
@@ -1210,4 +1210,4 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
-}
+} \ No newline at end of file
diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc
index 14b534fbd2..c5d9de3f29 100644
--- a/test/cpp/end2end/generic_end2end_test.cc
+++ b/test/cpp/end2end/generic_end2end_test.cc
@@ -33,24 +33,24 @@
#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 "src/proto/grpc/testing/echo.grpc.pb.h"
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
@@ -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::testing::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 dddd1d0a2e..d08ed9bcc5 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 "test/core/util/port.h"
-#include "test/core/util/test_config.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"
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
-using grpc::testing::TestService;
+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::testing::TestService::NewStub(channel);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel);
}
- std::unique_ptr<grpc::testing::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::ostringstream server_address_;
TestServiceImpl service_;
@@ -281,4 +281,4 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
-}
+} \ No newline at end of file
diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc
index 87ce6369d2..c29bc7c44f 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,21 +31,21 @@
*
*/
-#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 "src/proto/grpc/testing/echo.grpc.pb.h"
-#include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
#include "test/cpp/util/subprocess.h"
using grpc::testing::EchoRequest;
@@ -59,7 +59,8 @@ namespace testing {
namespace {
-class ServiceImpl GRPC_FINAL : public ::grpc::testing::TestService::Service {
+class ServiceImpl GRPC_FINAL
+ : public ::grpc::testing::EchoTestService::Service {
public:
ServiceImpl() : bidi_stream_count_(0), response_stream_count_(0) {}
@@ -170,4 +171,4 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
-}
+} \ No newline at end of file
diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc
index b349ae7357..3a99ab360e 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,11 +31,11 @@
*
*/
+#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>
@@ -57,7 +57,7 @@ using namespace gflags;
int main(int argc, char** argv) {
ParseCommandLineFlags(&argc, &argv, true);
- auto stub = grpc::testing::TestService::NewStub(
+ auto stub = grpc::testing::EchoTestService::NewStub(
grpc::CreateChannel(FLAGS_address, grpc::InsecureChannelCredentials()));
EchoRequest request;
@@ -87,4 +87,4 @@ int main(int argc, char** argv) {
}
return 0;
-}
+} \ No newline at end of file
diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc
index 50d4f6dca3..c03cf9fef3 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,20 +33,20 @@
#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 "test/core/util/port.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::testing::EchoRequest;
using grpc::testing::EchoResponse;
@@ -54,7 +54,7 @@ using grpc::testing::EchoResponse;
namespace grpc {
namespace testing {
-class TestServiceImpl : public ::grpc::testing::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::testing::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::testing::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
bool shutdown_;
int port_;
@@ -152,4 +152,4 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
-}
+} \ No newline at end of file
diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc
index ca563472a7..ef2b53f36f 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,10 +49,10 @@
#include <grpc/support/time.h>
#include <gtest/gtest.h>
-#include "test/core/util/port.h"
-#include "test/core/util/test_config.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"
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
@@ -99,7 +99,7 @@ const char* kLargeString =
namespace grpc {
namespace testing {
-class TestServiceImpl : public ::grpc::testing::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::testing::TestService::NewStub(channel);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel);
}
- std::unique_ptr<grpc::testing::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::ostringstream server_address_;
TestServiceImpl service_;
@@ -204,4 +204,4 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
-}
+} \ No newline at end of file
diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc
index 8efc645fa3..592c427d5d 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,21 +34,21 @@
#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 "test/core/util/port.h"
-#include "test/core/util/test_config.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"
using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
@@ -74,7 +74,7 @@ void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request,
} // namespace
-class TestServiceImpl : public ::grpc::testing::TestService::Service {
+class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public:
TestServiceImpl() : signal_client_(false) {}
@@ -159,7 +159,7 @@ class TestServiceImpl : public ::grpc::testing::TestService::Service {
};
class TestServiceImplDupPkg
- : public ::grpc::testing::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::testing::TestService::NewStub(channel);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel);
}
- std::unique_ptr<grpc::testing::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::ostringstream server_address_;
const int kMaxMessageSize_;
@@ -202,7 +202,7 @@ class End2endTest : public ::testing::Test {
TestServiceImplDupPkg dup_pkg_service_;
};
-static void SendRpc(grpc::testing::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");
@@ -234,4 +234,4 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
-}
+} \ No newline at end of file
diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc
index 802df6bb94..cec6e891be 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,15 +37,15 @@
#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 "src/proto/grpc/testing/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::testing::EchoRequest;
using grpc::testing::EchoResponse;
@@ -53,7 +53,8 @@ using grpc::testing::EchoResponse;
namespace grpc {
namespace testing {
-class ZookeeperTestServiceImpl : public ::grpc::testing::TestService::Service {
+class ZookeeperTestServiceImpl
+ : public ::grpc::testing::EchoTestService::Service {
public:
Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE {
@@ -157,7 +158,7 @@ class ZookeeperTest : public ::testing::Test {
void ResetStub() {
string target = "zookeeper://" + zookeeper_address_ + "/test";
channel_ = CreateChannel(target, InsecureChannelCredentials());
- stub_ = grpc::testing::TestService::NewStub(channel_);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel_);
}
string to_string(const int number) {
@@ -167,7 +168,7 @@ class ZookeeperTest : public ::testing::Test {
}
std::shared_ptr<Channel> channel_;
- std::unique_ptr<grpc::testing::TestService::Stub> stub_;
+ std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server1_;
std::unique_ptr<Server> server2_;
ZookeeperTestServiceImpl service_;
@@ -215,4 +216,4 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
-}
+} \ No newline at end of file
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index ee0049578d..0159f4f1e6 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,6 +37,9 @@
#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"
@@ -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,13 +313,68 @@ 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
-#endif
+#endif \ No newline at end of file
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index 3aaf06564c..3e2317c6d4 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,19 +37,20 @@
#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 "src/proto/grpc/testing/services.grpc.pb.h"
@@ -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
+} // namespace grpc \ No newline at end of file
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index 9e94f43e35..1045915b83 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 "src/proto/grpc/testing/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_);
@@ -166,4 +172,4 @@ std::unique_ptr<Client> CreateSynchronousStreamingClient(
}
} // namespace testing
-} // namespace grpc
+} // namespace grpc \ No newline at end of file
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..7a1275054a
--- /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;
+} \ No newline at end of file
diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc
index c7096391e6..c70db188d9 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();
@@ -175,4 +184,4 @@ int main(int argc, char** argv) {
grpc::testing::QpsDriver();
return 0;
-}
+} \ No newline at end of file
diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc
index b3f383253f..e7714c0bb3 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,20 +36,20 @@
#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 "test/core/util/grpc_profiler.h"
#include "test/cpp/qps/client.h"
@@ -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();
}
@@ -237,4 +239,4 @@ QpsWorker::QpsWorker(int driver_port) {
QpsWorker::~QpsWorker() {}
} // namespace testing
-} // namespace grpc
+} // namespace grpc \ No newline at end of file
diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h
index 620bc32f4b..daee7c3663 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
@@ -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;
@@ -113,4 +112,4 @@ std::unique_ptr<Server> CreateAsyncServer(const ServerConfig& config);
} // namespace testing
} // namespace grpc
-#endif
+#endif \ No newline at end of file
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index 03fde06e77..1ae88d7323 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,15 +38,16 @@
#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"
@@ -55,9 +56,24 @@
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,9 +348,53 @@ 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
-} // namespace grpc
+} // namespace grpc \ No newline at end of file
diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc
index 0de388d3ca..28f5e47b46 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 {
@@ -108,4 +108,4 @@ Status CliCall::Call(std::shared_ptr<grpc::Channel> channel,
}
} // namespace testing
-} // namespace grpc
+} // namespace grpc \ No newline at end of file
diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc
index 94f54616a9..207371dce5 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
@@ -53,7 +53,7 @@ using grpc::testing::EchoResponse;
namespace grpc {
namespace testing {
-class TestServiceImpl : public ::grpc::testing::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::testing::TestService::NewStub(channel_);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel_);
}
std::shared_ptr<Channel> channel_;
- std::unique_ptr<grpc::testing::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.testing.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));
@@ -140,4 +140,4 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
-}
+} \ No newline at end of file
diff --git a/tools/distrib/python/submit.py b/tools/distrib/python/submit.py
index 08ace7c690..9b012be672 100755
--- a/tools/distrib/python/submit.py
+++ b/tools/distrib/python/submit.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
@@ -55,6 +55,14 @@ parser.add_argument(
help='Password to authenticate with the repository. Not needed if you have '
'configured your .pypirc to include your password.'
)
+parser.add_argument(
+ '--bdist', '-b', action='store_true',
+ help='Generate a binary distribution (wheel) for the current OS.'
+)
+parser.add_argument(
+ '--dist-args', type=str,
+ help='Additional arguments to pass to the *dist setup.py command.'
+)
args = parser.parse_args()
# Move to the root directory of Python GRPC.
@@ -73,7 +81,12 @@ cmd = ['python', 'setup.py', 'build_ext', '--inplace']
subprocess.call(cmd, cwd=pkgdir, env=build_env)
# Make the push.
-cmd = ['python', 'setup.py', 'sdist']
+if args.bdist:
+ cmd = ['python', 'setup.py', 'bdist_wheel']
+else:
+ cmd = ['python', 'setup.py', 'sdist']
+if args.dist_args:
+ cmd += args.dist_args.split()
subprocess.call(cmd, cwd=pkgdir)
cmd = ['twine', 'upload', '-r', args.repository]
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index 925a356c02..aeac3fa0db 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -1504,6 +1504,23 @@
"grpc",
"grpc++",
"grpc++_test_util",
+ "grpc_test_util",
+ "qps"
+ ],
+ "headers": [],
+ "language": "c++",
+ "name": "generic_async_streaming_ping_pong_test",
+ "src": [
+ "test/cpp/qps/generic_async_streaming_ping_pong_test.cc"
+ ]
+ },
+ {
+ "deps": [
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc++",
+ "grpc++_test_util",
"grpc_test_util"
],
"headers": [],
diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json
index f842a5db01..d40c4eda73 100644
--- a/tools/run_tests/tests.json
+++ b/tools/run_tests/tests.json
@@ -1828,6 +1828,23 @@
"ci_platforms": [
"linux",
"mac",
+ "posix"
+ ],
+ "exclude_configs": [],
+ "flaky": false,
+ "language": "c++",
+ "name": "generic_async_streaming_ping_pong_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix"
+ ]
+ },
+ {
+ "args": [],
+ "ci_platforms": [
+ "linux",
+ "mac",
"posix",
"windows"
],