From: Dmitry V. Levin Date: Tue, 8 Nov 2016 15:32:47 +0000 (+0000) Subject: tests: skip times.test if CLOCK_PROCESS_CPUTIME_ID does not work X-Git-Tag: v4.15~152 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=64ac9ee78535ec3921445a213fdb2c5f4efc1083;p=strace tests: skip times.test if CLOCK_PROCESS_CPUTIME_ID does not work * tests/times.c (main): Skip if clock_gettime consistenly returns zero for CLOCK_PROCESS_CPUTIME_ID timer. --- diff --git a/tests/times.c b/tests/times.c index 18b209b2..2c7b95e5 100644 --- a/tests/times.c +++ b/tests/times.c @@ -53,7 +53,7 @@ main (void) { struct timespec ts; volatile int dummy = 0; - int i; + int i = 0; pid_t pid = fork(); if (pid < 0) @@ -67,6 +67,9 @@ main (void) if (ts.tv_sec || ts.tv_nsec >= cputime_limit) break; + if (i && !(ts.tv_sec || ts.tv_nsec)) + error_msg_and_skip("clock_gettime(CLOCK_PROCESS_CPUTIME_ID, {0, 0})"); + for (i = 0; i < NUM_USER_ITERS; ++i) ++dummy; }