Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
Squashed 'deps/ccommon/' changes from ce0b9ea..b1babb2
Browse files Browse the repository at this point in the history
b1babb2 change wheel's sleep timer to make it less flaky (twitter#143)

git-subtree-dir: deps/ccommon
git-subtree-split: b1babb2
  • Loading branch information
Yao Yue committed Mar 22, 2017
1 parent 5a99512 commit e7957bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -93,3 +98,4 @@ script:
- cmake ..
- make -j
- make check
- egrep -r ":F:|:E:" . || true
7 changes: 5 additions & 2 deletions test/time/wheel/check_wheel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit e7957bd

Please sign in to comment.