Merge pull request #23379 from veblush/harden-tests2

Added call to grpc::testing::TestEnvironment in more tests
pull/23381/head
Esun Kim 5 years ago committed by GitHub
commit eea9f7428b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      test/cpp/microbenchmarks/bm_arena.cc
  2. 3
      test/cpp/microbenchmarks/bm_call_create.cc
  3. 2
      test/cpp/microbenchmarks/bm_callback_streaming_ping_pong.cc
  4. 2
      test/cpp/microbenchmarks/bm_callback_unary_ping_pong.cc
  5. 2
      test/cpp/microbenchmarks/bm_closure.cc
  6. 6
      test/cpp/microbenchmarks/bm_cq.cc
  7. 6
      test/cpp/microbenchmarks/bm_cq_multiple_threads.cc
  8. 2
      test/cpp/microbenchmarks/bm_error.cc
  9. 2
      test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc
  10. 2
      test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc
  11. 2
      test/cpp/microbenchmarks/bm_fullstack_trickle.cc
  12. 2
      test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc
  13. 2
      test/cpp/microbenchmarks/bm_pollset.cc
  14. 2
      test/cpp/microbenchmarks/bm_threadpool.cc
  15. 2
      test/cpp/server/server_builder_test.cc
  16. 2
      test/cpp/server/server_builder_with_socket_mutator_test.cc
  17. 3
      test/cpp/util/slice_test.cc

@ -20,6 +20,7 @@
#include <benchmark/benchmark.h>
#include "src/core/lib/gprpp/arena.h"
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
@ -66,6 +67,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);
benchmark::RunTheBenchmarksNamespaced();

@ -41,9 +41,9 @@
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/transport/transport_impl.h"
#include "src/cpp/client/create_channel_internal.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
@ -825,6 +825,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -16,6 +16,7 @@
*
*/
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/callback_streaming_ping_pong.h"
#include "test/cpp/util/test_config.h"
@ -128,6 +129,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -16,6 +16,7 @@
*
*/
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/callback_unary_ping_pong.h"
#include "test/cpp/util/test_config.h"
@ -110,6 +111,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -27,6 +27,7 @@
#include "src/core/lib/iomgr/combiner.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
@ -393,6 +394,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -24,10 +24,11 @@
#include <grpc/support/log.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/impl/grpc_library.h>
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
#include "src/core/lib/surface/completion_queue.h"
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
namespace grpc {
namespace testing {
@ -251,6 +252,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -23,12 +23,13 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/port.h"
#include "src/core/lib/surface/completion_queue.h"
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
struct grpc_pollset {
gpr_mu mu;
@ -213,6 +214,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
gpr_mu_init(&g_mu);
gpr_cv_init(&g_cv);
::benchmark::Initialize(&argc, argv);

@ -24,6 +24,7 @@
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/transport/error_utils.h"
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
@ -316,6 +317,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -18,6 +18,7 @@
/* Benchmark gRPC end2end in various configurations */
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/fullstack_streaming_ping_pong.h"
#include "test/cpp/util/test_config.h"
@ -119,6 +120,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -18,6 +18,7 @@
/* Benchmark gRPC end2end in various configurations */
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/fullstack_streaming_pump.h"
#include "test/cpp/util/test_config.h"
@ -63,6 +64,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -27,6 +27,7 @@
#include "src/core/lib/iomgr/timer_manager.h"
#include "src/core/lib/profiling/timers.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/test_config.h"
#include "test/core/util/trickle_endpoint.h"
#include "test/cpp/microbenchmarks/fullstack_context_mutators.h"
#include "test/cpp/microbenchmarks/fullstack_fixtures.h"
@ -462,6 +463,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -18,6 +18,7 @@
/* Benchmark gRPC end2end in various configurations */
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/fullstack_unary_ping_pong.h"
#include "test/cpp/util/test_config.h"
@ -171,6 +172,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -29,6 +29,7 @@
#include "src/core/lib/iomgr/port.h"
#include "src/core/lib/iomgr/wakeup_fd_posix.h"
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
@ -258,6 +259,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -23,6 +23,7 @@
#include <mutex>
#include "src/core/lib/iomgr/executor/threadpool.h"
#include "test/core/util/test_config.h"
#include "test/cpp/microbenchmarks/helpers.h"
#include "test/cpp/util/test_config.h"
@ -320,6 +321,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
} // namespace benchmark
int main(int argc, char* argv[]) {
grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv);
::grpc::testing::InitTest(&argc, &argv, false);

@ -26,6 +26,7 @@
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
namespace grpc {
namespace {
@ -87,6 +88,7 @@ TEST_F(ServerBuilderTest, CreateServerRepeatedPortWithDisallowedReusePort) {
} // namespace grpc
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
return ret;

@ -28,6 +28,7 @@
#include "src/core/lib/iomgr/socket_mutator.h"
#include "src/proto/grpc/testing/echo.grpc.pb.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
/* This test does a sanity check that grpc_socket_mutator's
* are used by servers. It's meant to protect code and end-to-end
@ -115,6 +116,7 @@ TEST_F(ServerBuilderWithSocketMutatorTest, CreateServerWithSocketMutator) {
} // namespace grpc
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
return ret;

@ -23,6 +23,8 @@
#include <grpc/slice.h>
#include <gtest/gtest.h>
#include "test/core/util/test_config.h"
namespace grpc {
static internal::GrpcLibraryInitializer g_gli_initializer;
@ -135,6 +137,7 @@ TEST_F(SliceTest, Cslice) {
} // namespace grpc
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
return ret;

Loading…
Cancel
Save