aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-08-06 09:55:02 -0700
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-08-06 09:55:02 -0700
commit0a6012688ab60d7fed478f5afd8db6494d4a6bb0 (patch)
tree865c798631c283e50bb370dbaabc3eb80c4a02be /test
parent5a2017036dbb44ec413831c13dbd81f6564d5fb4 (diff)
parent7b9ed35a2c0bc8d9c80492531443100d132f7489 (diff)
Merge pull request #2783 from ctiller/tracing-takes-time
Allow fixtures to specify slowdown factors, use it for grpc_trace tests
Diffstat (limited to 'test')
-rw-r--r--test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c1
-rw-r--r--test/core/util/test_config.c2
-rw-r--r--test/core/util/test_config.h7
3 files changed, 8 insertions, 2 deletions
diff --git a/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c b/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c
index c59628b959..6d2361b783 100644
--- a/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c
+++ b/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c
@@ -148,6 +148,7 @@ int main(int argc, char **argv) {
/* force tracing on, with a value to force many
code paths in trace.c to be taken */
gpr_setenv("GRPC_TRACE", "doesnt-exist,http,all");
+ g_fixture_slowdown_factor = 10.0;
grpc_test_init(argc, argv);
grpc_init();
diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c
index 225658f5e2..cadf88a7c6 100644
--- a/test/core/util/test_config.c
+++ b/test/core/util/test_config.c
@@ -38,6 +38,8 @@
#include <stdlib.h>
#include <signal.h>
+double g_fixture_slowdown_factor = 1.0;
+
#if GPR_GETPID_IN_UNISTD_H
#include <unistd.h>
static int seed(void) { return getpid(); }
diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h
index 7028ade7b2..b2cc40bb47 100644
--- a/test/core/util/test_config.h
+++ b/test/core/util/test_config.h
@@ -48,8 +48,11 @@ extern "C" {
#define GRPC_TEST_SLOWDOWN_MACHINE_FACTOR 1.0
#endif
-#define GRPC_TEST_SLOWDOWN_FACTOR \
- (GRPC_TEST_SLOWDOWN_BUILD_FACTOR * GRPC_TEST_SLOWDOWN_MACHINE_FACTOR)
+extern double g_fixture_slowdown_factor;
+
+#define GRPC_TEST_SLOWDOWN_FACTOR \
+ (GRPC_TEST_SLOWDOWN_BUILD_FACTOR * GRPC_TEST_SLOWDOWN_MACHINE_FACTOR * \
+ g_fixture_slowdown_factor)
#define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), \