From b1babb2ed495fe3fb9769b4f727b1f161dfbb71a Mon Sep 17 00:00:00 2001 From: Yao Yue Date: Wed, 22 Mar 2017 01:29:08 -0700 Subject: [PATCH] change wheel's sleep timer to make it less flaky (#143) * change wheel's sleep timer to make it less flaky * update .travis.yml * update sleep timer * missed a tick * longer tick * rearrange --- .travis.yml | 6 ++++++ test/time/wheel/check_wheel.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 47c18dabf..954fcacc0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,6 +75,11 @@ matrix: osx_image: xcode7.1 env: C_COMPILER=clang + # clang 4.2 on osx + - os: osx + osx_image: xcode8.2 + env: C_COMPILER=clang + before_install: # for osx: 0. update brew; 1. install cmake if missing; 2. (gcc) unlink pre-installed gcc; 3. (gcc) install desired version of gcc @@ -93,3 +98,4 @@ script: - cmake .. - make -j - make check + - egrep -r ":F:|:E:" . || true diff --git a/test/time/wheel/check_wheel.c b/test/time/wheel/check_wheel.c index c2631d1eb..4bd4df0ee 100644 --- a/test/time/wheel/check_wheel.c +++ b/test/time/wheel/check_wheel.c @@ -116,7 +116,7 @@ END_TEST START_TEST(test_timing_wheel_recur) { -#define TICK_NS 10000000 +#define TICK_NS 50000000 #define NSLOT 3 #define NTICK 2 @@ -136,11 +136,13 @@ START_TEST(test_timing_wheel_recur) timing_wheel_insert(tw, &delay, true, _incr_cb, &i); - nanosleep(&ts, NULL); + /* tick unchanged */ timing_wheel_execute(tw); ck_assert_int_eq(tw->nprocess, 0); ck_assert_int_eq(tw->nevent, 1); + /* next 2 tick */ + nanosleep(&ts, NULL); nanosleep(&ts, NULL); timing_wheel_execute(tw); ck_assert_int_eq(tw->nevent, 1); @@ -152,6 +154,7 @@ START_TEST(test_timing_wheel_recur) ck_assert_int_eq(tw->nprocess, 2); ck_assert_int_eq(i, 2); + /* flush events */ timing_wheel_stop(tw); timing_wheel_flush(tw); ck_assert_int_eq(tw->nevent, 0);