]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Made timerfd-syscall test more robust by improving the time rounding algorithm.
authorBart Van Assche <bvanassche@acm.org>
Sun, 19 Sep 2010 17:21:31 +0000 (17:21 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 19 Sep 2010 17:21:31 +0000 (17:21 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11368

memcheck/tests/linux/timerfd-syscall.c
memcheck/tests/linux/timerfd-syscall.stderr.exp

index 8562e09a868f1b978e344cba92b5527e77dc0ddf..866eb582b3a6009bd5466a2634109f16e505427f 100644 (file)
@@ -261,8 +261,13 @@ int main(int ac, char **av)
     if (ticks <= 0)
       fprintf(stderr, "whooops! no timer showed up!\n");
     else
-      fprintf(stderr, "got timer ticks (%ld) after %.1f s\n",
-              ticks, (ttmr - tnow) * 1e-6);
+    {
+      const double delta = (ttmr - tnow) * 1e-6;
+      if (1.9 < delta && delta < 2.1)
+        fprintf(stderr, "got timer ticks (%ld) after about 2s\n", ticks);
+      else
+        fprintf(stderr, "got timer ticks (%ld) after %.1f s\n", ticks, delta);
+    }
 
 
     fprintf(stderr, "O_NONBLOCK test ...\n");
index 3e1cb41ff4d702ba50fb3d5eb0f3ef2963564ad6..247ce1f264910f45320c3a1b2b3b6146e5e61cb8 100644 (file)
@@ -17,7 +17,7 @@ timerfd_gettime returned:
        it_value = 0.1 it_interval = 0.1
 sleeping 1 second ...
 waiting timer ...
-got timer ticks (20) after 2.0 s
+got timer ticks (20) after about 2s
 O_NONBLOCK test ...
 waiting timer (flush the single tick) ...
 got timer ticks (1) after 0.1 s
@@ -40,7 +40,7 @@ timerfd_gettime returned:
        it_value = 0.1 it_interval = 0.1
 sleeping 1 second ...
 waiting timer ...
-got timer ticks (20) after 2.0 s
+got timer ticks (20) after about 2s
 O_NONBLOCK test ...
 waiting timer (flush the single tick) ...
 got timer ticks (1) after 0.1 s