From: Bruno Haible Date: Wed, 8 Mar 2023 16:09:37 +0000 (+0100) Subject: gettimeofday, timespec_get tests: Avoid test failure on glibc/Linux. X-Git-Tag: v1.0~1648 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=570d7dbfff17995c9999ec9ab3d7296d960f1e46;p=gnulib.git gettimeofday, timespec_get tests: Avoid test failure on glibc/Linux. * modules/gettimeofday-tests (Depends-on): Add 'time'. * modules/timespec_get-tests (Depends-on): Likewise. * tests/test-gettimeofday.c (test_consistency): Update comment. * tests/test-timespec_get.c (main): Likewise. --- diff --git a/ChangeLog b/ChangeLog index 580b78c331..fc3bf8e087 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2023-03-08 Bruno Haible + gettimeofday, timespec_get tests: Avoid test failure on glibc/Linux. + * modules/gettimeofday-tests (Depends-on): Add 'time'. + * modules/timespec_get-tests (Depends-on): Likewise. + * tests/test-gettimeofday.c (test_consistency): Update comment. + * tests/test-timespec_get.c (main): Likewise. + time: Add tests. * tests/test-time.c: New file. * modules/time-tests: New file. diff --git a/modules/gettimeofday-tests b/modules/gettimeofday-tests index 83c7c4b363..a08631d836 100644 --- a/modules/gettimeofday-tests +++ b/modules/gettimeofday-tests @@ -4,6 +4,7 @@ tests/signature.h tests/macros.h Depends-on: +time configure.ac: diff --git a/modules/timespec_get-tests b/modules/timespec_get-tests index 7784792196..bb11062cb0 100644 --- a/modules/timespec_get-tests +++ b/modules/timespec_get-tests @@ -4,6 +4,7 @@ tests/signature.h tests/macros.h Depends-on: +time configure.ac: diff --git a/tests/test-gettimeofday.c b/tests/test-gettimeofday.c index 6daf069339..d1d5206709 100644 --- a/tests/test-gettimeofday.c +++ b/tests/test-gettimeofday.c @@ -70,7 +70,8 @@ test_consistency () ASSERT (tt2 <= tt4); /* Verify that the tv_sec field of the result is the same as time(NULL). */ - /* Note: This assertion sometimes fails on glibc systems, see + /* Note: It's here that the dependency to the 'time' module is needed. + Without it, this assertion would sometimes fail on glibc systems, see https://sourceware.org/bugzilla/show_bug.cgi?id=30200 */ ASSERT (tv1.tv_sec <= tt2); ASSERT (tt2 <= tv3.tv_sec); diff --git a/tests/test-timespec_get.c b/tests/test-timespec_get.c index 69b98c5c64..a7e927cf62 100644 --- a/tests/test-timespec_get.c +++ b/tests/test-timespec_get.c @@ -46,7 +46,8 @@ main (void) ASSERT (tt2 <= tt4); /* Verify that the tv_sec field of the result is the same as time(NULL). */ - /* Note: This assertion sometimes fails on glibc systems, see + /* Note: It's here that the dependency to the 'time' module is needed. + Without it, this assertion would sometimes fail on glibc systems, see https://sourceware.org/bugzilla/show_bug.cgi?id=30200 */ ASSERT (ts1.tv_sec <= tt2); ASSERT (tt2 <= ts3.tv_sec);