diff options
Diffstat (limited to 'test/syscalls/linux/clock_gettime.cc')
-rw-r--r-- | test/syscalls/linux/clock_gettime.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/syscalls/linux/clock_gettime.cc b/test/syscalls/linux/clock_gettime.cc index 5003928be..dee66c5a8 100644 --- a/test/syscalls/linux/clock_gettime.cc +++ b/test/syscalls/linux/clock_gettime.cc @@ -87,7 +87,12 @@ TEST(ClockGettime, JavaThreadTime) { ASSERT_EQ(0, pthread_getcpuclockid(pthread_self(), &clockid)); struct timespec tp; ASSERT_THAT(clock_getres(clockid, &tp), SyscallSucceeds()); - ASSERT_THAT(clock_gettime(clockid, &tp), SyscallSucceeds()); + EXPECT_TRUE(tp.tv_sec > 0 || tp.tv_nsec > 0); + // A thread cputime is updated each 10msec and there is no approximation + // if a task is running. + do { + ASSERT_THAT(clock_gettime(clockid, &tp), SyscallSucceeds()); + } while (tp.tv_sec == 0 && tp.tv_nsec == 0); EXPECT_TRUE(tp.tv_sec > 0 || tp.tv_nsec > 0); } |