Add a class to wrap grpc_test_init

pull/17359/head
yang-g 6 years ago
parent 7ef8fc826c
commit 2a938b0006
  1. 12
      test/core/util/test_config.cc
  2. 15
      test/core/util/test_config.h

@ -397,3 +397,15 @@ void grpc_test_init(int argc, char** argv) {
concurrently running test binary */
srand(seed());
}
namespace grpc {
namespace testing {
TestEnvironment::TestEnvironment(int argc, char **argv) {
grpc_test_init(argc, argv);
}
TestEnvironment::~TestEnvironment() {}
} // namespace testing
} // namespace grpc

@ -37,6 +37,21 @@ gpr_timespec grpc_timeout_milliseconds_to_deadline(int64_t time_ms);
#define GRPC_TEST_PICK_PORT
#endif
// Prefer TestEnvironment below.
void grpc_test_init(int argc, char** argv);
namespace grpc {
namespace testing {
// A TestEnvironment object should be alive in the main function of a test. It
// provides test init and shutdown inside.
class TestEnvironment {
public:
TestEnvironment(int argc, char **argv);
~TestEnvironment();
};
} // namespace testing
} // namespace grpc
#endif /* GRPC_TEST_CORE_UTIL_TEST_CONFIG_H */

Loading…
Cancel
Save