diff options
author | Robbie Shade <rjshade@google.com> | 2017-01-17 09:14:29 -0500 |
---|---|---|
committer | Robbie Shade <rjshade@google.com> | 2017-01-31 15:40:20 -0500 |
commit | ca7effcdff69baba8e52e4c83fe808491df60f36 (patch) | |
tree | 7e04f13f655f44c5930233381b615e1d54e5386e /test/core/util/test_config.h | |
parent | c88834ba996084db5f530706a09892bdd900e7dc (diff) |
Replace timeout/scaling macros with functions.
Diffstat (limited to 'test/core/util/test_config.h')
-rw-r--r-- | test/core/util/test_config.h | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h index c13fe86a64..491f011fc8 100644 --- a/test/core/util/test_config.h +++ b/test/core/util/test_config.h @@ -40,32 +40,17 @@ extern "C" { #endif /* __cplusplus */ -#ifndef GRPC_TEST_SLOWDOWN_BUILD_FACTOR -#define GRPC_TEST_SLOWDOWN_BUILD_FACTOR 1.0 -#endif - -#ifndef GRPC_TEST_SLOWDOWN_MACHINE_FACTOR -#define GRPC_TEST_SLOWDOWN_MACHINE_FACTOR 1.0 -#endif - -extern double g_fixture_slowdown_factor; -extern double g_poller_slowdown_factor; +extern int64_t g_fixture_slowdown_factor; +extern int64_t g_poller_slowdown_factor; -#define GRPC_TEST_SLOWDOWN_FACTOR \ - (GRPC_TEST_SLOWDOWN_BUILD_FACTOR * GRPC_TEST_SLOWDOWN_MACHINE_FACTOR * \ - g_fixture_slowdown_factor * g_poller_slowdown_factor) +/* Returns an appropriate scaling factor for timeouts. */ +int64_t grpc_test_slowdown_factor(); -#define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \ - gpr_time_add( \ - gpr_now(GPR_CLOCK_MONOTONIC), \ - gpr_time_from_millis((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \ - GPR_TIMESPAN)) +/* Converts a given timeout (in seconds) to a deadline. */ +gpr_timespec grpc_timeout_seconds_to_deadline(int64_t time_s); -#define GRPC_TIMEOUT_MILLIS_TO_DEADLINE(x) \ - gpr_time_add( \ - gpr_now(GPR_CLOCK_MONOTONIC), \ - gpr_time_from_micros((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \ - GPR_TIMESPAN)) +/* Converts a given timeout (in milliseconds) to a deadline. */ +gpr_timespec grpc_timeout_milliseconds_to_deadline(int64_t time_ms); #ifndef GRPC_TEST_CUSTOM_PICK_PORT #define GRPC_TEST_PICK_PORT |