From 49772e00eb9606c3192b88f348d9cbcb22eb93c2 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 21 Aug 2015 08:08:37 -0700 Subject: Outlaw illegal metadata characters --- Makefile | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 31628b4412..f7ace3186a 100644 --- a/Makefile +++ b/Makefile @@ -793,6 +793,7 @@ fling_server: $(BINDIR)/$(CONFIG)/fling_server fling_stream_test: $(BINDIR)/$(CONFIG)/fling_stream_test fling_test: $(BINDIR)/$(CONFIG)/fling_test gen_hpack_tables: $(BINDIR)/$(CONFIG)/gen_hpack_tables +gen_legal_metadata_characters: $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters gpr_cmdline_test: $(BINDIR)/$(CONFIG)/gpr_cmdline_test gpr_env_test: $(BINDIR)/$(CONFIG)/gpr_env_test gpr_file_test: $(BINDIR)/$(CONFIG)/gpr_file_test @@ -3386,7 +3387,7 @@ test_python: static_c tools: tools_c tools_cxx -tools_c: privatelibs_c $(BINDIR)/$(CONFIG)/gen_hpack_tables $(BINDIR)/$(CONFIG)/grpc_create_jwt $(BINDIR)/$(CONFIG)/grpc_fetch_oauth2 $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token $(BINDIR)/$(CONFIG)/grpc_verify_jwt +tools_c: privatelibs_c $(BINDIR)/$(CONFIG)/gen_hpack_tables $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters $(BINDIR)/$(CONFIG)/grpc_create_jwt $(BINDIR)/$(CONFIG)/grpc_fetch_oauth2 $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token $(BINDIR)/$(CONFIG)/grpc_verify_jwt tools_cxx: privatelibs_cxx @@ -7122,6 +7123,35 @@ endif endif +GEN_LEGAL_METADATA_CHARACTERS_SRC = \ + tools/codegen/core/gen_legal_metadata_characters.c \ + +GEN_LEGAL_METADATA_CHARACTERS_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_LEGAL_METADATA_CHARACTERS_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: openssl_dep_error + +else + +$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters + +endif + +$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_legal_metadata_characters.o: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a +deps_gen_legal_metadata_characters: $(GEN_LEGAL_METADATA_CHARACTERS_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(GEN_LEGAL_METADATA_CHARACTERS_OBJS:.o=.dep) +endif +endif + + GPR_CMDLINE_TEST_SRC = \ test/core/support/cmdline_test.c \ -- cgit v1.2.3 From 11a28c7f1a31343f85f72f35bd42b34877cc9339 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 24 Aug 2015 07:54:34 -0700 Subject: Update projects --- Makefile | 6 +++--- build.json | 3 +-- tools/run_tests/jobset.py | 1 + tools/run_tests/sources_and_headers.json | 5 +---- vsprojects/Grpc.mak | 4 ++-- 5 files changed, 8 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f7ace3186a..15e05a5d87 100644 --- a/Makefile +++ b/Makefile @@ -7135,14 +7135,14 @@ $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: openssl_dep_error else -$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a +$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LD) $(LDFLAGS) $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters + $(Q) $(LD) $(LDFLAGS) $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters endif -$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_legal_metadata_characters.o: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a +$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_legal_metadata_characters.o: deps_gen_legal_metadata_characters: $(GEN_LEGAL_METADATA_CHARACTERS_OBJS:.o=.dep) ifneq ($(NO_SECURE),true) diff --git a/build.json b/build.json index c6a670970b..b784fe3303 100644 --- a/build.json +++ b/build.json @@ -1150,8 +1150,7 @@ "src": [ "tools/codegen/core/gen_legal_metadata_characters.c" ], - "deps": [ - ] + "deps": [] }, { "name": "gpr_cmdline_test", diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py index 538deac0e3..d0e3fc4eb3 100755 --- a/tools/run_tests/jobset.py +++ b/tools/run_tests/jobset.py @@ -174,6 +174,7 @@ class Job(object): for k, v in add_env.iteritems(): env[k] = v self._start = time.time() + print spec.cmdline self._process = subprocess.Popen(args=spec.cmdline, stderr=subprocess.STDOUT, stdout=self._tempfile, diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 142c84901d..aa22f0f159 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -238,10 +238,7 @@ ] }, { - "deps": [ - "gpr", - "grpc" - ], + "deps": [], "headers": [], "language": "c", "name": "gen_legal_metadata_characters", diff --git a/vsprojects/Grpc.mak b/vsprojects/Grpc.mak index 3d853d9c76..9eede74b08 100644 --- a/vsprojects/Grpc.mak +++ b/vsprojects/Grpc.mak @@ -183,10 +183,10 @@ gen_hpack_tables: gen_hpack_tables.exe echo Running gen_hpack_tables $(OUT_DIR)\gen_hpack_tables.exe -gen_legal_metadata_characters.exe: build_gpr build_grpc $(OUT_DIR) +gen_legal_metadata_characters.exe: $(OUT_DIR) echo Building gen_legal_metadata_characters $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ $(REPO_ROOT)\tools\codegen\core\gen_legal_metadata_characters.c - $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gen_legal_metadata_characters.exe" Debug\gpr.lib Debug\grpc.lib $(LIBS) $(OUT_DIR)\gen_legal_metadata_characters.obj + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\gen_legal_metadata_characters.exe" $(LIBS) $(OUT_DIR)\gen_legal_metadata_characters.obj gen_legal_metadata_characters: gen_legal_metadata_characters.exe echo Running gen_legal_metadata_characters $(OUT_DIR)\gen_legal_metadata_characters.exe -- cgit v1.2.3 From df77673c6cd578741b1017588190602bc97b4f7d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 25 Aug 2015 06:59:51 -0700 Subject: Dont try to parallelize OpenSSL build --- Makefile | 2 +- templates/Makefile.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1053c517fe..54eadeeb87 100644 --- a/Makefile +++ b/Makefile @@ -1649,7 +1649,7 @@ else $(Q)(cd third_party/openssl ; CC="$(CC) $(PIC_CPPFLAGS) -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_EXTRA)" ./config no-asm $(OPENSSL_CONFIG_$(CONFIG))) endif endif - $(Q)$(MAKE) -C third_party/openssl clean + $(Q)$(MAKE) -j 1 -C third_party/openssl clean $(Q)(unset CPPFLAGS; $(MAKE) -C third_party/openssl build_crypto build_ssl) $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/openssl $(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a $(LIBDIR)/$(CONFIG)/openssl diff --git a/templates/Makefile.template b/templates/Makefile.template index 00582a22f8..0af3dbde7a 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -859,7 +859,7 @@ else $(Q)(cd third_party/openssl ; CC="$(CC) $(PIC_CPPFLAGS) -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_EXTRA)" ./config no-asm $(OPENSSL_CONFIG_$(CONFIG))) endif endif - $(Q)$(MAKE) -C third_party/openssl clean + $(Q)$(MAKE) -j 1 -C third_party/openssl clean $(Q)(unset CPPFLAGS; $(MAKE) -C third_party/openssl build_crypto build_ssl) $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/openssl $(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a $(LIBDIR)/$(CONFIG)/openssl -- cgit v1.2.3 From d01b6f49a2f28eae3d5dcbd779e68a4ac54ee38c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 25 Aug 2015 12:58:07 -0700 Subject: Its not enough to just serialize the clean step... --- Makefile | 2 +- templates/Makefile.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 674b83ab15..8820ca05fe 100644 --- a/Makefile +++ b/Makefile @@ -1651,7 +1651,7 @@ else endif endif $(Q)$(MAKE) -j 1 -C third_party/openssl clean - $(Q)(unset CPPFLAGS; $(MAKE) -C third_party/openssl build_crypto build_ssl) + $(Q)(unset CPPFLAGS; $(MAKE) -j 1 -C third_party/openssl build_crypto build_ssl) $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/openssl $(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a $(LIBDIR)/$(CONFIG)/openssl diff --git a/templates/Makefile.template b/templates/Makefile.template index 0af3dbde7a..797f0ab57f 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -860,7 +860,7 @@ else endif endif $(Q)$(MAKE) -j 1 -C third_party/openssl clean - $(Q)(unset CPPFLAGS; $(MAKE) -C third_party/openssl build_crypto build_ssl) + $(Q)(unset CPPFLAGS; $(MAKE) -j 1 -C third_party/openssl build_crypto build_ssl) $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/openssl $(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a $(LIBDIR)/$(CONFIG)/openssl -- cgit v1.2.3 From e21908fcee3ffac086575e247be3442860ac7b3a Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 25 Aug 2015 13:47:51 -0700 Subject: impl --- Makefile | 3 ++ build.json | 2 ++ include/grpc++/client_context.h | 1 + include/grpc++/impl/call.h | 9 +++--- include/grpc++/server_context.h | 1 + include/grpc++/support/string_ref.h | 2 +- src/cpp/common/call.cc | 11 ++++---- src/cpp/server/server.cc | 11 ++++---- src/cpp/server/server_context.cc | 7 ++--- src/cpp/util/string_ref.cc | 2 +- test/cpp/end2end/async_end2end_test.cc | 37 +++++++++++++++++-------- test/cpp/end2end/end2end_test.cc | 27 ++++++++++-------- test/cpp/util/cli_call.cc | 10 +++---- test/cpp/util/cli_call.h | 12 +++++--- test/cpp/util/cli_call_test.cc | 13 +++++---- test/cpp/util/grpc_cli.cc | 22 +++++++++------ test/cpp/util/string_ref_helper.cc | 44 ++++++++++++++++++++++++++++++ test/cpp/util/string_ref_helper.h | 47 ++++++++++++++++++++++++++++++++ tools/run_tests/sources_and_headers.json | 3 ++ vsprojects/Grpc.mak | 4 +-- 20 files changed, 200 insertions(+), 68 deletions(-) create mode 100644 test/cpp/util/string_ref_helper.cc create mode 100644 test/cpp/util/string_ref_helper.h (limited to 'Makefile') diff --git a/Makefile b/Makefile index 975633f998..5fbe3d98c1 100644 --- a/Makefile +++ b/Makefile @@ -4793,6 +4793,7 @@ LIBGRPC++_TEST_UTIL_SRC = \ $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.grpc.pb.cc \ test/cpp/util/cli_call.cc \ test/cpp/util/create_test_channel.cc \ + test/cpp/util/string_ref_helper.cc \ test/cpp/util/subprocess.cc \ @@ -4839,6 +4840,7 @@ endif endif $(OBJDIR)/$(CONFIG)/test/cpp/util/cli_call.o: $(GENDIR)/test/cpp/util/messages.pb.cc $(GENDIR)/test/cpp/util/messages.grpc.pb.cc $(GENDIR)/test/cpp/util/echo.pb.cc $(GENDIR)/test/cpp/util/echo.grpc.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/util/create_test_channel.o: $(GENDIR)/test/cpp/util/messages.pb.cc $(GENDIR)/test/cpp/util/messages.grpc.pb.cc $(GENDIR)/test/cpp/util/echo.pb.cc $(GENDIR)/test/cpp/util/echo.grpc.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.grpc.pb.cc +$(OBJDIR)/$(CONFIG)/test/cpp/util/string_ref_helper.o: $(GENDIR)/test/cpp/util/messages.pb.cc $(GENDIR)/test/cpp/util/messages.grpc.pb.cc $(GENDIR)/test/cpp/util/echo.pb.cc $(GENDIR)/test/cpp/util/echo.grpc.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.grpc.pb.cc $(OBJDIR)/$(CONFIG)/test/cpp/util/subprocess.o: $(GENDIR)/test/cpp/util/messages.pb.cc $(GENDIR)/test/cpp/util/messages.grpc.pb.cc $(GENDIR)/test/cpp/util/echo.pb.cc $(GENDIR)/test/cpp/util/echo.grpc.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc $(GENDIR)/test/cpp/util/echo_duplicate.grpc.pb.cc @@ -20672,6 +20674,7 @@ test/cpp/qps/timer.cc: $(OPENSSL_DEP) test/cpp/util/benchmark_config.cc: $(OPENSSL_DEP) test/cpp/util/cli_call.cc: $(OPENSSL_DEP) test/cpp/util/create_test_channel.cc: $(OPENSSL_DEP) +test/cpp/util/string_ref_helper.cc: $(OPENSSL_DEP) test/cpp/util/subprocess.cc: $(OPENSSL_DEP) test/cpp/util/test_config.cc: $(OPENSSL_DEP) endif diff --git a/build.json b/build.json index 4f9017a0ad..8990d925a4 100644 --- a/build.json +++ b/build.json @@ -660,6 +660,7 @@ "headers": [ "test/cpp/util/cli_call.h", "test/cpp/util/create_test_channel.h", + "test/cpp/util/string_ref_helper.h", "test/cpp/util/subprocess.h" ], "src": [ @@ -668,6 +669,7 @@ "test/cpp/util/echo_duplicate.proto", "test/cpp/util/cli_call.cc", "test/cpp/util/create_test_channel.cc", + "test/cpp/util/string_ref_helper.cc", "test/cpp/util/subprocess.cc" ], "deps": [ diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index c4724cc1f0..62e5260a18 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -45,6 +45,7 @@ #include #include #include +#include #include struct census_context; diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index e5da6c9e2a..fca5603047 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -54,8 +54,9 @@ namespace grpc { class ByteBuffer; class Call; -void FillMetadataMap(grpc_metadata_array* arr, - std::multimap* metadata); +void FillMetadataMap( + grpc_metadata_array* arr, + std::multimap* metadata); grpc_metadata* FillMetadataArray( const std::multimap& metadata); @@ -418,7 +419,7 @@ class CallOpRecvInitialMetadata { } private: - std::multimap* recv_initial_metadata_; + std::multimap* recv_initial_metadata_; grpc_metadata_array recv_initial_metadata_arr_; }; @@ -461,7 +462,7 @@ class CallOpClientRecvStatus { } private: - std::multimap* recv_trailing_metadata_; + std::multimap* recv_trailing_metadata_; Status* recv_status_; grpc_metadata_array recv_trailing_metadata_arr_; grpc_status_code status_code_; diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index a165d84944..4b17a28047 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -41,6 +41,7 @@ #include #include #include +#include #include struct gpr_timespec; diff --git a/include/grpc++/support/string_ref.h b/include/grpc++/support/string_ref.h index 70bacc9445..348c42cbba 100644 --- a/include/grpc++/support/string_ref.h +++ b/include/grpc++/support/string_ref.h @@ -50,7 +50,7 @@ class string_ref { typedef std::reverse_iterator const_reverse_iterator; // constants - static size_t npos = size_t(-1); + const static size_t npos = size_t(-1); // construct/copy. string_ref() : data_(nullptr), length_(0) {} diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 16aa2c9fb9..5b87c2a806 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -41,13 +41,14 @@ namespace grpc { -void FillMetadataMap(grpc_metadata_array* arr, - std::multimap* metadata) { +void FillMetadataMap( + grpc_metadata_array* arr, + std::multimap* metadata) { for (size_t i = 0; i < arr->count; i++) { // TODO(yangg) handle duplicates? - metadata->insert(std::pair( - arr->metadata[i].key, - grpc::string(arr->metadata[i].value, arr->metadata[i].value_length))); + metadata->insert(std::pair( + arr->metadata[i].key, grpc::string_ref(arr->metadata[i].value, + arr->metadata[i].value_length))); } grpc_metadata_array_destroy(arr); grpc_metadata_array_init(arr); diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 66cd27cc33..bb83c7d887 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -439,11 +439,12 @@ Server::BaseAsyncRequest::~BaseAsyncRequest() {} bool Server::BaseAsyncRequest::FinalizeResult(void** tag, bool* status) { if (*status) { for (size_t i = 0; i < initial_metadata_array_.count; i++) { - context_->client_metadata_.insert(std::make_pair( - grpc::string(initial_metadata_array_.metadata[i].key), - grpc::string(initial_metadata_array_.metadata[i].value, - initial_metadata_array_.metadata[i].value + - initial_metadata_array_.metadata[i].value_length))); + context_->client_metadata_.insert( + std::pair( + initial_metadata_array_.metadata[i].key, + grpc::string_ref( + initial_metadata_array_.metadata[i].value, + initial_metadata_array_.metadata[i].value_length))); } } grpc_metadata_array_destroy(&initial_metadata_array_); diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index acc163d6b5..8193e70660 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -136,10 +136,9 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata, cq_(nullptr), sent_initial_metadata_(false) { for (size_t i = 0; i < metadata_count; i++) { - client_metadata_.insert(std::make_pair( - grpc::string(metadata[i].key), - grpc::string(metadata[i].value, - metadata[i].value + metadata[i].value_length))); + client_metadata_.insert(std::pair( + metadata[i].key, + grpc::string_ref(metadata[i].value, metadata[i].value_length))); } } diff --git a/src/cpp/util/string_ref.cc b/src/cpp/util/string_ref.cc index ff6b7617a3..d9c9019da8 100644 --- a/src/cpp/util/string_ref.cc +++ b/src/cpp/util/string_ref.cc @@ -39,7 +39,7 @@ namespace grpc { -size_t string_ref::npos; +const size_t string_ref::npos; string_ref& string_ref::operator=(const string_ref& rhs) { data_ = rhs.data_; diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 6343810ee9..41b91e459b 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -50,6 +50,7 @@ #include "test/core/util/test_config.h" #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" +#include "test/cpp/util/string_ref_helper.h" #ifdef GPR_POSIX_SOCKET #include "src/core/iomgr/pollset_posix.h" @@ -484,8 +485,10 @@ TEST_P(AsyncEnd2endTest, ClientInitialMetadataRpc) { Verifier(GetParam()).Expect(2, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); auto client_initial_metadata = srv_ctx.client_metadata(); - EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second); - EXPECT_EQ(meta2.second, client_initial_metadata.find(meta2.first)->second); + EXPECT_EQ(meta1.second, + ToString(client_initial_metadata.find(meta1.first)->second)); + EXPECT_EQ(meta2.second, + ToString(client_initial_metadata.find(meta2.first)->second)); EXPECT_GE(client_initial_metadata.size(), static_cast(2)); send_response.set_message(recv_request.message()); @@ -532,8 +535,10 @@ TEST_P(AsyncEnd2endTest, ServerInitialMetadataRpc) { response_reader->ReadInitialMetadata(tag(4)); Verifier(GetParam()).Expect(4, true).Verify(cq_.get()); auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); - EXPECT_EQ(meta1.second, server_initial_metadata.find(meta1.first)->second); - EXPECT_EQ(meta2.second, server_initial_metadata.find(meta2.first)->second); + EXPECT_EQ(meta1.second, + ToString(server_initial_metadata.find(meta1.first)->second)); + EXPECT_EQ(meta2.second, + ToString(server_initial_metadata.find(meta2.first)->second)); EXPECT_EQ(static_cast(2), server_initial_metadata.size()); send_response.set_message(recv_request.message()); @@ -586,8 +591,10 @@ TEST_P(AsyncEnd2endTest, ServerTrailingMetadataRpc) { EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.ok()); auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata(); - EXPECT_EQ(meta1.second, server_trailing_metadata.find(meta1.first)->second); - EXPECT_EQ(meta2.second, server_trailing_metadata.find(meta2.first)->second); + EXPECT_EQ(meta1.second, + ToString(server_trailing_metadata.find(meta1.first)->second)); + EXPECT_EQ(meta2.second, + ToString(server_trailing_metadata.find(meta2.first)->second)); EXPECT_EQ(static_cast(2), server_trailing_metadata.size()); } @@ -631,8 +638,10 @@ TEST_P(AsyncEnd2endTest, MetadataRpc) { Verifier(GetParam()).Expect(2, true).Verify(cq_.get()); EXPECT_EQ(send_request.message(), recv_request.message()); auto client_initial_metadata = srv_ctx.client_metadata(); - EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second); - EXPECT_EQ(meta2.second, client_initial_metadata.find(meta2.first)->second); + EXPECT_EQ(meta1.second, + ToString(client_initial_metadata.find(meta1.first)->second)); + EXPECT_EQ(meta2.second, + ToString(client_initial_metadata.find(meta2.first)->second)); EXPECT_GE(client_initial_metadata.size(), static_cast(2)); srv_ctx.AddInitialMetadata(meta3.first, meta3.second); @@ -642,8 +651,10 @@ TEST_P(AsyncEnd2endTest, MetadataRpc) { response_reader->ReadInitialMetadata(tag(4)); Verifier(GetParam()).Expect(4, true).Verify(cq_.get()); auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); - EXPECT_EQ(meta3.second, server_initial_metadata.find(meta3.first)->second); - EXPECT_EQ(meta4.second, server_initial_metadata.find(meta4.first)->second); + EXPECT_EQ(meta3.second, + ToString(server_initial_metadata.find(meta3.first)->second)); + EXPECT_EQ(meta4.second, + ToString(server_initial_metadata.find(meta4.first)->second)); EXPECT_GE(server_initial_metadata.size(), static_cast(2)); send_response.set_message(recv_request.message()); @@ -658,8 +669,10 @@ TEST_P(AsyncEnd2endTest, MetadataRpc) { EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.ok()); auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata(); - EXPECT_EQ(meta5.second, server_trailing_metadata.find(meta5.first)->second); - EXPECT_EQ(meta6.second, server_trailing_metadata.find(meta6.first)->second); + EXPECT_EQ(meta5.second, + ToString(server_trailing_metadata.find(meta5.first)->second)); + EXPECT_EQ(meta6.second, + ToString(server_trailing_metadata.find(meta6.first)->second)); EXPECT_GE(server_trailing_metadata.size(), static_cast(2)); } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 2728dce07e..0d5bf36df7 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -53,6 +53,7 @@ #include "test/core/util/test_config.h" #include "test/cpp/util/echo_duplicate.grpc.pb.h" #include "test/cpp/util/echo.grpc.pb.h" +#include "test/cpp/util/string_ref_helper.h" using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; @@ -152,12 +153,13 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { } if (request->has_param() && request->param().echo_metadata()) { - const std::multimap& client_metadata = + const std::multimap& client_metadata = context->client_metadata(); - for (std::multimap::const_iterator iter = - client_metadata.begin(); + for (std::multimap::const_iterator + iter = client_metadata.begin(); iter != client_metadata.end(); ++iter) { - context->AddTrailingMetadata((*iter).first, (*iter).second); + context->AddTrailingMetadata(ToString(iter->first), + ToString(iter->second)); } } if (request->has_param() && request->param().check_auth_context()) { @@ -182,12 +184,12 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { EchoRequest request; response->set_message(""); int cancel_after_reads = 0; - const std::multimap client_initial_metadata = - context->client_metadata(); + const std::multimap& + client_initial_metadata = context->client_metadata(); if (client_initial_metadata.find(kServerCancelAfterReads) != client_initial_metadata.end()) { - std::istringstream iss( - client_initial_metadata.find(kServerCancelAfterReads)->second); + std::istringstream iss(ToString( + client_initial_metadata.find(kServerCancelAfterReads)->second)); iss >> cancel_after_reads; gpr_log(GPR_INFO, "cancel_after_reads %d", cancel_after_reads); } @@ -721,14 +723,15 @@ TEST_F(End2endTest, RpcMaxMessageSize) { EXPECT_FALSE(s.ok()); } -bool MetadataContains(const std::multimap& metadata, - const grpc::string& key, const grpc::string& value) { +bool MetadataContains( + const std::multimap& metadata, + const grpc::string& key, const grpc::string& value) { int count = 0; - for (std::multimap::const_iterator iter = + for (std::multimap::const_iterator iter = metadata.begin(); iter != metadata.end(); ++iter) { - if ((*iter).first == key && (*iter).second == value) { + if (ToString(iter->first) == key && ToString(iter->second) == value) { count++; } } diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc index d60cee9c02..9a769848a4 100644 --- a/test/cpp/util/cli_call.cc +++ b/test/cpp/util/cli_call.cc @@ -51,14 +51,14 @@ void* tag(int i) { return (void*)(gpr_intptr)i; } Status CliCall::Call(std::shared_ptr channel, const grpc::string& method, const grpc::string& request, - grpc::string* response, const MetadataContainer& metadata, - MetadataContainer* server_initial_metadata, - MetadataContainer* server_trailing_metadata) { + grpc::string* response, + const OutgoingMetadataContainer& metadata, + IncomingMetadataContainer* server_initial_metadata, + IncomingMetadataContainer* server_trailing_metadata) { std::unique_ptr stub(new grpc::GenericStub(channel)); grpc::ClientContext ctx; if (!metadata.empty()) { - for (std::multimap::const_iterator iter = - metadata.begin(); + for (OutgoingMetadataContainer::const_iterator iter = metadata.begin(); iter != metadata.end(); ++iter) { ctx.AddMetadata(iter->first, iter->second); } diff --git a/test/cpp/util/cli_call.h b/test/cpp/util/cli_call.h index 7a3dcf2e9f..2fbc9618b6 100644 --- a/test/cpp/util/cli_call.h +++ b/test/cpp/util/cli_call.h @@ -38,18 +38,22 @@ #include #include +#include namespace grpc { namespace testing { class CliCall GRPC_FINAL { public: - typedef std::multimap MetadataContainer; + typedef std::multimap OutgoingMetadataContainer; + typedef std::multimap + IncomingMetadataContainer; static Status Call(std::shared_ptr channel, const grpc::string& method, const grpc::string& request, - grpc::string* response, const MetadataContainer& metadata, - MetadataContainer* server_initial_metadata, - MetadataContainer* server_trailing_metadata); + grpc::string* response, + const OutgoingMetadataContainer& metadata, + IncomingMetadataContainer* server_initial_metadata, + IncomingMetadataContainer* server_trailing_metadata); }; } // namespace testing diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 35bfad202f..111a0e9f76 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -47,6 +47,7 @@ #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/cpp/util/echo.grpc.pb.h" +#include "test/cpp/util/string_ref_helper.h" using grpc::cpp::test::util::EchoRequest; using grpc::cpp::test::util::EchoResponse; @@ -59,10 +60,11 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { Status Echo(ServerContext* context, const EchoRequest* request, EchoResponse* response) GRPC_OVERRIDE { if (!context->client_metadata().empty()) { - for (std::multimap::const_iterator iter = - context->client_metadata().begin(); + for (std::multimap::const_iterator + iter = context->client_metadata().begin(); iter != context->client_metadata().end(); ++iter) { - context->AddInitialMetadata(iter->first, iter->second); + context->AddInitialMetadata(ToString(iter->first), + ToString(iter->second)); } } context->AddTrailingMetadata("trailing_key", "trailing_value"); @@ -119,8 +121,9 @@ TEST_F(CliCallTest, SimpleRpc) { grpc::string request_bin, response_bin, expected_response_bin; EXPECT_TRUE(request.SerializeToString(&request_bin)); EXPECT_TRUE(response.SerializeToString(&expected_response_bin)); - std::multimap client_metadata, - server_initial_metadata, server_trailing_metadata; + std::multimap client_metadata; + std::multimap server_initial_metadata, + server_trailing_metadata; client_metadata.insert(std::pair("key1", "val1")); Status s2 = CliCall::Call(channel_, kMethod, request_bin, &response_bin, client_metadata, &server_initial_metadata, diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index 746d67deeb..a4888efebe 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -68,8 +68,10 @@ #include #include #include +#include #include "test/cpp/util/cli_call.h" +#include "test/cpp/util/string_ref_helper.h" #include "test/cpp/util/test_config.h" DEFINE_bool(enable_ssl, true, "Whether to use ssl/tls."); @@ -104,16 +106,19 @@ void ParseMetadataFlag( } } -void PrintMetadata(const std::multimap& m, - const grpc::string& message) { +template +void PrintMetadata(const T& m, const grpc::string& message) { if (m.empty()) { return; } std::cout << message << std::endl; - for (std::multimap::const_iterator iter = - m.begin(); - iter != m.end(); ++iter) { - std::cout << iter->first << " : " << iter->second << std::endl; + grpc::string pair; + for (typename T::const_iterator iter = m.begin(); iter != m.end(); ++iter) { + pair.clear(); + pair.append(iter->first.data(), iter->first.size()); + pair.append(" : "); + pair.append(iter->second.data(), iter->second.size()); + std::cout << pair << std::endl; } } @@ -157,8 +162,9 @@ int main(int argc, char** argv) { grpc::CreateChannel(server_address, creds, grpc::ChannelArguments()); grpc::string response; - std::multimap client_metadata, - server_initial_metadata, server_trailing_metadata; + std::multimap client_metadata; + std::multimap server_initial_metadata, + server_trailing_metadata; ParseMetadataFlag(&client_metadata); PrintMetadata(client_metadata, "Sending client initial metadata:"); grpc::Status s = grpc::testing::CliCall::Call( diff --git a/test/cpp/util/string_ref_helper.cc b/test/cpp/util/string_ref_helper.cc new file mode 100644 index 0000000000..4eb4fe0357 --- /dev/null +++ b/test/cpp/util/string_ref_helper.cc @@ -0,0 +1,44 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "test/cpp/util/string_ref_helper.h" + +namespace grpc { +namespace testing { + +grpc::string ToString(const grpc::string_ref& r) { + return grpc::string(r.data(), r.size()); +} + +} // namespace testing +} // namespace grpc diff --git a/test/cpp/util/string_ref_helper.h b/test/cpp/util/string_ref_helper.h new file mode 100644 index 0000000000..ac94bcd018 --- /dev/null +++ b/test/cpp/util/string_ref_helper.h @@ -0,0 +1,47 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPC_TEST_CPP_UTIL_STRING_REF_HELPER_H +#define GRPC_TEST_CPP_UTIL_STRING_REF_HELPER_H + +#include + +namespace grpc { +namespace testing { + +grpc::string ToString(const grpc::string_ref& r); + +} // namespace testing +} // namespace grpc + +#endif // GRPC_TEST_CPP_UTIL_STRING_REF_HELPER_H diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index a7fd884cd8..d4dcc92bde 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -13270,6 +13270,7 @@ "test/cpp/util/echo_duplicate.pb.h", "test/cpp/util/messages.grpc.pb.h", "test/cpp/util/messages.pb.h", + "test/cpp/util/string_ref_helper.h", "test/cpp/util/subprocess.h" ], "language": "c++", @@ -13279,6 +13280,8 @@ "test/cpp/util/cli_call.h", "test/cpp/util/create_test_channel.cc", "test/cpp/util/create_test_channel.h", + "test/cpp/util/string_ref_helper.cc", + "test/cpp/util/string_ref_helper.h", "test/cpp/util/subprocess.cc", "test/cpp/util/subprocess.h" ] diff --git a/vsprojects/Grpc.mak b/vsprojects/Grpc.mak index 2893b72c5d..19cb39741e 100644 --- a/vsprojects/Grpc.mak +++ b/vsprojects/Grpc.mak @@ -4744,8 +4744,8 @@ Debug\grpc++_test_config.lib: $(OUT_DIR) Debug\grpc++_test_util.lib: $(OUT_DIR) echo Building grpc++_test_util - $(CC) $(CXXFLAGS) /Fo:$(OUT_DIR)\ $(REPO_ROOT)\test\cpp\util\cli_call.cc $(REPO_ROOT)\test\cpp\util\create_test_channel.cc $(REPO_ROOT)\test\cpp\util\subprocess.cc $(REPO_ROOT)\test\cpp\util\messages.pb.cc $(REPO_ROOT)\test\cpp\util\messages.grpc.pb.cc $(REPO_ROOT)\test\cpp\util\echo.pb.cc $(REPO_ROOT)\test\cpp\util\echo.grpc.pb.cc $(REPO_ROOT)\test\cpp\util\echo_duplicate.pb.cc $(REPO_ROOT)\test\cpp\util\echo_duplicate.grpc.pb.cc - $(LIBTOOL) /OUT:"Debug\grpc++_test_util.lib" $(OUT_DIR)\cli_call.obj $(OUT_DIR)\create_test_channel.obj $(OUT_DIR)\subprocess.obj $(OUT_DIR)\messages.pb.obj $(OUT_DIR)\messages.grpc.pb.obj $(OUT_DIR)\echo.pb.obj $(OUT_DIR)\echo.grpc.pb.obj $(OUT_DIR)\echo_duplicate.pb.obj $(OUT_DIR)\echo_duplicate.grpc.pb.obj + $(CC) $(CXXFLAGS) /Fo:$(OUT_DIR)\ $(REPO_ROOT)\test\cpp\util\cli_call.cc $(REPO_ROOT)\test\cpp\util\create_test_channel.cc $(REPO_ROOT)\test\cpp\util\string_ref_helper.cc $(REPO_ROOT)\test\cpp\util\subprocess.cc $(REPO_ROOT)\test\cpp\util\messages.pb.cc $(REPO_ROOT)\test\cpp\util\messages.grpc.pb.cc $(REPO_ROOT)\test\cpp\util\echo.pb.cc $(REPO_ROOT)\test\cpp\util\echo.grpc.pb.cc $(REPO_ROOT)\test\cpp\util\echo_duplicate.pb.cc $(REPO_ROOT)\test\cpp\util\echo_duplicate.grpc.pb.cc + $(LIBTOOL) /OUT:"Debug\grpc++_test_util.lib" $(OUT_DIR)\cli_call.obj $(OUT_DIR)\create_test_channel.obj $(OUT_DIR)\string_ref_helper.obj $(OUT_DIR)\subprocess.obj $(OUT_DIR)\messages.pb.obj $(OUT_DIR)\messages.grpc.pb.obj $(OUT_DIR)\echo.pb.obj $(OUT_DIR)\echo.grpc.pb.obj $(OUT_DIR)\echo_duplicate.pb.obj $(OUT_DIR)\echo_duplicate.grpc.pb.obj build_grpc++_unsecure: msbuild grpc.sln /t:grpc++_unsecure /p:Configuration=Debug /p:Linkage-grpc_dependencies_zlib=static -- cgit v1.2.3 From d090fe1379932d7d785fa805339110e70b96bd87 Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 25 Aug 2015 16:53:07 -0700 Subject: auth context api change for string_ref --- Makefile | 12 ++++++------ build.json | 6 ++++++ include/grpc++/support/auth_context.h | 7 ++++--- src/cpp/common/auth_property_iterator.cc | 6 +++--- src/cpp/common/secure_auth_context.cc | 17 +++++++++-------- src/cpp/common/secure_auth_context.h | 6 +++--- test/cpp/common/auth_property_iterator_test.cc | 15 +++++++++------ test/cpp/common/secure_auth_context_test.cc | 25 ++++++++++++++----------- test/cpp/end2end/end2end_test.cc | 15 ++++++++------- tools/run_tests/sources_and_headers.json | 10 ++++++++-- vsprojects/Grpc.mak | 8 ++++---- 11 files changed, 74 insertions(+), 53 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 77cb62086b..e872da981b 100644 --- a/Makefile +++ b/Makefile @@ -8945,16 +8945,16 @@ $(BINDIR)/$(CONFIG)/auth_property_iterator_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/auth_property_iterator_test: $(PROTOBUF_DEP) $(AUTH_PROPERTY_ITERATOR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(BINDIR)/$(CONFIG)/auth_property_iterator_test: $(PROTOBUF_DEP) $(AUTH_PROPERTY_ITERATOR_TEST_OBJS) $(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) $(AUTH_PROPERTY_ITERATOR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/auth_property_iterator_test + $(Q) $(LDXX) $(LDFLAGS) $(AUTH_PROPERTY_ITERATOR_TEST_OBJS) $(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)/auth_property_iterator_test endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/common/auth_property_iterator_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/test/cpp/common/auth_property_iterator_test.o: $(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_auth_property_iterator_test: $(AUTH_PROPERTY_ITERATOR_TEST_OBJS:.o=.dep) ifneq ($(NO_SECURE),true) @@ -10155,16 +10155,16 @@ $(BINDIR)/$(CONFIG)/secure_auth_context_test: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/secure_auth_context_test: $(PROTOBUF_DEP) $(SECURE_AUTH_CONTEXT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(BINDIR)/$(CONFIG)/secure_auth_context_test: $(PROTOBUF_DEP) $(SECURE_AUTH_CONTEXT_TEST_OBJS) $(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) $(SECURE_AUTH_CONTEXT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/secure_auth_context_test + $(Q) $(LDXX) $(LDFLAGS) $(SECURE_AUTH_CONTEXT_TEST_OBJS) $(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)/secure_auth_context_test endif endif -$(OBJDIR)/$(CONFIG)/test/cpp/common/secure_auth_context_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a +$(OBJDIR)/$(CONFIG)/test/cpp/common/secure_auth_context_test.o: $(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_secure_auth_context_test: $(SECURE_AUTH_CONTEXT_TEST_OBJS:.o=.dep) ifneq ($(NO_SECURE),true) diff --git a/build.json b/build.json index c974250d7c..56f14c6590 100644 --- a/build.json +++ b/build.json @@ -2020,8 +2020,11 @@ "test/cpp/common/auth_property_iterator_test.cc" ], "deps": [ + "grpc++_test_util", + "grpc_test_util", "grpc++", "grpc", + "gpr_test_util", "gpr" ] }, @@ -2572,8 +2575,11 @@ "test/cpp/common/secure_auth_context_test.cc" ], "deps": [ + "grpc++_test_util", + "grpc_test_util", "grpc++", "grpc", + "gpr_test_util", "gpr" ] }, diff --git a/include/grpc++/support/auth_context.h b/include/grpc++/support/auth_context.h index f4f2dcf5bb..67e3e66c05 100644 --- a/include/grpc++/support/auth_context.h +++ b/include/grpc++/support/auth_context.h @@ -38,6 +38,7 @@ #include #include +#include struct grpc_auth_context; struct grpc_auth_property; @@ -46,7 +47,7 @@ struct grpc_auth_property_iterator; namespace grpc { class SecureAuthContext; -typedef std::pair AuthProperty; +typedef std::pair AuthProperty; class AuthPropertyIterator : public std::iterator { @@ -78,11 +79,11 @@ class AuthContext { // A peer identity, in general is one or more properties (in which case they // have the same name). - virtual std::vector GetPeerIdentity() const = 0; + virtual std::vector GetPeerIdentity() const = 0; virtual grpc::string GetPeerIdentityPropertyName() const = 0; // Returns all the property values with the given name. - virtual std::vector FindPropertyValues( + virtual std::vector FindPropertyValues( const grpc::string& name) const = 0; // Iteration over all the properties. diff --git a/src/cpp/common/auth_property_iterator.cc b/src/cpp/common/auth_property_iterator.cc index 5ccf8cf72c..fa6da9d7a8 100644 --- a/src/cpp/common/auth_property_iterator.cc +++ b/src/cpp/common/auth_property_iterator.cc @@ -77,9 +77,9 @@ bool AuthPropertyIterator::operator!=(const AuthPropertyIterator& rhs) const { } const AuthProperty AuthPropertyIterator::operator*() { - return std::make_pair( - grpc::string(property_->name), - grpc::string(property_->value, property_->value_length)); + return std::pair( + property_->name, + grpc::string_ref(property_->value, property_->value_length)); } } // namespace grpc diff --git a/src/cpp/common/secure_auth_context.cc b/src/cpp/common/secure_auth_context.cc index 87d7bab75c..b18a8537c9 100644 --- a/src/cpp/common/secure_auth_context.cc +++ b/src/cpp/common/secure_auth_context.cc @@ -41,15 +41,16 @@ SecureAuthContext::SecureAuthContext(grpc_auth_context* ctx) : ctx_(ctx) {} SecureAuthContext::~SecureAuthContext() { grpc_auth_context_release(ctx_); } -std::vector SecureAuthContext::GetPeerIdentity() const { +std::vector SecureAuthContext::GetPeerIdentity() const { if (!ctx_) { - return std::vector(); + return std::vector(); } grpc_auth_property_iterator iter = grpc_auth_context_peer_identity(ctx_); - std::vector identity; + std::vector identity; const grpc_auth_property* property = nullptr; while ((property = grpc_auth_property_iterator_next(&iter))) { - identity.push_back(grpc::string(property->value, property->value_length)); + identity.push_back( + grpc::string_ref(property->value, property->value_length)); } return identity; } @@ -62,17 +63,17 @@ grpc::string SecureAuthContext::GetPeerIdentityPropertyName() const { return name == nullptr ? "" : name; } -std::vector SecureAuthContext::FindPropertyValues( +std::vector SecureAuthContext::FindPropertyValues( const grpc::string& name) const { if (!ctx_) { - return std::vector(); + return std::vector(); } grpc_auth_property_iterator iter = grpc_auth_context_find_properties_by_name(ctx_, name.c_str()); const grpc_auth_property* property = nullptr; - std::vector values; + std::vector values; while ((property = grpc_auth_property_iterator_next(&iter))) { - values.push_back(grpc::string(property->value, property->value_length)); + values.push_back(grpc::string_ref(property->value, property->value_length)); } return values; } diff --git a/src/cpp/common/secure_auth_context.h b/src/cpp/common/secure_auth_context.h index 01b7126189..7f622b890b 100644 --- a/src/cpp/common/secure_auth_context.h +++ b/src/cpp/common/secure_auth_context.h @@ -46,12 +46,12 @@ class SecureAuthContext GRPC_FINAL : public AuthContext { ~SecureAuthContext() GRPC_OVERRIDE; - std::vector GetPeerIdentity() const GRPC_OVERRIDE; + std::vector GetPeerIdentity() const GRPC_OVERRIDE; grpc::string GetPeerIdentityPropertyName() const GRPC_OVERRIDE; - std::vector FindPropertyValues(const grpc::string& name) const - GRPC_OVERRIDE; + std::vector FindPropertyValues( + const grpc::string& name) const GRPC_OVERRIDE; AuthPropertyIterator begin() const GRPC_OVERRIDE; diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc index 630c38c7f6..e6226d6a09 100644 --- a/test/cpp/common/auth_property_iterator_test.cc +++ b/test/cpp/common/auth_property_iterator_test.cc @@ -35,11 +35,14 @@ #include #include #include "src/cpp/common/secure_auth_context.h" +#include "test/cpp/util/string_ref_helper.h" extern "C" { #include "src/core/security/security_context.h" } +using ::grpc::testing::ToString; + namespace grpc { namespace { @@ -84,12 +87,12 @@ TEST_F(AuthPropertyIteratorTest, GeneralTest) { AuthProperty p1 = *iter; iter++; AuthProperty p2 = *iter; - EXPECT_EQ("name", p0.first); - EXPECT_EQ("chapi", p0.second); - EXPECT_EQ("name", p1.first); - EXPECT_EQ("chapo", p1.second); - EXPECT_EQ("foo", p2.first); - EXPECT_EQ("bar", p2.second); + EXPECT_EQ("name", ToString(p0.first)); + EXPECT_EQ("chapi", ToString(p0.second)); + EXPECT_EQ("name", ToString(p1.first)); + EXPECT_EQ("chapo", ToString(p1.second)); + EXPECT_EQ("foo", ToString(p2.first)); + EXPECT_EQ("bar", ToString(p2.second)); ++iter; EXPECT_EQ(empty_iter, iter); } diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc index c71ef58023..25538c1853 100644 --- a/test/cpp/common/secure_auth_context_test.cc +++ b/test/cpp/common/secure_auth_context_test.cc @@ -35,11 +35,14 @@ #include #include #include "src/cpp/common/secure_auth_context.h" +#include "test/cpp/util/string_ref_helper.h" extern "C" { #include "src/core/security/security_context.h" } +using grpc::testing::ToString; + namespace grpc { namespace { @@ -63,14 +66,14 @@ TEST_F(SecureAuthContextTest, Properties) { EXPECT_EQ(1, grpc_auth_context_set_peer_identity_property_name(ctx, "name")); SecureAuthContext context(ctx); - std::vector peer_identity = context.GetPeerIdentity(); + std::vector peer_identity = context.GetPeerIdentity(); EXPECT_EQ(2u, peer_identity.size()); - EXPECT_EQ("chapi", peer_identity[0]); - EXPECT_EQ("chapo", peer_identity[1]); + EXPECT_EQ("chapi", ToString(peer_identity[0])); + EXPECT_EQ("chapo", ToString(peer_identity[1])); EXPECT_EQ("name", context.GetPeerIdentityPropertyName()); - std::vector bar = context.FindPropertyValues("foo"); + std::vector bar = context.FindPropertyValues("foo"); EXPECT_EQ(1u, bar.size()); - EXPECT_EQ("bar", bar[0]); + EXPECT_EQ("bar", ToString(bar[0])); } TEST_F(SecureAuthContextTest, Iterators) { @@ -88,12 +91,12 @@ TEST_F(SecureAuthContextTest, Iterators) { AuthProperty p1 = *iter; iter++; AuthProperty p2 = *iter; - EXPECT_EQ("name", p0.first); - EXPECT_EQ("chapi", p0.second); - EXPECT_EQ("name", p1.first); - EXPECT_EQ("chapo", p1.second); - EXPECT_EQ("foo", p2.first); - EXPECT_EQ("bar", p2.second); + EXPECT_EQ("name", ToString(p0.first)); + EXPECT_EQ("chapi", ToString(p0.second)); + EXPECT_EQ("name", ToString(p1.first)); + EXPECT_EQ("chapo", ToString(p1.second)); + EXPECT_EQ("foo", ToString(p2.first)); + EXPECT_EQ("bar", ToString(p2.second)); ++iter; EXPECT_EQ(context.end(), iter); } diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 0d5bf36df7..9826837c60 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -81,10 +81,10 @@ void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request, void CheckServerAuthContext(const ServerContext* context) { std::shared_ptr auth_ctx = context->auth_context(); - std::vector ssl = + std::vector ssl = auth_ctx->FindPropertyValues("transport_security_type"); EXPECT_EQ(1u, ssl.size()); - EXPECT_EQ("ssl", ssl[0]); + EXPECT_EQ("ssl", ToString(ssl[0])); EXPECT_TRUE(auth_ctx->GetPeerIdentityPropertyName().empty()); EXPECT_TRUE(auth_ctx->GetPeerIdentity().empty()); } @@ -840,16 +840,17 @@ TEST_F(End2endTest, ClientAuthContext) { EXPECT_TRUE(s.ok()); std::shared_ptr auth_ctx = context.auth_context(); - std::vector ssl = + std::vector ssl = auth_ctx->FindPropertyValues("transport_security_type"); EXPECT_EQ(1u, ssl.size()); - EXPECT_EQ("ssl", ssl[0]); + EXPECT_EQ("ssl", ToString(ssl[0])); EXPECT_EQ("x509_subject_alternative_name", auth_ctx->GetPeerIdentityPropertyName()); EXPECT_EQ(3u, auth_ctx->GetPeerIdentity().size()); - EXPECT_EQ("*.test.google.fr", auth_ctx->GetPeerIdentity()[0]); - EXPECT_EQ("waterzooi.test.google.be", auth_ctx->GetPeerIdentity()[1]); - EXPECT_EQ("*.test.youtube.com", auth_ctx->GetPeerIdentity()[2]); + EXPECT_EQ("*.test.google.fr", ToString(auth_ctx->GetPeerIdentity()[0])); + EXPECT_EQ("waterzooi.test.google.be", + ToString(auth_ctx->GetPeerIdentity()[1])); + EXPECT_EQ("*.test.youtube.com", ToString(auth_ctx->GetPeerIdentity()[2])); } // Make the response larger than the flow control window. diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index a89e5340ed..5facf582ce 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -1068,8 +1068,11 @@ { "deps": [ "gpr", + "gpr_test_util", "grpc", - "grpc++" + "grpc++", + "grpc++_test_util", + "grpc_test_util" ], "headers": [], "language": "c++", @@ -1573,8 +1576,11 @@ { "deps": [ "gpr", + "gpr_test_util", "grpc", - "grpc++" + "grpc++", + "grpc++_test_util", + "grpc_test_util" ], "headers": [], "language": "c++", diff --git a/vsprojects/Grpc.mak b/vsprojects/Grpc.mak index 19cb39741e..ad390e7cda 100644 --- a/vsprojects/Grpc.mak +++ b/vsprojects/Grpc.mak @@ -615,10 +615,10 @@ async_end2end_test: async_end2end_test.exe echo Running async_end2end_test $(OUT_DIR)\async_end2end_test.exe -auth_property_iterator_test.exe: build_grpc++ build_grpc build_gpr $(OUT_DIR) +auth_property_iterator_test.exe: Debug\grpc++_test_util.lib build_grpc_test_util build_grpc++ build_grpc build_gpr_test_util build_gpr $(OUT_DIR) echo Building auth_property_iterator_test $(CC) $(CXXFLAGS) /Fo:$(OUT_DIR)\ $(REPO_ROOT)\test\cpp\common\auth_property_iterator_test.cc - $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\auth_property_iterator_test.exe" Debug\grpc++.lib Debug\grpc.lib Debug\gpr.lib $(CXX_LIBS) $(LIBS) $(OUT_DIR)\auth_property_iterator_test.obj + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\auth_property_iterator_test.exe" Debug\grpc++_test_util.lib Debug\grpc_test_util.lib Debug\grpc++.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(CXX_LIBS) $(LIBS) $(OUT_DIR)\auth_property_iterator_test.obj auth_property_iterator_test: auth_property_iterator_test.exe echo Running auth_property_iterator_test $(OUT_DIR)\auth_property_iterator_test.exe @@ -751,10 +751,10 @@ reconnect_interop_server: reconnect_interop_server.exe echo Running reconnect_interop_server $(OUT_DIR)\reconnect_interop_server.exe -secure_auth_context_test.exe: build_grpc++ build_grpc build_gpr $(OUT_DIR) +secure_auth_context_test.exe: Debug\grpc++_test_util.lib build_grpc_test_util build_grpc++ build_grpc build_gpr_test_util build_gpr $(OUT_DIR) echo Building secure_auth_context_test $(CC) $(CXXFLAGS) /Fo:$(OUT_DIR)\ $(REPO_ROOT)\test\cpp\common\secure_auth_context_test.cc - $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\secure_auth_context_test.exe" Debug\grpc++.lib Debug\grpc.lib Debug\gpr.lib $(CXX_LIBS) $(LIBS) $(OUT_DIR)\secure_auth_context_test.obj + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\secure_auth_context_test.exe" Debug\grpc++_test_util.lib Debug\grpc_test_util.lib Debug\grpc++.lib Debug\grpc.lib Debug\gpr_test_util.lib Debug\gpr.lib $(CXX_LIBS) $(LIBS) $(OUT_DIR)\secure_auth_context_test.obj secure_auth_context_test: secure_auth_context_test.exe echo Running secure_auth_context_test $(OUT_DIR)\secure_auth_context_test.exe -- cgit v1.2.3 From 12577a7f7f1f50a0af6c98eca8767e450473329c Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 27 Aug 2015 16:20:44 -0700 Subject: Fix build --- Makefile | 223 ------------------------------- build.json | 73 ---------- tools/run_tests/sources_and_headers.json | 76 ----------- 3 files changed, 372 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 543bc0952b..135d38ccd8 100644 --- a/Makefile +++ b/Makefile @@ -875,9 +875,6 @@ interop_client: $(BINDIR)/$(CONFIG)/interop_client interop_server: $(BINDIR)/$(CONFIG)/interop_server interop_test: $(BINDIR)/$(CONFIG)/interop_test mock_test: $(BINDIR)/$(CONFIG)/mock_test -pubsub_client: $(BINDIR)/$(CONFIG)/pubsub_client -pubsub_publisher_test: $(BINDIR)/$(CONFIG)/pubsub_publisher_test -pubsub_subscriber_test: $(BINDIR)/$(CONFIG)/pubsub_subscriber_test qps_driver: $(BINDIR)/$(CONFIG)/qps_driver qps_interarrival_test: $(BINDIR)/$(CONFIG)/qps_interarrival_test qps_openloop_test: $(BINDIR)/$(CONFIG)/qps_openloop_test @@ -3488,51 +3485,6 @@ $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc: $(Q) mkdir -p $(@D) $(Q) echo "$(GRPCXX_UNSECURE_PC_FILE)" | tr , '\n' >$@ -ifeq ($(NO_PROTOC),true) -$(GENDIR)/examples/pubsub/empty.pb.cc: protoc_dep_error -$(GENDIR)/examples/pubsub/empty.grpc.pb.cc: protoc_dep_error -else -$(GENDIR)/examples/pubsub/empty.pb.cc: examples/pubsub/empty.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) - $(E) "[PROTOC] Generating protobuf CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< - -$(GENDIR)/examples/pubsub/empty.grpc.pb.cc: examples/pubsub/empty.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) - $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< -endif - -ifeq ($(NO_PROTOC),true) -$(GENDIR)/examples/pubsub/label.pb.cc: protoc_dep_error -$(GENDIR)/examples/pubsub/label.grpc.pb.cc: protoc_dep_error -else -$(GENDIR)/examples/pubsub/label.pb.cc: examples/pubsub/label.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) - $(E) "[PROTOC] Generating protobuf CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< - -$(GENDIR)/examples/pubsub/label.grpc.pb.cc: examples/pubsub/label.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) - $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< -endif - -ifeq ($(NO_PROTOC),true) -$(GENDIR)/examples/pubsub/pubsub.pb.cc: protoc_dep_error -$(GENDIR)/examples/pubsub/pubsub.grpc.pb.cc: protoc_dep_error -else -$(GENDIR)/examples/pubsub/pubsub.pb.cc: examples/pubsub/pubsub.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) - $(E) "[PROTOC] Generating protobuf CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< - -$(GENDIR)/examples/pubsub/pubsub.grpc.pb.cc: examples/pubsub/pubsub.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) - $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" - $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< -endif - ifeq ($(NO_PROTOC),true) $(GENDIR)/test/cpp/qps/perf_db.pb.cc: protoc_dep_error $(GENDIR)/test/cpp/qps/perf_db.grpc.pb.cc: protoc_dep_error @@ -5205,59 +5157,6 @@ endif $(OBJDIR)/$(CONFIG)/test/cpp/interop/server.o: $(GENDIR)/test/proto/empty.pb.cc $(GENDIR)/test/proto/empty.grpc.pb.cc $(GENDIR)/test/proto/messages.pb.cc $(GENDIR)/test/proto/messages.grpc.pb.cc $(GENDIR)/test/proto/test.pb.cc $(GENDIR)/test/proto/test.grpc.pb.cc -LIBPUBSUB_CLIENT_LIB_SRC = \ - $(GENDIR)/examples/pubsub/label.pb.cc $(GENDIR)/examples/pubsub/label.grpc.pb.cc \ - $(GENDIR)/examples/pubsub/empty.pb.cc $(GENDIR)/examples/pubsub/empty.grpc.pb.cc \ - $(GENDIR)/examples/pubsub/pubsub.pb.cc $(GENDIR)/examples/pubsub/pubsub.grpc.pb.cc \ - examples/pubsub/publisher.cc \ - examples/pubsub/subscriber.cc \ - - -LIBPUBSUB_CLIENT_LIB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBPUBSUB_CLIENT_LIB_SRC)))) - -ifeq ($(NO_SECURE),true) - -# You can't build secure libraries if you don't have OpenSSL. - -$(LIBDIR)/$(CONFIG)/libpubsub_client_lib.a: openssl_dep_error - - -else - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libpubsub_client_lib.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libpubsub_client_lib.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(PROTOBUF_DEP) $(LIBPUBSUB_CLIENT_LIB_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.a - $(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.a $(LIBPUBSUB_CLIENT_LIB_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.a -endif - - - - -endif - -endif - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(LIBPUBSUB_CLIENT_LIB_OBJS:.o=.dep) -endif -endif -$(OBJDIR)/$(CONFIG)/examples/pubsub/publisher.o: $(GENDIR)/examples/pubsub/label.pb.cc $(GENDIR)/examples/pubsub/label.grpc.pb.cc $(GENDIR)/examples/pubsub/empty.pb.cc $(GENDIR)/examples/pubsub/empty.grpc.pb.cc $(GENDIR)/examples/pubsub/pubsub.pb.cc $(GENDIR)/examples/pubsub/pubsub.grpc.pb.cc -$(OBJDIR)/$(CONFIG)/examples/pubsub/subscriber.o: $(GENDIR)/examples/pubsub/label.pb.cc $(GENDIR)/examples/pubsub/label.grpc.pb.cc $(GENDIR)/examples/pubsub/empty.pb.cc $(GENDIR)/examples/pubsub/empty.grpc.pb.cc $(GENDIR)/examples/pubsub/pubsub.pb.cc $(GENDIR)/examples/pubsub/pubsub.grpc.pb.cc - - LIBQPS_SRC = \ $(GENDIR)/test/cpp/qps/qpstest.pb.cc $(GENDIR)/test/cpp/qps/qpstest.grpc.pb.cc \ $(GENDIR)/test/cpp/qps/perf_db.pb.cc $(GENDIR)/test/cpp/qps/perf_db.grpc.pb.cc \ @@ -9752,126 +9651,6 @@ endif endif -PUBSUB_CLIENT_SRC = \ - examples/pubsub/main.cc \ - -PUBSUB_CLIENT_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(PUBSUB_CLIENT_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/pubsub_client: 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)/pubsub_client: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/pubsub_client: $(PROTOBUF_DEP) $(PUBSUB_CLIENT_OBJS) $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.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 $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(PUBSUB_CLIENT_OBJS) $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.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 $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/pubsub_client - -endif - -endif - -$(OBJDIR)/$(CONFIG)/examples/pubsub/main.o: $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.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 $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a -deps_pubsub_client: $(PUBSUB_CLIENT_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(PUBSUB_CLIENT_OBJS:.o=.dep) -endif -endif - - -PUBSUB_PUBLISHER_TEST_SRC = \ - examples/pubsub/publisher_test.cc \ - -PUBSUB_PUBLISHER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(PUBSUB_PUBLISHER_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/pubsub_publisher_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)/pubsub_publisher_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/pubsub_publisher_test: $(PROTOBUF_DEP) $(PUBSUB_PUBLISHER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.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) $(PUBSUB_PUBLISHER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.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) -o $(BINDIR)/$(CONFIG)/pubsub_publisher_test - -endif - -endif - -$(OBJDIR)/$(CONFIG)/examples/pubsub/publisher_test.o: $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.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_pubsub_publisher_test: $(PUBSUB_PUBLISHER_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(PUBSUB_PUBLISHER_TEST_OBJS:.o=.dep) -endif -endif - - -PUBSUB_SUBSCRIBER_TEST_SRC = \ - examples/pubsub/subscriber_test.cc \ - -PUBSUB_SUBSCRIBER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(PUBSUB_SUBSCRIBER_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/pubsub_subscriber_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)/pubsub_subscriber_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/pubsub_subscriber_test: $(PROTOBUF_DEP) $(PUBSUB_SUBSCRIBER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.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) $(PUBSUB_SUBSCRIBER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.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) -o $(BINDIR)/$(CONFIG)/pubsub_subscriber_test - -endif - -endif - -$(OBJDIR)/$(CONFIG)/examples/pubsub/subscriber_test.o: $(LIBDIR)/$(CONFIG)/libpubsub_client_lib.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_pubsub_subscriber_test: $(PUBSUB_SUBSCRIBER_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(PUBSUB_SUBSCRIBER_TEST_OBJS:.o=.dep) -endif -endif - - QPS_DRIVER_SRC = \ test/cpp/qps/qps_driver.cc \ @@ -20646,8 +20425,6 @@ ifneq ($(OPENSSL_DEP),) # This is to ensure the embedded OpenSSL is built beforehand, properly # installing headers to their final destination on the drive. We need this # otherwise parallel compilation will fail if a source is compiled first. -examples/pubsub/publisher.cc: $(OPENSSL_DEP) -examples/pubsub/subscriber.cc: $(OPENSSL_DEP) src/core/httpcli/httpcli_security_connector.c: $(OPENSSL_DEP) src/core/security/base64.c: $(OPENSSL_DEP) src/core/security/client_auth_filter.c: $(OPENSSL_DEP) diff --git a/build.json b/build.json index a5be837f66..a451fc342f 100644 --- a/build.json +++ b/build.json @@ -813,27 +813,6 @@ "grpc++_test_config" ] }, - { - "name": "pubsub_client_lib", - "build": "do_not_build", - "language": "c++", - "headers": [ - "examples/pubsub/publisher.h", - "examples/pubsub/subscriber.h" - ], - "src": [ - "examples/pubsub/label.proto", - "examples/pubsub/empty.proto", - "examples/pubsub/pubsub.proto", - "examples/pubsub/publisher.cc", - "examples/pubsub/subscriber.cc" - ], - "deps": [ - "grpc++", - "grpc", - "gpr" - ] - }, { "name": "qps", "build": "private", @@ -2369,58 +2348,6 @@ "gpr" ] }, - { - "name": "pubsub_client", - "build": "do_not_build", - "run": false, - "language": "c++", - "src": [ - "examples/pubsub/main.cc" - ], - "deps": [ - "pubsub_client_lib", - "grpc_test_util", - "grpc++", - "grpc", - "gpr_test_util", - "gpr", - "grpc++_test_config" - ] - }, - { - "name": "pubsub_publisher_test", - "build": "do_not_build", - "language": "c++", - "src": [ - "examples/pubsub/publisher_test.cc" - ], - "deps": [ - "pubsub_client_lib", - "grpc++_test_util", - "grpc_test_util", - "grpc++", - "grpc", - "gpr_test_util", - "gpr" - ] - }, - { - "name": "pubsub_subscriber_test", - "build": "do_not_build", - "language": "c++", - "src": [ - "examples/pubsub/subscriber_test.cc" - ], - "deps": [ - "pubsub_client_lib", - "grpc++_test_util", - "grpc_test_util", - "grpc++", - "grpc", - "gpr_test_util", - "gpr" - ] - }, { "name": "qps_driver", "build": "benchmark", diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 42942e4e0c..0585b8268f 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -1388,57 +1388,6 @@ "test/cpp/end2end/mock_test.cc" ] }, - { - "deps": [ - "gpr", - "gpr_test_util", - "grpc", - "grpc++", - "grpc++_test_config", - "grpc_test_util", - "pubsub_client_lib" - ], - "headers": [], - "language": "c++", - "name": "pubsub_client", - "src": [ - "examples/pubsub/main.cc" - ] - }, - { - "deps": [ - "gpr", - "gpr_test_util", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util", - "pubsub_client_lib" - ], - "headers": [], - "language": "c++", - "name": "pubsub_publisher_test", - "src": [ - "examples/pubsub/publisher_test.cc" - ] - }, - { - "deps": [ - "gpr", - "gpr_test_util", - "grpc", - "grpc++", - "grpc++_test_util", - "grpc_test_util", - "pubsub_client_lib" - ], - "headers": [], - "language": "c++", - "name": "pubsub_subscriber_test", - "src": [ - "examples/pubsub/subscriber_test.cc" - ] - }, { "deps": [ "gpr", @@ -13570,31 +13519,6 @@ "test/cpp/interop/server.cc" ] }, - { - "deps": [ - "gpr", - "grpc", - "grpc++" - ], - "headers": [ - "examples/pubsub/empty.grpc.pb.h", - "examples/pubsub/empty.pb.h", - "examples/pubsub/label.grpc.pb.h", - "examples/pubsub/label.pb.h", - "examples/pubsub/publisher.h", - "examples/pubsub/pubsub.grpc.pb.h", - "examples/pubsub/pubsub.pb.h", - "examples/pubsub/subscriber.h" - ], - "language": "c++", - "name": "pubsub_client_lib", - "src": [ - "examples/pubsub/publisher.cc", - "examples/pubsub/publisher.h", - "examples/pubsub/subscriber.cc", - "examples/pubsub/subscriber.h" - ] - }, { "deps": [ "grpc++", -- cgit v1.2.3