aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile53
-rw-r--r--include/grpc++/impl/codegen/call.h2
-rw-r--r--include/grpc++/impl/codegen/config.h17
-rw-r--r--include/grpc++/impl/codegen/core_codegen.h46
-rw-r--r--include/grpc++/impl/server_builder_option.h3
-rw-r--r--include/grpc++/server_builder.h2
-rw-r--r--src/compiler/cpp_generator.cc7
-rw-r--r--src/compiler/generator_helpers.h3
-rw-r--r--src/core/lib/support/log.c4
-rw-r--r--src/cpp/server/server.cc6
-rw-r--r--src/cpp/server/server_builder.cc17
-rw-r--r--templates/Makefile.template24
-rw-r--r--templates/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile.template4
-rw-r--r--test/core/support/log_test.c2
-rw-r--r--test/cpp/end2end/async_end2end_test.cc20
-rw-r--r--test/cpp/end2end/end2end_test.cc21
-rw-r--r--test/cpp/end2end/hybrid_end2end_test.cc171
-rw-r--r--test/cpp/end2end/server_builder_plugin_test.cc34
-rw-r--r--test/cpp/end2end/test_service_impl.cc3
-rw-r--r--test/cpp/end2end/thread_stress_test.cc4
-rw-r--r--test/cpp/interop/interop_client.h6
-rw-r--r--test/cpp/qps/client_async.cc9
-rw-r--r--test/cpp/util/metrics_server.cc4
-rw-r--r--test/cpp/util/test_credentials_provider.cc59
-rw-r--r--tools/dockerfile/test/cxx_wheezy_x64/Dockerfile4
-rwxr-xr-xtools/run_tests/run_tests.py5
26 files changed, 334 insertions, 196 deletions
diff --git a/Makefile b/Makefile
index 6eccd06952..08d8f2ec7b 100644
--- a/Makefile
+++ b/Makefile
@@ -1211,7 +1211,12 @@ pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc
pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc
+ifeq ($(EMBED_OPENSSL),true)
privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libboringssl_test_util.a $(LIBDIR)/$(CONFIG)/libboringssl_aes_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_asn1_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_base64_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bio_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bn_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_bytestring_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_aead_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cipher_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_cmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ed25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x25519_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_dh_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_digest_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ec_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ecdsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_err_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_extra_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_evp_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pbkdf_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_hmac_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs12_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_pkcs8_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_poly1305_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_rsa_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_x509_test_lib.a $(LIBDIR)/$(CONFIG)/libboringssl_ssl_test_lib.a
+else
+privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_cli_libs.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a
+endif
+
ifeq ($(HAS_ZOOKEEPER),true)
privatelibs_zookeeper:
@@ -1377,6 +1382,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/uri_fuzzer_test_one_entry \
+ifeq ($(EMBED_OPENSSL),true)
buildtests_cxx: buildtests_zookeeper privatelibs_cxx \
$(BINDIR)/$(CONFIG)/alarm_cpp_test \
$(BINDIR)/$(CONFIG)/async_end2end_test \
@@ -1460,6 +1466,53 @@ buildtests_cxx: buildtests_zookeeper privatelibs_cxx \
$(BINDIR)/$(CONFIG)/boringssl_pqueue_test \
$(BINDIR)/$(CONFIG)/boringssl_ssl_test \
+else
+buildtests_cxx: buildtests_zookeeper privatelibs_cxx \
+ $(BINDIR)/$(CONFIG)/alarm_cpp_test \
+ $(BINDIR)/$(CONFIG)/async_end2end_test \
+ $(BINDIR)/$(CONFIG)/auth_property_iterator_test \
+ $(BINDIR)/$(CONFIG)/channel_arguments_test \
+ $(BINDIR)/$(CONFIG)/cli_call_test \
+ $(BINDIR)/$(CONFIG)/client_crash_test \
+ $(BINDIR)/$(CONFIG)/client_crash_test_server \
+ $(BINDIR)/$(CONFIG)/codegen_test_full \
+ $(BINDIR)/$(CONFIG)/codegen_test_minimal \
+ $(BINDIR)/$(CONFIG)/credentials_test \
+ $(BINDIR)/$(CONFIG)/cxx_byte_buffer_test \
+ $(BINDIR)/$(CONFIG)/cxx_slice_test \
+ $(BINDIR)/$(CONFIG)/cxx_string_ref_test \
+ $(BINDIR)/$(CONFIG)/cxx_time_test \
+ $(BINDIR)/$(CONFIG)/end2end_test \
+ $(BINDIR)/$(CONFIG)/generic_end2end_test \
+ $(BINDIR)/$(CONFIG)/golden_file_test \
+ $(BINDIR)/$(CONFIG)/grpc_cli \
+ $(BINDIR)/$(CONFIG)/grpclb_api_test \
+ $(BINDIR)/$(CONFIG)/hybrid_end2end_test \
+ $(BINDIR)/$(CONFIG)/interop_client \
+ $(BINDIR)/$(CONFIG)/interop_server \
+ $(BINDIR)/$(CONFIG)/interop_test \
+ $(BINDIR)/$(CONFIG)/json_run_localhost \
+ $(BINDIR)/$(CONFIG)/metrics_client \
+ $(BINDIR)/$(CONFIG)/mock_test \
+ $(BINDIR)/$(CONFIG)/qps_interarrival_test \
+ $(BINDIR)/$(CONFIG)/qps_json_driver \
+ $(BINDIR)/$(CONFIG)/qps_openloop_test \
+ $(BINDIR)/$(CONFIG)/qps_worker \
+ $(BINDIR)/$(CONFIG)/reconnect_interop_client \
+ $(BINDIR)/$(CONFIG)/reconnect_interop_server \
+ $(BINDIR)/$(CONFIG)/secure_auth_context_test \
+ $(BINDIR)/$(CONFIG)/secure_sync_unary_ping_pong_test \
+ $(BINDIR)/$(CONFIG)/server_builder_plugin_test \
+ $(BINDIR)/$(CONFIG)/server_crash_test \
+ $(BINDIR)/$(CONFIG)/server_crash_test_client \
+ $(BINDIR)/$(CONFIG)/shutdown_test \
+ $(BINDIR)/$(CONFIG)/status_test \
+ $(BINDIR)/$(CONFIG)/streaming_throughput_test \
+ $(BINDIR)/$(CONFIG)/stress_test \
+ $(BINDIR)/$(CONFIG)/thread_stress_test \
+
+endif
+
ifeq ($(HAS_ZOOKEEPER),true)
buildtests_zookeeper: privatelibs_zookeeper \
diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h
index d720f27a8f..fab85d1517 100644
--- a/include/grpc++/impl/codegen/call.h
+++ b/include/grpc++/impl/codegen/call.h
@@ -337,7 +337,7 @@ class DeserializeFuncType GRPC_FINAL : public DeserializeFunc {
return SerializationTraits<R>::Deserialize(buf, message_, max_message_size);
}
- ~DeserializeFuncType() override {}
+ ~DeserializeFuncType() GRPC_OVERRIDE {}
private:
R* message_; // Not a managed pointer because management is external to this
diff --git a/include/grpc++/impl/codegen/config.h b/include/grpc++/impl/codegen/config.h
index d782d5f571..0c75438868 100644
--- a/include/grpc++/impl/codegen/config.h
+++ b/include/grpc++/impl/codegen/config.h
@@ -54,6 +54,7 @@
// nullptr was added in gcc 4.6
#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406)
#define GRPC_CXX0X_NO_NULLPTR 1
+#define GRPC_CXX0X_LIMITED_TOSTRING 1
#endif
// final and override were added in gcc 4.7
#if (__GNUC__ * 100 + __GNUC_MINOR__ < 407)
@@ -78,6 +79,7 @@
#endif
#ifdef GRPC_CXX0X_NO_NULLPTR
+#include <functional>
#include <memory>
namespace grpc {
const class {
@@ -95,6 +97,10 @@ const class {
return std::shared_ptr<T>(static_cast<T *>(0));
}
operator bool() const { return false; }
+ template <class F>
+ operator std::function<F>() const {
+ return std::function<F>();
+ }
private:
void operator&() const = delete;
@@ -111,6 +117,17 @@ namespace grpc {
typedef GRPC_CUSTOM_STRING string;
+#ifdef GRPC_CXX0X_LIMITED_TOSTRING
+inline grpc::string to_string(const int x) {
+ return std::to_string(static_cast<const long long int>(x));
+}
+inline grpc::string to_string(const unsigned int x) {
+ return std::to_string(static_cast<const long long unsigned int>(x));
+}
+#else
+using std::to_string;
+#endif
+
} // namespace grpc
#endif // GRPCXX_IMPL_CODEGEN_CONFIG_H
diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h
index 656b11e7e7..b0c4c57e66 100644
--- a/include/grpc++/impl/codegen/core_codegen.h
+++ b/include/grpc++/impl/codegen/core_codegen.h
@@ -42,42 +42,44 @@ namespace grpc {
/// Implementation of the core codegen interface.
class CoreCodegen : public CoreCodegenInterface {
private:
- grpc_completion_queue* grpc_completion_queue_create(void* reserved) override;
- void grpc_completion_queue_destroy(grpc_completion_queue* cq) override;
+ grpc_completion_queue* grpc_completion_queue_create(void* reserved)
+ GRPC_OVERRIDE;
+ void grpc_completion_queue_destroy(grpc_completion_queue* cq) GRPC_OVERRIDE;
grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag,
gpr_timespec deadline,
- void* reserved) override;
+ void* reserved) GRPC_OVERRIDE;
- void* gpr_malloc(size_t size) override;
- void gpr_free(void* p) override;
+ void* gpr_malloc(size_t size) GRPC_OVERRIDE;
+ void gpr_free(void* p) GRPC_OVERRIDE;
- void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) override;
+ void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) GRPC_OVERRIDE;
void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
- grpc_byte_buffer* buffer) override;
- void grpc_byte_buffer_reader_destroy(
- grpc_byte_buffer_reader* reader) override;
+ grpc_byte_buffer* buffer) GRPC_OVERRIDE;
+ void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader* reader)
+ GRPC_OVERRIDE;
int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
- gpr_slice* slice) override;
+ gpr_slice* slice) GRPC_OVERRIDE;
grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice,
- size_t nslices) override;
+ size_t nslices) GRPC_OVERRIDE;
- gpr_slice gpr_slice_malloc(size_t length) override;
- void gpr_slice_unref(gpr_slice slice) override;
- gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) override;
- void gpr_slice_buffer_add(gpr_slice_buffer* sb, gpr_slice slice) override;
- void gpr_slice_buffer_pop(gpr_slice_buffer* sb) override;
+ gpr_slice gpr_slice_malloc(size_t length) GRPC_OVERRIDE;
+ void gpr_slice_unref(gpr_slice slice) GRPC_OVERRIDE;
+ gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) GRPC_OVERRIDE;
+ void gpr_slice_buffer_add(gpr_slice_buffer* sb,
+ gpr_slice slice) GRPC_OVERRIDE;
+ void gpr_slice_buffer_pop(gpr_slice_buffer* sb) GRPC_OVERRIDE;
- void grpc_metadata_array_init(grpc_metadata_array* array) override;
- void grpc_metadata_array_destroy(grpc_metadata_array* array) override;
+ void grpc_metadata_array_init(grpc_metadata_array* array) GRPC_OVERRIDE;
+ void grpc_metadata_array_destroy(grpc_metadata_array* array) GRPC_OVERRIDE;
- gpr_timespec gpr_inf_future(gpr_clock_type type) override;
+ gpr_timespec gpr_inf_future(gpr_clock_type type) GRPC_OVERRIDE;
- virtual const Status& ok() override;
- virtual const Status& cancelled() override;
+ virtual const Status& ok() GRPC_OVERRIDE;
+ virtual const Status& cancelled() GRPC_OVERRIDE;
- void assert_fail(const char* failed_assertion) override;
+ void assert_fail(const char* failed_assertion) GRPC_OVERRIDE;
};
} // namespace grpc
diff --git a/include/grpc++/impl/server_builder_option.h b/include/grpc++/impl/server_builder_option.h
index 2b7e89f5e5..bd2018fa6b 100644
--- a/include/grpc++/impl/server_builder_option.h
+++ b/include/grpc++/impl/server_builder_option.h
@@ -50,8 +50,7 @@ class ServerBuilderOption {
virtual void UpdateArguments(ChannelArguments* args) = 0;
/// Alter the ServerBuilderPlugin map that will be added into ServerBuilder.
virtual void UpdatePlugins(
- std::map<grpc::string, std::unique_ptr<ServerBuilderPlugin> >*
- plugins) = 0;
+ std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) = 0;
};
} // namespace grpc
diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h
index aa7588d34d..b9c49f0b19 100644
--- a/include/grpc++/server_builder.h
+++ b/include/grpc++/server_builder.h
@@ -174,7 +174,7 @@ class ServerBuilder {
std::vector<Port> ports_;
std::vector<ServerCompletionQueue*> cqs_;
std::shared_ptr<ServerCredentials> creds_;
- std::map<grpc::string, std::unique_ptr<ServerBuilderPlugin>> plugins_;
+ std::vector<std::unique_ptr<ServerBuilderPlugin>> plugins_;
AsyncGenericService* generic_service_;
struct {
bool is_set;
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index e2f127094a..2288ba4163 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -73,9 +73,10 @@ void PrintIncludes(Printer *printer, const std::vector<grpc::string>& headers, c
vars["l"] = params.use_system_headers ? '<' : '"';
vars["r"] = params.use_system_headers ? '>' : '"';
- if (!params.grpc_search_path.empty()) {
- vars["l"] += params.grpc_search_path;
- if (params.grpc_search_path.back() != '/') {
+ auto& s = params.grpc_search_path;
+ if (!s.empty()) {
+ vars["l"] += s;
+ if (s[s.size()-1] != '/') {
vars["l"] += '/';
}
}
diff --git a/src/compiler/generator_helpers.h b/src/compiler/generator_helpers.h
index 53391bc41a..9a88c2bfcc 100644
--- a/src/compiler/generator_helpers.h
+++ b/src/compiler/generator_helpers.h
@@ -253,7 +253,8 @@ inline void GetComment(const grpc::protobuf::FileDescriptor *desc,
inline grpc::string GenerateCommentsWithPrefix(
const std::vector<grpc::string> &in, const grpc::string &prefix) {
std::ostringstream oss;
- for (const grpc::string &elem : in) {
+ for (auto it = in.begin(); it != in.end(); it++) {
+ const grpc::string& elem = *it;
if (elem.empty()) {
oss << prefix << "\n";
} else if (elem[0] == ' ') {
diff --git a/src/core/lib/support/log.c b/src/core/lib/support/log.c
index 882abf673c..bae0957df7 100644
--- a/src/core/lib/support/log.c
+++ b/src/core/lib/support/log.c
@@ -96,4 +96,6 @@ void gpr_log_verbosity_init() {
}
}
-void gpr_set_log_function(gpr_log_func f) { g_log_func = f; }
+void gpr_set_log_function(gpr_log_func f) {
+ g_log_func = f ? f : gpr_default_log;
+}
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index 50fc4733a1..fb4c68ebe4 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -67,7 +67,7 @@ static std::shared_ptr<Server::GlobalCallbacks> g_callbacks = nullptr;
static gpr_once g_once_init_callbacks = GPR_ONCE_INIT;
static void InitGlobalCallbacks() {
- if (g_callbacks == nullptr) {
+ if (!g_callbacks) {
g_callbacks.reset(new DefaultGlobalCallbacks());
}
}
@@ -324,8 +324,8 @@ Server::~Server() {
}
void Server::SetGlobalCallbacks(GlobalCallbacks* callbacks) {
- GPR_ASSERT(g_callbacks == nullptr);
- GPR_ASSERT(callbacks != nullptr);
+ GPR_ASSERT(!g_callbacks);
+ GPR_ASSERT(callbacks);
g_callbacks.reset(callbacks);
}
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc
index 279981744a..45bb858e2e 100644
--- a/src/cpp/server/server_builder.cc
+++ b/src/cpp/server/server_builder.cc
@@ -55,9 +55,10 @@ static void do_plugin_list_init(void) {
ServerBuilder::ServerBuilder()
: max_message_size_(-1), generic_service_(nullptr) {
gpr_once_init(&once_init_plugin_list, do_plugin_list_init);
- for (auto factory : (*g_plugin_factory_list)) {
- std::unique_ptr<ServerBuilderPlugin> plugin = factory();
- plugins_[plugin->name()] = std::move(plugin);
+ for (auto it = g_plugin_factory_list->begin();
+ it != g_plugin_factory_list->end(); it++) {
+ auto& factory = *it;
+ plugins_.emplace_back(factory());
}
// all compression algorithms enabled by default.
enabled_compression_algorithms_bitset_ =
@@ -141,7 +142,7 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() {
bool has_sync_methods = false;
for (auto it = services_.begin(); it != services_.end(); ++it) {
if ((*it)->service->has_synchronous_methods()) {
- if (thread_pool == nullptr) {
+ if (!thread_pool) {
thread_pool.reset(CreateDefaultThreadPool());
has_sync_methods = true;
break;
@@ -153,9 +154,9 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() {
(*option)->UpdateArguments(&args);
(*option)->UpdatePlugins(&plugins_);
}
- if (thread_pool == nullptr) {
+ if (!thread_pool) {
for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) {
- if ((*plugin).second->has_sync_methods()) {
+ if ((*plugin)->has_sync_methods()) {
thread_pool.reset(CreateDefaultThreadPool());
has_sync_methods = true;
break;
@@ -212,7 +213,7 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() {
}
}
for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) {
- (*plugin).second->InitServer(initializer);
+ (*plugin)->InitServer(initializer);
}
if (generic_service_) {
server->RegisterAsyncGenericService(generic_service_);
@@ -238,7 +239,7 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() {
return nullptr;
}
for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) {
- (*plugin).second->Finish(initializer);
+ (*plugin)->Finish(initializer);
}
return server;
}
diff --git a/templates/Makefile.template b/templates/Makefile.template
index 079fef65ae..02039541e6 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -923,6 +923,7 @@
pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc
+ ifeq ($(EMBED_OPENSSL),true)
privatelibs_cxx: \
% for lib in libs:
% if 'Makefile' in lib.get('build_system', ['Makefile']):
@@ -931,6 +932,18 @@
% endif
% endif
% endfor
+
+ else
+ privatelibs_cxx: \
+ % for lib in libs:
+ % if 'Makefile' in lib.get('build_system', ['Makefile']):
+ % if lib.build == 'private' and lib.language == 'c++' and not lib.get('external_deps', None) and not lib.boringssl:
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
+ % endif
+ % endif
+ % endfor
+
+ endif
ifeq ($(HAS_ZOOKEEPER),true)
@@ -958,12 +971,23 @@
% endfor
+ ifeq ($(EMBED_OPENSSL),true)
buildtests_cxx: buildtests_zookeeper privatelibs_cxx <%text>\</%text>
% for tgt in targets:
% if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None):
$(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text>
% endif
% endfor
+
+ else
+ buildtests_cxx: buildtests_zookeeper privatelibs_cxx <%text>\</%text>
+ % for tgt in targets:
+ % if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None) and not tgt.boringssl:
+ $(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text>
+ % endif
+ % endfor
+
+ endif
ifeq ($(HAS_ZOOKEEPER),true)
diff --git a/templates/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile.template b/templates/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile.template
index 7956798781..e77b3d9e41 100644
--- a/templates/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile.template
+++ b/templates/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile.template
@@ -36,7 +36,9 @@
RUN apt-get update && apt-get install -y ${'\\'}
gcc-4.4 ${'\\'}
- gcc-4.4-multilib
+ gcc-4.4-multilib ${'\\'}
+ g++-4.4 ${'\\'}
+ g++-4.4-multilib
RUN wget ${openssl_fallback.base_uri + openssl_fallback.tarball}
diff --git a/test/core/support/log_test.c b/test/core/support/log_test.c
index 0ae298aa4c..807a8175d7 100644
--- a/test/core/support/log_test.c
+++ b/test/core/support/log_test.c
@@ -78,11 +78,13 @@ int main(int argc, char **argv) {
gpr_set_log_function(test_callback);
gpr_log_message(GPR_INFO, "hello 1 2 3");
gpr_log(GPR_INFO, "hello %d %d %d", 1, 2, 3);
+ gpr_set_log_function(NULL);
/* gpr_log_verbosity_init() will be effective only once, and only before
* gpr_set_log_verbosity() is called */
gpr_setenv("GRPC_VERBOSITY", "ERROR");
gpr_log_verbosity_init();
+
test_log_function_reached(GPR_ERROR);
test_log_function_unreached(GPR_INFO);
test_log_function_unreached(GPR_DEBUG);
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index 8229bda6bf..fc96ea56f0 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -207,12 +207,11 @@ class ServerBuilderSyncPluginDisabler : public ::grpc::ServerBuilderOption {
public:
void UpdateArguments(ChannelArguments* arg) GRPC_OVERRIDE {}
- void UpdatePlugins(
- std::map<grpc::string, std::unique_ptr<ServerBuilderPlugin>>* plugins)
+ void UpdatePlugins(std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins)
GRPC_OVERRIDE {
auto plugin = plugins->begin();
while (plugin != plugins->end()) {
- if ((*plugin).second->has_sync_methods()) {
+ if ((*plugin)->has_sync_methods()) {
plugins->erase(plugin++);
} else {
plugin++;
@@ -235,8 +234,11 @@ class TestScenario {
disable_blocking, credentials_type.c_str(), message_content.size());
}
bool disable_blocking;
- const grpc::string credentials_type;
- const grpc::string message_content;
+ // Although the below grpc::string's are logically const, we can't declare
+ // them const because of a limitation in the way old compilers (e.g., gcc-4.4)
+ // manage vector insertion using a copy constructor
+ grpc::string credentials_type;
+ grpc::string message_content;
};
class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
@@ -940,7 +942,7 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest {
// Client sends 3 messages (tags 3, 4 and 5)
for (int tag_idx = 3; tag_idx <= 5; tag_idx++) {
- send_request.set_message("Ping " + std::to_string(tag_idx));
+ send_request.set_message("Ping " + grpc::to_string(tag_idx));
cli_stream->Write(send_request, tag(tag_idx));
Verifier(GetParam().disable_blocking)
.Expect(tag_idx, true)
@@ -1106,7 +1108,7 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest {
// Server sends three messages (tags 3, 4 and 5)
// But if want_done tag is true, we might also see tag 11
for (int tag_idx = 3; tag_idx <= 5; tag_idx++) {
- send_response.set_message("Pong " + std::to_string(tag_idx));
+ send_response.set_message("Pong " + grpc::to_string(tag_idx));
srv_stream.Write(send_response, tag(tag_idx));
// Note that we'll add something to the verifier and verify that
// something was seen, but it might be tag 11 and not what we
@@ -1397,9 +1399,9 @@ std::vector<TestScenario> CreateTestScenarios(bool test_disable_blocking,
for (auto cred = credentials_types.begin(); cred != credentials_types.end();
++cred) {
for (auto msg = messages.begin(); msg != messages.end(); msg++) {
- scenarios.push_back(TestScenario(false, *cred, *msg));
+ scenarios.emplace_back(false, *cred, *msg);
if (test_disable_blocking) {
- scenarios.push_back(TestScenario(true, *cred, *msg));
+ scenarios.emplace_back(true, *cred, *msg);
}
}
}
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index e3667cf26b..8de9d339f6 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -199,7 +199,10 @@ class TestScenario {
credentials_type.c_str());
}
bool use_proxy;
- const grpc::string credentials_type;
+ // Although the below grpc::string is logically const, we can't declare
+ // them const because of a limitation in the way old compilers (e.g., gcc-4.4)
+ // manage vector insertion using a copy constructor
+ grpc::string credentials_type;
};
class End2endTest : public ::testing::TestWithParam<TestScenario> {
@@ -329,7 +332,7 @@ class End2endServerTryCancelTest : public End2endTest {
// Send server_try_cancel value in the client metadata
context.AddMetadata(kServerTryCancelRequest,
- std::to_string(server_try_cancel));
+ grpc::to_string(server_try_cancel));
auto stream = stub_->RequestStream(&context, &response);
@@ -402,7 +405,7 @@ class End2endServerTryCancelTest : public End2endTest {
// Send server_try_cancel in the client metadata
context.AddMetadata(kServerTryCancelRequest,
- std::to_string(server_try_cancel));
+ grpc::to_string(server_try_cancel));
request.set_message("hello");
auto stream = stub_->ResponseStream(&context, request);
@@ -413,7 +416,7 @@ class End2endServerTryCancelTest : public End2endTest {
break;
}
EXPECT_EQ(response.message(),
- request.message() + std::to_string(num_msgs_read));
+ request.message() + grpc::to_string(num_msgs_read));
num_msgs_read++;
}
gpr_log(GPR_INFO, "Read %d messages", num_msgs_read);
@@ -479,14 +482,14 @@ class End2endServerTryCancelTest : public End2endTest {
// Send server_try_cancel in the client metadata
context.AddMetadata(kServerTryCancelRequest,
- std::to_string(server_try_cancel));
+ grpc::to_string(server_try_cancel));
auto stream = stub_->BidiStream(&context);
int num_msgs_read = 0;
int num_msgs_sent = 0;
while (num_msgs_sent < num_messages) {
- request.set_message("hello " + std::to_string(num_msgs_sent));
+ request.set_message("hello " + grpc::to_string(num_msgs_sent));
if (!stream->Write(request)) {
break;
}
@@ -548,7 +551,7 @@ TEST_P(End2endServerTryCancelTest, RequestEchoServerCancel) {
ClientContext context;
context.AddMetadata(kServerTryCancelRequest,
- std::to_string(CANCEL_BEFORE_PROCESSING));
+ grpc::to_string(CANCEL_BEFORE_PROCESSING));
Status s = stub_->Echo(&context, request, &response);
EXPECT_FALSE(s.ok());
EXPECT_EQ(grpc::StatusCode::CANCELLED, s.error_code());
@@ -1431,9 +1434,9 @@ std::vector<TestScenario> CreateTestScenarios(bool use_proxy,
}
for (auto it = credentials_types.begin(); it != credentials_types.end();
++it) {
- scenarios.push_back(TestScenario(false, *it));
+ scenarios.emplace_back(false, *it);
if (use_proxy) {
- scenarios.push_back(TestScenario(true, *it));
+ scenarios.emplace_back(true, *it);
}
}
return scenarios;
diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc
index 2c05db345b..7e0c0e8a7c 100644
--- a/test/cpp/end2end/hybrid_end2end_test.cc
+++ b/test/cpp/end2end/hybrid_end2end_test.cc
@@ -347,47 +347,50 @@ class HybridEnd2endTest : public ::testing::Test {
}
grpc::testing::UnimplementedService::Service unimplemented_service_;
- std::vector<std::unique_ptr<ServerCompletionQueue> > cqs_;
+ std::vector<std::unique_ptr<ServerCompletionQueue>> cqs_;
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<Server> server_;
std::ostringstream server_address_;
};
TEST_F(HybridEnd2endTest, AsyncEcho) {
- EchoTestService::WithAsyncMethod_Echo<TestServiceImpl> service;
+ typedef EchoTestService::WithAsyncMethod_Echo<TestServiceImpl> SType;
+ SType service;
SetUpServer(&service, nullptr, nullptr);
ResetStub();
- std::thread echo_handler_thread(
- [this, &service] { HandleEcho(&service, cqs_[0].get(), false); });
+ std::thread echo_handler_thread(HandleEcho<SType>, &service, cqs_[0].get(),
+ false);
TestAllMethods();
echo_handler_thread.join();
}
TEST_F(HybridEnd2endTest, AsyncEchoRequestStream) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithAsyncMethod_Echo<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithAsyncMethod_Echo<TestServiceImpl>>
+ SType;
+ SType service;
SetUpServer(&service, nullptr, nullptr);
ResetStub();
- std::thread echo_handler_thread(
- [this, &service] { HandleEcho(&service, cqs_[0].get(), false); });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread echo_handler_thread(HandleEcho<SType>, &service, cqs_[0].get(),
+ false);
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
TestAllMethods();
echo_handler_thread.join();
request_stream_handler_thread.join();
}
TEST_F(HybridEnd2endTest, AsyncRequestStreamResponseStream) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>
+ SType;
+ SType service;
SetUpServer(&service, nullptr, nullptr);
ResetStub();
- std::thread response_stream_handler_thread(
- [this, &service] { HandleServerStreaming(&service, cqs_[0].get()); });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread response_stream_handler_thread(HandleServerStreaming<SType>,
+ &service, cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
TestAllMethods();
response_stream_handler_thread.join();
request_stream_handler_thread.join();
@@ -395,16 +398,17 @@ TEST_F(HybridEnd2endTest, AsyncRequestStreamResponseStream) {
// Add a second service with one sync method.
TEST_F(HybridEnd2endTest, AsyncRequestStreamResponseStream_SyncDupService) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>
+ SType;
+ SType service;
TestServiceImplDupPkg dup_service;
SetUpServer(&service, &dup_service, nullptr);
ResetStub();
- std::thread response_stream_handler_thread(
- [this, &service] { HandleServerStreaming(&service, cqs_[0].get()); });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread response_stream_handler_thread(HandleServerStreaming<SType>,
+ &service, cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
TestAllMethods();
SendEchoToDupService();
response_stream_handler_thread.join();
@@ -413,18 +417,20 @@ TEST_F(HybridEnd2endTest, AsyncRequestStreamResponseStream_SyncDupService) {
// Add a second service with one async method.
TEST_F(HybridEnd2endTest, AsyncRequestStreamResponseStream_AsyncDupService) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>
+ SType;
+ SType service;
duplicate::EchoTestService::AsyncService dup_service;
SetUpServer(&service, &dup_service, nullptr);
ResetStub();
- std::thread response_stream_handler_thread(
- [this, &service] { HandleServerStreaming(&service, cqs_[0].get()); });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread response_stream_handler_thread(HandleServerStreaming<SType>,
+ &service, cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
std::thread echo_handler_thread(
- [this, &dup_service] { HandleEcho(&dup_service, cqs_[2].get(), true); });
+ HandleEcho<duplicate::EchoTestService::AsyncService>, &dup_service,
+ cqs_[2].get(), true);
TestAllMethods();
SendEchoToDupService();
response_stream_handler_thread.join();
@@ -437,25 +443,24 @@ TEST_F(HybridEnd2endTest, GenericEcho) {
AsyncGenericService generic_service;
SetUpServer(&service, nullptr, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
TestAllMethods();
generic_handler_thread.join();
}
TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithGenericMethod_Echo<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithGenericMethod_Echo<TestServiceImpl>>
+ SType;
+ SType service;
AsyncGenericService generic_service;
SetUpServer(&service, nullptr, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
TestAllMethods();
generic_handler_thread.join();
request_stream_handler_thread.join();
@@ -463,18 +468,18 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream) {
// Add a second service with one sync method.
TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_SyncDupService) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithGenericMethod_Echo<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithGenericMethod_Echo<TestServiceImpl>>
+ SType;
+ SType service;
AsyncGenericService generic_service;
TestServiceImplDupPkg dup_service;
SetUpServer(&service, &dup_service, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
TestAllMethods();
SendEchoToDupService();
generic_handler_thread.join();
@@ -483,20 +488,21 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_SyncDupService) {
// Add a second service with one async method.
TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_AsyncDupService) {
- EchoTestService::WithAsyncMethod_RequestStream<
- EchoTestService::WithGenericMethod_Echo<TestServiceImpl> >
- service;
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
+ EchoTestService::WithGenericMethod_Echo<TestServiceImpl>>
+ SType;
+ SType service;
AsyncGenericService generic_service;
duplicate::EchoTestService::AsyncService dup_service;
SetUpServer(&service, &dup_service, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
std::thread echo_handler_thread(
- [this, &dup_service] { HandleEcho(&dup_service, cqs_[2].get(), true); });
+ HandleEcho<duplicate::EchoTestService::AsyncService>, &dup_service,
+ cqs_[2].get(), true);
TestAllMethods();
SendEchoToDupService();
generic_handler_thread.join();
@@ -505,20 +511,20 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_AsyncDupService) {
}
TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStreamResponseStream) {
- EchoTestService::WithAsyncMethod_RequestStream<
+ typedef EchoTestService::WithAsyncMethod_RequestStream<
EchoTestService::WithGenericMethod_Echo<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> > >
- service;
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>>
+ SType;
+ SType service;
AsyncGenericService generic_service;
SetUpServer(&service, nullptr, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
- std::thread request_stream_handler_thread(
- [this, &service] { HandleClientStreaming(&service, cqs_[1].get()); });
- std::thread response_stream_handler_thread(
- [this, &service] { HandleServerStreaming(&service, cqs_[2].get()); });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
+ std::thread request_stream_handler_thread(HandleClientStreaming<SType>,
+ &service, cqs_[1].get());
+ std::thread response_stream_handler_thread(HandleServerStreaming<SType>,
+ &service, cqs_[2].get());
TestAllMethods();
generic_handler_thread.join();
request_stream_handler_thread.join();
@@ -526,21 +532,20 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStreamResponseStream) {
}
TEST_F(HybridEnd2endTest, GenericEchoRequestStreamAsyncResponseStream) {
- EchoTestService::WithGenericMethod_RequestStream<
+ typedef EchoTestService::WithGenericMethod_RequestStream<
EchoTestService::WithGenericMethod_Echo<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> > >
- service;
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>>
+ SType;
+ SType service;
AsyncGenericService generic_service;
SetUpServer(&service, nullptr, &generic_service);
ResetStub();
- std::thread generic_handler_thread([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[0].get());
- });
- std::thread generic_handler_thread2([this, &generic_service] {
- HandleGenericCall(&generic_service, cqs_[1].get());
- });
- std::thread response_stream_handler_thread(
- [this, &service] { HandleServerStreaming(&service, cqs_[2].get()); });
+ std::thread generic_handler_thread(HandleGenericCall, &generic_service,
+ cqs_[0].get());
+ std::thread generic_handler_thread2(HandleGenericCall, &generic_service,
+ cqs_[1].get());
+ std::thread response_stream_handler_thread(HandleServerStreaming<SType>,
+ &service, cqs_[2].get());
TestAllMethods();
generic_handler_thread.join();
generic_handler_thread2.join();
@@ -552,7 +557,7 @@ TEST_F(HybridEnd2endTest, GenericEchoRequestStreamAsyncResponseStream) {
TEST_F(HybridEnd2endTest, GenericMethodWithoutGenericService) {
EchoTestService::WithGenericMethod_RequestStream<
EchoTestService::WithGenericMethod_Echo<
- EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl> > >
+ EchoTestService::WithAsyncMethod_ResponseStream<TestServiceImpl>>>
service;
SetUpServer(&service, nullptr, nullptr);
EXPECT_EQ(nullptr, server_.get());
diff --git a/test/cpp/end2end/server_builder_plugin_test.cc b/test/cpp/end2end/server_builder_plugin_test.cc
index 1c1095087a..75f23b64a7 100644
--- a/test/cpp/end2end/server_builder_plugin_test.cc
+++ b/test/cpp/end2end/server_builder_plugin_test.cc
@@ -113,15 +113,14 @@ class InsertPluginServerBuilderOption : public ServerBuilderOption {
void UpdateArguments(ChannelArguments* arg) GRPC_OVERRIDE {}
- void UpdatePlugins(
- std::map<grpc::string, std::unique_ptr<ServerBuilderPlugin>>* plugins)
+ void UpdatePlugins(std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins)
GRPC_OVERRIDE {
plugins->clear();
std::unique_ptr<TestServerBuilderPlugin> plugin(
new TestServerBuilderPlugin());
if (register_service_) plugin->SetRegisterService();
- (*plugins)[plugin->name()] = std::move(plugin);
+ plugins->emplace_back(std::move(plugin));
}
void SetRegisterService() { register_service_ = true; }
@@ -162,7 +161,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
void InsertPlugin() {
if (GetParam()) {
// Add ServerBuilder plugin in static initialization
- EXPECT_TRUE(builder_->plugins_[PLUGIN_NAME] != nullptr);
+ CheckPresent();
} else {
// Add ServerBuilder plugin using ServerBuilder::SetOption()
builder_->SetOption(std::unique_ptr<ServerBuilderOption>(
@@ -173,10 +172,8 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
void InsertPluginWithTestService() {
if (GetParam()) {
// Add ServerBuilder plugin in static initialization
- EXPECT_TRUE(builder_->plugins_[PLUGIN_NAME] != nullptr);
- auto plugin = static_cast<TestServerBuilderPlugin*>(
- builder_->plugins_[PLUGIN_NAME].get());
- EXPECT_TRUE(plugin != nullptr);
+ auto plugin = CheckPresent();
+ EXPECT_TRUE(plugin);
plugin->SetRegisterService();
} else {
// Add ServerBuilder plugin using ServerBuilder::SetOption()
@@ -192,7 +189,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
builder_->AddListeningPort(server_address, InsecureServerCredentials());
cq_ = builder_->AddCompletionQueue();
server_ = builder_->BuildAndStart();
- EXPECT_TRUE(builder_->plugins_[PLUGIN_NAME] != nullptr);
+ EXPECT_TRUE(CheckPresent());
}
void ResetStub() {
@@ -202,10 +199,8 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
}
void TearDown() GRPC_OVERRIDE {
- EXPECT_TRUE(builder_->plugins_[PLUGIN_NAME] != nullptr);
- auto plugin = static_cast<TestServerBuilderPlugin*>(
- builder_->plugins_[PLUGIN_NAME].get());
- EXPECT_TRUE(plugin != nullptr);
+ auto plugin = CheckPresent();
+ EXPECT_TRUE(plugin);
EXPECT_TRUE(plugin->init_server_is_called());
EXPECT_TRUE(plugin->finish_is_called());
server_->Shutdown();
@@ -230,6 +225,19 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
std::unique_ptr<Server> server_;
TestServiceImpl service_;
int port_;
+
+ private:
+ TestServerBuilderPlugin* CheckPresent() {
+ auto it = builder_->plugins_.begin();
+ for (; it != builder_->plugins_.end(); it++) {
+ if ((*it)->name() == PLUGIN_NAME) break;
+ }
+ if (it != builder_->plugins_.end()) {
+ return static_cast<TestServerBuilderPlugin*>(it->get());
+ } else {
+ return nullptr;
+ }
+ }
};
TEST_P(ServerBuilderPluginTest, PluginWithoutServiceTest) {
diff --git a/test/cpp/end2end/test_service_impl.cc b/test/cpp/end2end/test_service_impl.cc
index cbaee92228..52abd80d69 100644
--- a/test/cpp/end2end/test_service_impl.cc
+++ b/test/cpp/end2end/test_service_impl.cc
@@ -33,6 +33,7 @@
#include "test/cpp/end2end/test_service_impl.h"
+#include <string>
#include <thread>
#include <grpc++/security/credentials.h>
@@ -253,7 +254,7 @@ Status TestServiceImpl::ResponseStream(ServerContext* context,
}
for (int i = 0; i < kNumResponseStreamsMsgs; i++) {
- response.set_message(request->message() + std::to_string(i));
+ response.set_message(request->message() + grpc::to_string(i));
writer->Write(response);
}
diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc
index 94541f9a45..1e73f88917 100644
--- a/test/cpp/end2end/thread_stress_test.cc
+++ b/test/cpp/end2end/thread_stress_test.cc
@@ -230,7 +230,7 @@ class CommonStressTestSyncServer : public CommonStressTest<TestServiceImpl> {
};
class CommonStressTestAsyncServer
- : public CommonStressTest<::grpc::testing::EchoTestService::AsyncService> {
+ : public CommonStressTest< ::grpc::testing::EchoTestService::AsyncService> {
public:
void SetUp() GRPC_OVERRIDE {
shutting_down_ = false;
@@ -394,7 +394,7 @@ class AsyncClientEnd2endTest : public ::testing::Test {
for (int i = 0; i < num_rpcs; ++i) {
AsyncClientCall* call = new AsyncClientCall;
EchoRequest request;
- request.set_message("Hello: " + std::to_string(i));
+ request.set_message("Hello: " + grpc::to_string(i));
call->response_reader =
common_.GetStub()->AsyncEcho(&call->context, request, &cq_);
call->response_reader->Finish(&call->response, &call->status,
diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h
index ae75762bb8..c8d6810c12 100644
--- a/test/cpp/interop/interop_client.h
+++ b/test/cpp/interop/interop_client.h
@@ -45,9 +45,9 @@ namespace grpc {
namespace testing {
// Function pointer for custom checks.
-using CheckerFn =
- std::function<void(const InteropClientContextInspector&,
- const SimpleRequest*, const SimpleResponse*)>;
+typedef std::function<void(const InteropClientContextInspector&,
+ const SimpleRequest*, const SimpleResponse*)>
+ CheckerFn;
class InteropClient {
public:
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc
index 6ad4c320b5..3d98ab0939 100644
--- a/test/cpp/qps/client_async.cc
+++ b/test/cpp/qps/client_async.cc
@@ -249,7 +249,8 @@ class AsyncUnaryClient GRPC_FINAL
: public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
public:
explicit AsyncUnaryClient(const ClientConfig& config)
- : AsyncClient(config, SetupCtx, BenchmarkStubCreator) {
+ : AsyncClient<BenchmarkService::Stub, SimpleRequest>(
+ config, SetupCtx, BenchmarkStubCreator) {
StartThreads(num_async_threads_);
}
~AsyncUnaryClient() GRPC_OVERRIDE { EndThreads(); }
@@ -376,7 +377,8 @@ class AsyncStreamingClient GRPC_FINAL
: public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
public:
explicit AsyncStreamingClient(const ClientConfig& config)
- : AsyncClient(config, SetupCtx, BenchmarkStubCreator) {
+ : AsyncClient<BenchmarkService::Stub, SimpleRequest>(
+ config, SetupCtx, BenchmarkStubCreator) {
StartThreads(num_async_threads_);
}
@@ -511,7 +513,8 @@ class GenericAsyncStreamingClient GRPC_FINAL
: public AsyncClient<grpc::GenericStub, ByteBuffer> {
public:
explicit GenericAsyncStreamingClient(const ClientConfig& config)
- : AsyncClient(config, SetupCtx, GenericStubCreator) {
+ : AsyncClient<grpc::GenericStub, ByteBuffer>(config, SetupCtx,
+ GenericStubCreator) {
StartThreads(num_async_threads_);
}
diff --git a/test/cpp/util/metrics_server.cc b/test/cpp/util/metrics_server.cc
index cc6b39b753..1c7cd6382a 100644
--- a/test/cpp/util/metrics_server.cc
+++ b/test/cpp/util/metrics_server.cc
@@ -99,7 +99,7 @@ std::shared_ptr<QpsGauge> MetricsServiceImpl::CreateQpsGauge(
std::lock_guard<std::mutex> lock(mu_);
std::shared_ptr<QpsGauge> qps_gauge(new QpsGauge());
- const auto p = qps_gauges_.emplace(name, qps_gauge);
+ const auto p = qps_gauges_.insert(std::make_pair(name, qps_gauge));
// p.first is an iterator pointing to <name, shared_ptr<QpsGauge>> pair.
// p.second is a boolean which is set to 'true' if the QpsGauge is
@@ -114,7 +114,7 @@ std::shared_ptr<QpsGauge> MetricsServiceImpl::CreateQpsGauge(
std::unique_ptr<grpc::Server> MetricsServiceImpl::StartServer(int port) {
gpr_log(GPR_INFO, "Building metrics server..");
- const grpc::string address = "0.0.0.0:" + std::to_string(port);
+ const grpc::string address = "0.0.0.0:" + grpc::to_string(port);
ServerBuilder builder;
builder.AddListeningPort(address, grpc::InsecureServerCredentials());
diff --git a/test/cpp/util/test_credentials_provider.cc b/test/cpp/util/test_credentials_provider.cc
index 9c09a73115..6e68f59e6a 100644
--- a/test/cpp/util/test_credentials_provider.cc
+++ b/test/cpp/util/test_credentials_provider.cc
@@ -41,15 +41,9 @@
#include "test/core/end2end/data/ssl_test_data.h"
+namespace grpc {
namespace {
-using grpc::ChannelArguments;
-using grpc::ChannelCredentials;
-using grpc::InsecureChannelCredentials;
-using grpc::InsecureServerCredentials;
-using grpc::ServerCredentials;
-using grpc::SslCredentialsOptions;
-using grpc::SslServerCredentialsOptions;
using grpc::testing::CredentialTypeProvider;
// Provide test credentials. Thread-safe.
@@ -69,19 +63,27 @@ class CredentialsProvider {
class DefaultCredentialsProvider : public CredentialsProvider {
public:
- ~DefaultCredentialsProvider() override {}
+ ~DefaultCredentialsProvider() GRPC_OVERRIDE {}
- void AddSecureType(
- const grpc::string& type,
- std::unique_ptr<CredentialTypeProvider> type_provider) override {
+ void AddSecureType(const grpc::string& type,
+ std::unique_ptr<CredentialTypeProvider> type_provider)
+ GRPC_OVERRIDE {
// This clobbers any existing entry for type, except the defaults, which
// can't be clobbered.
grpc::unique_lock<grpc::mutex> lock(mu_);
- added_secure_types_[type] = std::move(type_provider);
+ auto it = std::find(added_secure_type_names_.begin(),
+ added_secure_type_names_.end(), type);
+ if (it == added_secure_type_names_.end()) {
+ added_secure_type_names_.push_back(type);
+ added_secure_type_providers_.push_back(std::move(type_provider));
+ } else {
+ added_secure_type_providers_[it - added_secure_type_names_.begin()] =
+ std::move(type_provider);
+ }
}
std::shared_ptr<ChannelCredentials> GetChannelCredentials(
- const grpc::string& type, ChannelArguments* args) override {
+ const grpc::string& type, ChannelArguments* args) GRPC_OVERRIDE {
if (type == grpc::testing::kInsecureCredentialsType) {
return InsecureChannelCredentials();
} else if (type == grpc::testing::kTlsCredentialsType) {
@@ -90,17 +92,19 @@ class DefaultCredentialsProvider : public CredentialsProvider {
return SslCredentials(ssl_opts);
} else {
grpc::unique_lock<grpc::mutex> lock(mu_);
- auto it(added_secure_types_.find(type));
- if (it == added_secure_types_.end()) {
+ auto it(std::find(added_secure_type_names_.begin(),
+ added_secure_type_names_.end(), type));
+ if (it == added_secure_type_names_.end()) {
gpr_log(GPR_ERROR, "Unsupported credentials type %s.", type.c_str());
return nullptr;
}
- return it->second->GetChannelCredentials(args);
+ return added_secure_type_providers_[it - added_secure_type_names_.begin()]
+ ->GetChannelCredentials(args);
}
}
std::shared_ptr<ServerCredentials> GetServerCredentials(
- const grpc::string& type) override {
+ const grpc::string& type) GRPC_OVERRIDE {
if (type == grpc::testing::kInsecureCredentialsType) {
return InsecureServerCredentials();
} else if (type == grpc::testing::kTlsCredentialsType) {
@@ -112,28 +116,32 @@ class DefaultCredentialsProvider : public CredentialsProvider {
return SslServerCredentials(ssl_opts);
} else {
grpc::unique_lock<grpc::mutex> lock(mu_);
- auto it(added_secure_types_.find(type));
- if (it == added_secure_types_.end()) {
+ auto it(std::find(added_secure_type_names_.begin(),
+ added_secure_type_names_.end(), type));
+ if (it == added_secure_type_names_.end()) {
gpr_log(GPR_ERROR, "Unsupported credentials type %s.", type.c_str());
return nullptr;
}
- return it->second->GetServerCredentials();
+ return added_secure_type_providers_[it - added_secure_type_names_.begin()]
+ ->GetServerCredentials();
}
}
- std::vector<grpc::string> GetSecureCredentialsTypeList() override {
+ std::vector<grpc::string> GetSecureCredentialsTypeList() GRPC_OVERRIDE {
std::vector<grpc::string> types;
types.push_back(grpc::testing::kTlsCredentialsType);
grpc::unique_lock<grpc::mutex> lock(mu_);
- for (const auto& type_pair : added_secure_types_) {
- types.push_back(type_pair.first);
+ for (auto it = added_secure_type_names_.begin();
+ it != added_secure_type_names_.end(); it++) {
+ types.push_back(*it);
}
return types;
}
private:
grpc::mutex mu_;
- std::unordered_map<grpc::string, std::unique_ptr<CredentialTypeProvider> >
- added_secure_types_;
+ std::vector<grpc::string> added_secure_type_names_;
+ std::vector<std::unique_ptr<CredentialTypeProvider>>
+ added_secure_type_providers_;
};
gpr_once g_once_init_provider = GPR_ONCE_INIT;
@@ -148,7 +156,6 @@ CredentialsProvider* GetProvider() {
} // namespace
-namespace grpc {
namespace testing {
void AddSecureType(const grpc::string& type,
diff --git a/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile b/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile
index 6f330f9166..dd9a79b1ed 100644
--- a/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile
+++ b/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile
@@ -70,7 +70,9 @@ RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev c
RUN apt-get update && apt-get install -y \
gcc-4.4 \
- gcc-4.4-multilib
+ gcc-4.4-multilib \
+ g++-4.4 \
+ g++-4.4-multilib
RUN wget https://openssl.org/source/old/1.0.2/openssl-1.0.2f.tar.gz
diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py
index 3080d19c8d..167d633cb0 100755
--- a/tools/run_tests/run_tests.py
+++ b/tools/run_tests/run_tests.py
@@ -794,6 +794,7 @@ argp.add_argument('-n', '--runs_per_test', default=1, type=runs_per_test_type,
help='A positive integer or "inf". If "inf", all tests will run in an '
'infinite loop. Especially useful in combination with "-f"')
argp.add_argument('-r', '--regex', default='.*', type=str)
+argp.add_argument('--regex_exclude', default='', type=str)
argp.add_argument('-j', '--jobs', default=multiprocessing.cpu_count(), type=int)
argp.add_argument('-s', '--slowdown', default=1.0, type=float)
argp.add_argument('-f', '--forever',
@@ -1205,7 +1206,9 @@ def _build_and_run(
spec
for language in languages
for spec in language.test_specs()
- if re.search(args.regex, spec.shortname))
+ if (re.search(args.regex, spec.shortname) and
+ (args.regex_exclude == '' or
+ not re.search(args.regex_exclude, spec.shortname))))
# When running on travis, we want out test runs to be as similar as possible
# for reproducibility purposes.
if args.travis: