diff options
author | Christopher Ferris <cferris@google.com> | 2015-02-18 17:11:47 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2015-02-18 17:45:50 -0800 |
commit | 3da136aa47e2d1608b98abb2580f024b36f92831 (patch) | |
tree | 555be2ba96c58e6d11c2dbdb5ed1376a4a41b1aa /tests | |
parent | 4177bd8d16e0dc2d0d541fc54f81518c57651e55 (diff) | |
download | bionic-3da136aa47e2d1608b98abb2580f024b36f92831.zip bionic-3da136aa47e2d1608b98abb2580f024b36f92831.tar.gz bionic-3da136aa47e2d1608b98abb2580f024b36f92831.tar.bz2 |
Modify test to avoid race condition.
There is a possible race if a timer is set to trigger at nearly the same
time as it is set. Since nobody uses the timers like this, modify the test
so this doesn't happen. The race that this can provoke has been fixed in
aosp.
Bug: 19423618
Change-Id: I21084c99da5ae46f404936d673dae6bad7c82caa
Diffstat (limited to 'tests')
-rw-r--r-- | tests/time_test.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/time_test.cpp b/tests/time_test.cpp index d637df2..9880d2c 100644 --- a/tests/time_test.cpp +++ b/tests/time_test.cpp @@ -386,11 +386,11 @@ TEST(time, timer_delete_from_timer_thread) { ASSERT_EQ(0, timer_create(CLOCK_REALTIME, &se, &tdd.timer_id)); itimerspec ts; - ts.it_value.tv_sec = 0; - ts.it_value.tv_nsec = 100; + ts.it_value.tv_sec = 1; + ts.it_value.tv_nsec = 0; ts.it_interval.tv_sec = 0; ts.it_interval.tv_nsec = 0; - ASSERT_EQ(0, timer_settime(tdd.timer_id, TIMER_ABSTIME, &ts, NULL)); + ASSERT_EQ(0, timer_settime(tdd.timer_id, 0, &ts, NULL)); time_t cur_time = time(NULL); while (!tdd.complete && (time(NULL) - cur_time) < 5); |