diff options
author | Guantao Liu <guantaol@google.com> | 2017-07-13 18:29:18 -0700 |
---|---|---|
committer | Guantao Liu <guantaol@google.com> | 2017-07-13 18:29:18 -0700 |
commit | e72b5d6ab8a48181919181b5bdb4327ba263d07f (patch) | |
tree | 1fdebebf96c4bde01d984f353bf63489fab9cd6c /test/cpp | |
parent | abe3cf51f02d48b28fd67d78e7a3060d763148b5 (diff) | |
parent | bd4439c4a63e5d3aa0bacc5d724ede28de7903e7 (diff) |
Merge remote-tracking branch 'upstream/master' into qps_driver to resolve conflicts.
Diffstat (limited to 'test/cpp')
-rw-r--r-- | test/cpp/OWNERS | 4 | ||||
-rw-r--r-- | test/cpp/codegen/BUILD | 7 | ||||
-rw-r--r-- | test/cpp/common/BUILD | 7 | ||||
-rw-r--r-- | test/cpp/end2end/BUILD | 9 | ||||
-rw-r--r-- | test/cpp/end2end/grpclb_end2end_test.cc | 3 | ||||
-rw-r--r-- | test/cpp/end2end/mock_test.cc | 6 | ||||
-rw-r--r-- | test/cpp/interop/BUILD | 81 | ||||
-rw-r--r-- | test/cpp/microbenchmarks/BUILD | 7 | ||||
-rw-r--r-- | test/cpp/qps/BUILD | 14 | ||||
-rw-r--r-- | test/cpp/qps/OWNERS | 2 | ||||
-rw-r--r-- | test/cpp/qps/benchmark_config.cc | 4 | ||||
-rw-r--r-- | test/cpp/qps/benchmark_config.h | 3 | ||||
-rw-r--r-- | test/cpp/qps/client_sync.cc | 2 | ||||
-rw-r--r-- | test/cpp/qps/qps_interarrival_test.cc | 3 | ||||
-rw-r--r-- | test/cpp/qps/qps_openloop_test.cc | 3 | ||||
-rw-r--r-- | test/cpp/qps/qps_test.cc | 64 | ||||
-rw-r--r-- | test/cpp/qps/secure_sync_unary_ping_pong_test.cc | 3 | ||||
-rw-r--r-- | test/cpp/util/BUILD | 22 |
18 files changed, 148 insertions, 96 deletions
diff --git a/test/cpp/OWNERS b/test/cpp/OWNERS new file mode 100644 index 0000000000..8dca75ce91 --- /dev/null +++ b/test/cpp/OWNERS @@ -0,0 +1,4 @@ +@ctiller +@markdroth +@dgquintas + diff --git a/test/cpp/codegen/BUILD b/test/cpp/codegen/BUILD index 984440e455..4780800645 100644 --- a/test/cpp/codegen/BUILD +++ b/test/cpp/codegen/BUILD @@ -16,6 +16,13 @@ licenses(["notice"]) # Apache v2 load("//bazel:grpc_build_system.bzl", "grpc_cc_test") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "codegen_test_full", srcs = ["codegen_test_full.cc"], diff --git a/test/cpp/common/BUILD b/test/cpp/common/BUILD index ae287a4c93..bd1173322a 100644 --- a/test/cpp/common/BUILD +++ b/test/cpp/common/BUILD @@ -16,6 +16,13 @@ licenses(["notice"]) # Apache v2 load("//bazel:grpc_build_system.bzl", "grpc_cc_test") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "alarm_cpp_test", srcs = ["alarm_cpp_test.cc"], diff --git a/test/cpp/end2end/BUILD b/test/cpp/end2end/BUILD index ac742c2921..27c5492c17 100644 --- a/test/cpp/end2end/BUILD +++ b/test/cpp/end2end/BUILD @@ -16,10 +16,17 @@ licenses(["notice"]) # Apache v2 load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test") -package(default_visibility=["//visibility:public"]) # Allows external users to implement end2end tests. +package( + default_visibility=["//visibility:public"], # Allows external users to implement end2end tests. + features = [ + "-layering_check", + "-parse_headers", + ], +) grpc_cc_library( name = "test_service_impl", + testonly = True, srcs = ["test_service_impl.cc"], hdrs = ["test_service_impl.h"], deps = [ diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index 4f839f7788..a8ac631fbd 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -32,7 +32,6 @@ #include <grpc/support/string_util.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <gtest/gtest.h> extern "C" { #include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h" @@ -46,6 +45,8 @@ extern "C" { #include "src/proto/grpc/lb/v1/load_balancer.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" +#include <gtest/gtest.h> + // TODO(dgq): Other scenarios in need of testing: // - Send a serverlist with faulty ip:port addresses (port > 2^16, etc). // - Test reception of invalid serverlist diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index 8ca91363d8..0b63c25055 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -19,7 +19,6 @@ #include <climits> #include <thread> -#include <gmock/gmock.h> #include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> @@ -31,14 +30,15 @@ #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <grpc++/test/mock_stream.h> - #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "src/proto/grpc/testing/echo_mock.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" +#include <grpc++/test/mock_stream.h> + +#include <gmock/gmock.h> #include <gtest/gtest.h> #include <iostream> diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index 93e01fee4b..0de5a6f4da 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -14,7 +14,16 @@ licenses(["notice"]) # Apache v2 -cc_library( +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary") + +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + +grpc_cc_library( name = "server_helper_lib", srcs = [ "server_helper.cc", @@ -22,21 +31,35 @@ cc_library( hdrs = [ "server_helper.h", ], + external_deps = [ + "gflags", + ], + language = "C++", deps = [ "//test/cpp/util:test_util", - "//external:gflags", ], ) -cc_binary( +grpc_cc_binary( name = "interop_server", srcs = [ - "interop_server.cc", "interop_server_bootstrap.cc", ], + language = "C++", deps = [ - ":server_helper_lib", + ":interop_server_lib", "//:grpc++", + ], +) + +grpc_cc_library( + name = "interop_server_lib", + srcs = [ + "interop_server.cc", + ], + language = "C++", + deps = [ + ":server_helper_lib", "//src/proto/grpc/testing:empty_proto", "//src/proto/grpc/testing:messages_proto", "//src/proto/grpc/testing:test_proto", @@ -44,7 +67,7 @@ cc_binary( ], ) -cc_library( +grpc_cc_library( name = "client_helper_lib", srcs = [ "client_helper.cc", @@ -54,22 +77,64 @@ cc_library( "client_helper.h", "interop_client.h", ], + language = "C++", deps = [ - "//test/cpp/util:test_util", "//src/proto/grpc/testing:empty_proto", "//src/proto/grpc/testing:messages_proto", "//src/proto/grpc/testing:test_proto", "//test/core/security:oauth2_utils", "//test/cpp/util:test_config", + "//test/cpp/util:test_util", ], ) -cc_binary( +grpc_cc_binary( name = "interop_client", srcs = [ "client.cc", ], deps = [ ":client_helper_lib", + "//:grpc++", + ], +) + +grpc_cc_binary( + name = "reconnect_interop_client", + srcs = [ + "reconnect_interop_client.cc", + ], + deps = [ + ":client_helper_lib", + "//:grpc++", + "//test/core/util:grpc_test_util", + ], +) + +grpc_cc_binary( + name = "reconnect_interop_server", + srcs = [ + "reconnect_interop_server.cc", + ], + language = "C++", + deps = [ + ":interop_server_lib", + "//:grpc++", + "//test/core/util:grpc_test_util", + ], +) + +grpc_cc_binary( + name = "stress_test", + srcs = [ + "stress_interop_client.cc", + "stress_interop_client.h", + "stress_test.cc", + ], + deps = [ + ":client_helper_lib", + "//:grpc++", + "//test/cpp/util:metrics_server_lib", + "//test/cpp/util:test_config", ], ) diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD index 10df1cb781..5e1bcee89f 100644 --- a/test/cpp/microbenchmarks/BUILD +++ b/test/cpp/microbenchmarks/BUILD @@ -16,6 +16,13 @@ licenses(["notice"]) # Apache v2 load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_test( name = "noop-benchmark", srcs = ["noop-benchmark.cc"], diff --git a/test/cpp/qps/BUILD b/test/cpp/qps/BUILD index a3f70cf8b5..e24aa0cd0a 100644 --- a/test/cpp/qps/BUILD +++ b/test/cpp/qps/BUILD @@ -16,6 +16,13 @@ licenses(["notice"]) # Apache v2 load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_cc_library", "grpc_cc_binary") +package( + features = [ + "-layering_check", + "-parse_headers", + ], +) + grpc_cc_library( name = "parse_json", srcs = ["parse_json.cc"], @@ -52,9 +59,6 @@ grpc_cc_library( "//test/core/util:grpc_test_util", "//test/cpp/util:test_util", ], - external_deps = [ - "gtest", - ], ) grpc_cc_library( @@ -122,6 +126,7 @@ grpc_cc_binary( "//:gpr", "//test/core/util:gpr_test_util", "//test/core/util:grpc_test_util", + "//test/cpp/util:test_config", "//test/cpp/util:test_util", ], ) @@ -132,6 +137,7 @@ grpc_cc_test( deps = [ ":histogram", ":interarrival", + "//test/cpp/util:test_config", ], ) @@ -156,6 +162,7 @@ grpc_cc_test( ":benchmark_config", ":driver_impl", ":qps_worker_impl", + "//test/cpp/util:test_config", ], ) @@ -166,6 +173,7 @@ grpc_cc_test( ":benchmark_config", ":driver_impl", "//:grpc++", + "//test/cpp/util:test_config", ], ) diff --git a/test/cpp/qps/OWNERS b/test/cpp/qps/OWNERS new file mode 100644 index 0000000000..8ccea9ad9b --- /dev/null +++ b/test/cpp/qps/OWNERS @@ -0,0 +1,2 @@ +@vjpai + diff --git a/test/cpp/qps/benchmark_config.cc b/test/cpp/qps/benchmark_config.cc index 8f53670324..fb1e0608c5 100644 --- a/test/cpp/qps/benchmark_config.cc +++ b/test/cpp/qps/benchmark_config.cc @@ -54,10 +54,6 @@ using namespace gflags; namespace grpc { namespace testing { -void InitBenchmark(int* argc, char*** argv, bool remove_flags) { - ParseCommandLineFlags(argc, argv, remove_flags); -} - static std::shared_ptr<Reporter> InitBenchmarkReporters() { auto* composite_reporter = new CompositeReporter; if (FLAGS_enable_log_reporter) { diff --git a/test/cpp/qps/benchmark_config.h b/test/cpp/qps/benchmark_config.h index 054dbb276e..d3d6910ff0 100644 --- a/test/cpp/qps/benchmark_config.h +++ b/test/cpp/qps/benchmark_config.h @@ -20,15 +20,12 @@ #define GRPC_TEST_CPP_UTIL_BENCHMARK_CONFIG_H #include <memory> -#include <vector> #include "test/cpp/qps/report.h" namespace grpc { namespace testing { -void InitBenchmark(int* argc, char*** argv, bool remove_flags); - /** Returns the benchmark Reporter instance. * * The returned instance will take care of generating reports for all the actual diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 6b934920df..5d212f1acc 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -140,7 +140,7 @@ class SynchronousStreamingClient : public SynchronousClient { if (*stream) { // forcibly cancel the streams, then finish context_[i].TryCancel(); - (*stream)->Finish(); + (*stream)->Finish().IgnoreError(); // don't log any error message on !ok since this was canceled } }); diff --git a/test/cpp/qps/qps_interarrival_test.cc b/test/cpp/qps/qps_interarrival_test.cc index d19266ff9c..87f09e8c5f 100644 --- a/test/cpp/qps/qps_interarrival_test.cc +++ b/test/cpp/qps/qps_interarrival_test.cc @@ -23,6 +23,7 @@ #include <grpc/support/histogram.h> #include "test/cpp/qps/interarrival.h" +#include "test/cpp/util/test_config.h" using grpc::testing::RandomDistInterface; using grpc::testing::InterarrivalTimer; @@ -50,6 +51,8 @@ static void RunTest(RandomDistInterface &&r, int threads, std::string title) { using grpc::testing::ExpDist; int main(int argc, char **argv) { + grpc::testing::InitTest(&argc, &argv, true); + RunTest(ExpDist(10.0), 5, std::string("Exponential(10)")); return 0; } diff --git a/test/cpp/qps/qps_openloop_test.cc b/test/cpp/qps/qps_openloop_test.cc index 28dec4f8c6..2f8a3d75f0 100644 --- a/test/cpp/qps/qps_openloop_test.cc +++ b/test/cpp/qps/qps_openloop_test.cc @@ -24,6 +24,7 @@ #include "test/cpp/qps/benchmark_config.h" #include "test/cpp/qps/driver.h" #include "test/cpp/qps/report.h" +#include "test/cpp/util/test_config.h" namespace grpc { namespace testing { @@ -58,7 +59,7 @@ static void RunQPS() { } // namespace grpc int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); + grpc::testing::InitTest(&argc, &argv, true); grpc::testing::RunQPS(); diff --git a/test/cpp/qps/qps_test.cc b/test/cpp/qps/qps_test.cc deleted file mode 100644 index 6ab2102e40..0000000000 --- a/test/cpp/qps/qps_test.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include <set> - -#include <grpc/support/log.h> - -#include "test/cpp/qps/benchmark_config.h" -#include "test/cpp/qps/driver.h" -#include "test/cpp/qps/report.h" - -namespace grpc { -namespace testing { - -static const int WARMUP = 20; -static const int BENCHMARK = 20; - -static void RunQPS() { - gpr_log(GPR_INFO, "Running QPS test"); - - ClientConfig client_config; - client_config.set_client_type(ASYNC_CLIENT); - client_config.set_outstanding_rpcs_per_channel(100); - client_config.set_client_channels(64); - client_config.set_async_client_threads(8); - client_config.set_rpc_type(STREAMING); - client_config.mutable_load_params()->mutable_closed_loop(); - - ServerConfig server_config; - server_config.set_server_type(ASYNC_SERVER); - server_config.set_async_server_threads(8); - - const auto result = - RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); - - GetReporter()->ReportQPSPerCore(*result); - GetReporter()->ReportLatency(*result); -} - -} // namespace testing -} // namespace grpc - -int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); - - grpc::testing::RunQPS(); - - return 0; -} diff --git a/test/cpp/qps/secure_sync_unary_ping_pong_test.cc b/test/cpp/qps/secure_sync_unary_ping_pong_test.cc index 586392692e..1ee6e37474 100644 --- a/test/cpp/qps/secure_sync_unary_ping_pong_test.cc +++ b/test/cpp/qps/secure_sync_unary_ping_pong_test.cc @@ -23,6 +23,7 @@ #include "test/cpp/qps/benchmark_config.h" #include "test/cpp/qps/driver.h" #include "test/cpp/qps/report.h" +#include "test/cpp/util/test_config.h" namespace grpc { namespace testing { @@ -61,7 +62,7 @@ static void RunSynchronousUnaryPingPong() { } // namespace grpc int main(int argc, char** argv) { - grpc::testing::InitBenchmark(&argc, &argv, true); + grpc::testing::InitTest(&argc, &argv, true); grpc::testing::RunSynchronousUnaryPingPong(); diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index 6db61abfda..33240f6f69 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -14,9 +14,15 @@ licenses(["notice"]) # Apache v2 -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_binary") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_binary", "grpc_cc_test") -package(default_visibility = ["//visibility:public"]) +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) # The following builds a shared-object to confirm that grpc++_unsecure # builds properly. Build-only is sufficient here @@ -126,19 +132,21 @@ grpc_cc_library( ], ) -cc_test( +grpc_cc_test( name = "error_details_test", srcs = [ "error_details_test.cc", ], deps = [ "//:grpc++_error_details", - "//external:gtest", "//src/proto/grpc/testing:echo_messages_proto", ], + external_deps = [ + "gtest", + ], ) -cc_binary( +grpc_cc_binary( name = "grpc_cli", srcs = [ "cli_call.cc", @@ -160,7 +168,9 @@ cc_binary( ], deps = [ "//:grpc++", - "//external:gflags", "//src/proto/grpc/reflection/v1alpha:reflection_proto", ], + external_deps = [ + "gflags", + ], ) |