aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/support/sync_test.cc
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2018-01-17 10:38:53 -0800
committerGravatar David Garcia Quintas <dgq@google.com>2018-01-17 10:38:53 -0800
commit41d27e104fcfcf2a3c25657b99303d61fdd4d947 (patch)
tree0e2c9ab4b9aaeca7a6d52bbab51bc100e293a113 /test/core/support/sync_test.cc
parent269ee29e032e3edc62d5b63ce44b5135979249da (diff)
parent3538efb53bd6d3bfca91aa50db7a6e1b97b9c855 (diff)
Merge branch 'master' of github.com:grpc/grpc into conn_subchannel
Diffstat (limited to 'test/core/support/sync_test.cc')
-rw-r--r--test/core/support/sync_test.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/core/support/sync_test.cc b/test/core/support/sync_test.cc
index fb7ec44754..768f96d093 100644
--- a/test/core/support/sync_test.cc
+++ b/test/core/support/sync_test.cc
@@ -231,16 +231,17 @@ static void mark_thread_done(struct test* m) {
*/
static void test(const char* name, void (*body)(void* m),
void (*extra)(void* m), int timeout_s, int incr_step) {
- int64_t iterations = 1024;
+ int64_t iterations = 256;
struct test* m;
gpr_timespec start = gpr_now(GPR_CLOCK_REALTIME);
gpr_timespec time_taken;
gpr_timespec deadline = gpr_time_add(
start, gpr_time_from_micros((int64_t)timeout_s * 1000000, GPR_TIMESPAN));
fprintf(stderr, "%s:", name);
+ fflush(stderr);
while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0) {
- iterations <<= 1;
fprintf(stderr, " %ld", (long)iterations);
+ fflush(stderr);
m = test_new(10, iterations, incr_step);
if (extra != nullptr) {
gpr_thd_id id;
@@ -252,13 +253,16 @@ static void test(const char* name, void (*body)(void* m),
if (m->counter != m->threads * m->iterations * m->incr_step) {
fprintf(stderr, "counter %ld threads %d iterations %ld\n",
(long)m->counter, m->threads, (long)m->iterations);
+ fflush(stderr);
GPR_ASSERT(0);
}
test_destroy(m);
+ iterations <<= 1;
}
time_taken = gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), start);
fprintf(stderr, " done %lld.%09d s\n", (long long)time_taken.tv_sec,
(int)time_taken.tv_nsec);
+ fflush(stderr);
}
/* Increment m->counter on each iteration; then mark thread as done. */