[CRIU] [PATCH] zdtm: allow for 0 timer growth in uptime_grow

Evgeny Antyshev eantyshev at parallels.com
Wed Jun 27 07:50:45 EDT 2012


It may occur that the loop spins faster than clock ticks.

Signed-off-by: Evgeny Antyshev <eantyshev at parallels.com>
---
 test/zdtm/live/static/uptime_grow.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/zdtm/live/static/uptime_grow.c b/test/zdtm/live/static/uptime_grow.c
index c5eff51..1f3dba3 100644
--- a/test/zdtm/live/static/uptime_grow.c
+++ b/test/zdtm/live/static/uptime_grow.c
@@ -6,9 +6,9 @@ const char *test_author = "Evgeny Antysev <eantyshev at parallels.com>";
 #include <time.h>
 #include <stdlib.h>
 
-# define tv_gt(a, b) \
+# define tv_ge(a, b) \
   (((a)->tv_sec == (b)->tv_sec) ? \
-   ((a)->tv_nsec > (b)->tv_nsec) : \
+   ((a)->tv_nsec >= (b)->tv_nsec) : \
    ((a)->tv_sec > (b)->tv_sec))
  
 int main(int argc, char **argv)
@@ -29,7 +29,7 @@ int main(int argc, char **argv)
 			err("clock_gettime failed: %m\n");
 			exit(1);
 		}
-		if (!tv_gt(&tm, &tm_old)) {
+		if (!tv_ge(&tm, &tm_old)) {
 			diff_nsec = (tm_old.tv_sec - tm.tv_sec) * 1.0E9 +\
 				(tm_old.tv_nsec - tm.tv_nsec);
 			fail("clock step backward for %e nsec\n", diff_nsec);
-- 
1.6.5.1.1367.gcd48



More information about the CRIU mailing list