test/core/util/test_config.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPC_TEST_CORE_UTIL_TEST_CONFIG_H
20 #define GRPC_TEST_CORE_UTIL_TEST_CONFIG_H
21 
22 #include <grpc/support/time.h>
23 
24 #include "test/core/util/build.h"
25 
28 
29 /* Returns an appropriate scaling factor for timeouts. */
31 
32 /* Converts a given timeout (in seconds) to a deadline. */
34 
35 /* Converts a given timeout (in milliseconds) to a deadline. */
37 
38 #if !defined(GRPC_TEST_CUSTOM_PICK_PORT) && !defined(GRPC_PORT_ISOLATED_RUNTIME)
39 #define GRPC_TEST_PICK_PORT
40 #endif
41 
42 // Prefer TestEnvironment below.
43 void grpc_test_init(int* argc, char** argv);
44 
45 // Wait until gRPC is fully shut down.
46 // Returns if grpc is shutdown
48 
49 namespace grpc {
50 namespace testing {
51 
52 // A TestEnvironment object should be alive in the main function of a test. It
53 // provides test init and shutdown inside.
55  public:
56  TestEnvironment(int* argc, char** argv);
58 };
59 
60 // A TestGrpcScope makes sure that
61 // - when it's created, gRPC will be initialized
62 // - when it's destroyed, gRPC will shutdown and it waits until shutdown
64  public:
65  TestGrpcScope();
67 };
68 
69 } // namespace testing
70 } // namespace grpc
71 
72 #endif /* GRPC_TEST_CORE_UTIL_TEST_CONFIG_H */
testing
Definition: aws_request_signer_test.cc:25
grpc_timeout_seconds_to_deadline
gpr_timespec grpc_timeout_seconds_to_deadline(int64_t time_s)
Definition: test/core/util/test_config.cc:81
grpc
Definition: grpcpp/alarm.h:33
grpc::testing::TestGrpcScope
Definition: test/core/util/test_config.h:63
grpc_timeout_milliseconds_to_deadline
gpr_timespec grpc_timeout_milliseconds_to_deadline(int64_t time_ms)
Definition: test/core/util/test_config.cc:89
time.h
grpc::testing::TestGrpcScope::TestGrpcScope
TestGrpcScope()
Definition: test/core/util/test_config.cc:189
grpc_test_slowdown_factor
int64_t grpc_test_slowdown_factor()
Definition: test/core/util/test_config.cc:76
build.h
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
grpc_test_init
void grpc_test_init(int *argc, char **argv)
Definition: test/core/util/test_config.cc:135
grpc::testing::TestEnvironment::~TestEnvironment
~TestEnvironment()
Definition: test/core/util/test_config.cc:171
grpc::testing::TestEnvironment::TestEnvironment
TestEnvironment(int *argc, char **argv)
Definition: test/core/util/test_config.cc:167
grpc::testing::TestGrpcScope::~TestGrpcScope
~TestGrpcScope()
Definition: test/core/util/test_config.cc:191
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
gpr_timespec
Definition: gpr_types.h:50
g_poller_slowdown_factor
int64_t g_poller_slowdown_factor
Definition: test/core/util/test_config.cc:48
grpc_wait_until_shutdown
bool grpc_wait_until_shutdown(int64_t time_s)
Definition: test/core/util/test_config.cc:151
g_fixture_slowdown_factor
int64_t g_fixture_slowdown_factor
Definition: test/core/util/test_config.cc:47


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:28