Skip to content
Snippets Groups Projects
Commit 0a601268 authored by Nicolas Noble's avatar Nicolas Noble
Browse files

Merge pull request #2783 from ctiller/tracing-takes-time

Allow fixtures to specify slowdown factors, use it for grpc_trace tests
parents 5a201703 7b9ed35a
No related branches found
No related tags found
No related merge requests found
...@@ -148,6 +148,7 @@ int main(int argc, char **argv) { ...@@ -148,6 +148,7 @@ int main(int argc, char **argv) {
/* force tracing on, with a value to force many /* force tracing on, with a value to force many
code paths in trace.c to be taken */ code paths in trace.c to be taken */
gpr_setenv("GRPC_TRACE", "doesnt-exist,http,all"); gpr_setenv("GRPC_TRACE", "doesnt-exist,http,all");
g_fixture_slowdown_factor = 10.0;
grpc_test_init(argc, argv); grpc_test_init(argc, argv);
grpc_init(); grpc_init();
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <signal.h> #include <signal.h>
double g_fixture_slowdown_factor = 1.0;
#if GPR_GETPID_IN_UNISTD_H #if GPR_GETPID_IN_UNISTD_H
#include <unistd.h> #include <unistd.h>
static int seed(void) { return getpid(); } static int seed(void) { return getpid(); }
......
...@@ -48,8 +48,11 @@ extern "C" { ...@@ -48,8 +48,11 @@ extern "C" {
#define GRPC_TEST_SLOWDOWN_MACHINE_FACTOR 1.0 #define GRPC_TEST_SLOWDOWN_MACHINE_FACTOR 1.0
#endif #endif
#define GRPC_TEST_SLOWDOWN_FACTOR \ extern double g_fixture_slowdown_factor;
(GRPC_TEST_SLOWDOWN_BUILD_FACTOR * GRPC_TEST_SLOWDOWN_MACHINE_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) \ #define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), \ gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment