aboutsummaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-07-12 18:50:22 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-10-04 10:51:55 -0300
commit958309cba24caf58ea5e118b20eccadbb3638f2d (patch)
treea7ca9e0ba9b75133e075760cd629b0db7bfdc676 /time
parent3692c0df7f066d01863fc05a5f7cedd2628961e7 (diff)
downloadglibc-958309cba24caf58ea5e118b20eccadbb3638f2d.zip
glibc-958309cba24caf58ea5e118b20eccadbb3638f2d.tar.gz
glibc-958309cba24caf58ea5e118b20eccadbb3638f2d.tar.bz2
time: Ignore interval nanoseconds on tst-itimer
Running the test on a 4.4 kernel within KVM, the precision used on ITIMER_VIRTUAL and ITIMER_PROF seems to different than the one used for ITIMER_REAL (it seems the same used for CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE). I did not see it on other kernels, for instance 5.11 and 4.15. To avoid trying to guess the resolution used, do not check the nanosecond internal values for the specific timers. Checked on i686-linux-gnu with a 4.4 kernel.
Diffstat (limited to 'time')
-rw-r--r--time/tst-itimer.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/time/tst-itimer.c b/time/tst-itimer.c
index c6d623c..d5492ec 100644
--- a/time/tst-itimer.c
+++ b/time/tst-itimer.c
@@ -74,7 +74,9 @@ do_test (void)
else
{
TEST_COMPARE (it_old.it_interval.tv_sec, 10);
- TEST_COMPARE (it_old.it_interval.tv_usec, 20);
+ /* Some systems might use a different precision for ITIMER_VIRTUAL
+ and ITIMER_IPROF and thus the value might be adjusted. To avoid
+ trying to guess the resolution, we do not check it. */
}
/* Create a periodic timer and check if the return value is the one
@@ -88,7 +90,8 @@ do_test (void)
TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { 0 }, &it_old),
0);
TEST_COMPARE (it.it_interval.tv_sec, it_old.it_interval.tv_sec);
- TEST_COMPARE (it.it_interval.tv_usec, it_old.it_interval.tv_usec);
+ if (timers[i] == ITIMER_REAL)
+ TEST_COMPARE (it.it_interval.tv_usec, it_old.it_interval.tv_usec);
if (sizeof (time_t) == 4)
continue;
@@ -114,11 +117,6 @@ do_test (void)
TEST_COMPARE (it_old.it_interval.tv_sec, 0ull);
TEST_COMPARE (it_old.it_interval.tv_usec, 0);
}
- else
- {
- TEST_COMPARE (it_old.it_interval.tv_sec, 0x1ffffffffull);
- TEST_COMPARE (it_old.it_interval.tv_usec, 20);
- }
}
else
{
@@ -139,8 +137,11 @@ do_test (void)
TEST_COMPARE (setitimer (timers[i], &(struct itimerval) { 0 },
&it_old),
0);
- TEST_COMPARE (it.it_interval.tv_sec, it_old.it_interval.tv_sec);
- TEST_COMPARE (it.it_interval.tv_usec, it_old.it_interval.tv_usec);
+ if (timers[i] == ITIMER_REAL)
+ {
+ TEST_COMPARE (it.it_interval.tv_sec, it_old.it_interval.tv_sec);
+ TEST_COMPARE (it.it_interval.tv_usec, it_old.it_interval.tv_usec);
+ }
}
else
{