diff --git a/ChangeLog b/ChangeLog index 188bb8f2f..69d41bf1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2020-09-23 Tim Rice + + * tests/nap.h: rename to tests/gnulib_nap.h + * tests/gnulib_nap.h: avoid name space clash with UniWare's libc. + rename nap() to gnulib_nap(). nap() dates back to Xenix 286. + First discussed here + + * modules/chown-tests: Likewise + * modules/fchownat-tests: Likewise + * modules/fdutimensat-tests: Likewise + * modules/futimens-tests: Likewise + * modules/lchown-tests: Likewise + * modules/stat-time-tests: Likewise + * modules/utime-tests: Likewise + * modules/utimens-tests: Likewise + * modules/utimensat-tests: Likewise + * tests/test-chown.h: Likewise + * tests/test-futimens.h: Likewise + * tests/test-lchown.h: Likewise + * tests/test-lutimens.h: Likewise + * tests/test-stat-time.c: Likewise + * tests/test-utime.c: Likewise + * tests/test-utimens.h: Likewise + * tests/test-utimens-common.h + 2020-09-20 Norihiro Tanaka dfa: make dfasupported a global function diff --git a/modules/chown-tests b/modules/chown-tests index 13138f438..33f730daa 100644 --- a/modules/chown-tests +++ b/modules/chown-tests @@ -1,5 +1,5 @@ Files: -tests/nap.h +tests/gnulib_nap.h tests/test-chown.h tests/test-chown.c tests/signature.h diff --git a/modules/fchownat-tests b/modules/fchownat-tests index e5fb7833f..62f6f4a1d 100644 --- a/modules/fchownat-tests +++ b/modules/fchownat-tests @@ -1,5 +1,5 @@ Files: -tests/nap.h +tests/gnulib_nap.h tests/test-chown.h tests/test-lchown.h tests/test-fchownat.c diff --git a/modules/fdutimensat-tests b/modules/fdutimensat-tests index 37f70c652..0ee034a9b 100644 --- a/modules/fdutimensat-tests +++ b/modules/fdutimensat-tests @@ -1,5 +1,5 @@ Files: -tests/nap.h +tests/gnulib_nap.h tests/test-futimens.h tests/test-lutimens.h tests/test-utimens.h diff --git a/modules/futimens-tests b/modules/futimens-tests index 519141300..2116246d9 100644 --- a/modules/futimens-tests +++ b/modules/futimens-tests @@ -1,5 +1,5 @@ Files: -tests/nap.h +tests/gnulib_nap.h tests/test-futimens.h tests/test-utimens-common.h tests/test-futimens.c diff --git a/modules/lchown-tests b/modules/lchown-tests index 42b946014..004cda60f 100644 --- a/modules/lchown-tests +++ b/modules/lchown-tests @@ -1,5 +1,5 @@ Files: -tests/nap.h +tests/gnulib_nap.h tests/test-lchown.h tests/test-lchown.c tests/signature.h diff --git a/modules/stat-time-tests b/modules/stat-time-tests index c512eca76..3c14de2f9 100644 --- a/modules/stat-time-tests +++ b/modules/stat-time-tests @@ -1,7 +1,7 @@ Files: tests/test-stat-time.c tests/macros.h -tests/nap.h +tests/gnulib_nap.h Depends-on: intprops diff --git a/modules/utime-tests b/modules/utime-tests index a64d0a006..a01546cdc 100644 --- a/modules/utime-tests +++ b/modules/utime-tests @@ -1,6 +1,6 @@ Files: tests/test-utime.c -tests/nap.h +tests/gnulib_nap.h tests/test-utimens-common.h tests/macros.h diff --git a/modules/utimens-tests b/modules/utimens-tests index 2a95346a0..28ebadae3 100644 --- a/modules/utimens-tests +++ b/modules/utimens-tests @@ -1,5 +1,5 @@ Files: -tests/nap.h +tests/gnulib_nap.h tests/test-futimens.h tests/test-lutimens.h tests/test-utimens.h diff --git a/modules/utimensat-tests b/modules/utimensat-tests index 15c79407e..86d2ac2de 100644 --- a/modules/utimensat-tests +++ b/modules/utimensat-tests @@ -1,5 +1,5 @@ Files: -tests/nap.h +tests/gnulib_nap.h tests/test-lutimens.h tests/test-utimens.h tests/test-utimens-common.h diff --git a/tests/gnulib_nap.h b/tests/gnulib_nap.h index 5dd264f6d..784c22f07 100644 --- a/tests/gnulib_nap.h +++ b/tests/gnulib_nap.h @@ -25,7 +25,7 @@ # include /* Name of the witness file. */ -#define TEMPFILE BASE "nap.tmp" +#define TEMPFILE BASE "gnulib_nap.tmp" /* File descriptor used for the witness file. */ static int nap_fd = -1; @@ -114,7 +114,7 @@ clear_temp_file (void) Assumes that BASE is defined, and requires that the test module depends on nanosleep. */ static void -nap (void) +gnulib_nap (void) { struct stat old_st; static int delay = 1; diff --git a/tests/test-chown.h b/tests/test-chown.h index eb068f0b8..5863dfea3 100644 --- a/tests/test-chown.h +++ b/tests/test-chown.h @@ -16,7 +16,7 @@ /* Written by Eric Blake , 2009. */ -#include "nap.h" +#include "gnulib_nap.h" #if !HAVE_GETEGID # define getegid() ((gid_t) -1) @@ -98,7 +98,7 @@ test_chown (int (*func) (char const *, uid_t, gid_t), bool print) /* Even if the values aren't changing, ctime is required to change if at least one argument is not -1. */ - nap (); + gnulib_nap (); ASSERT (func (BASE "dir/file", st1.st_uid, st1.st_gid) == 0); ASSERT (stat (BASE "dir/file", &st2) == 0); ASSERT (st1.st_ctime < st2.st_ctime @@ -172,7 +172,7 @@ test_chown (int (*func) (char const *, uid_t, gid_t), bool print) ASSERT (lstat (BASE "dir/link", &l1) == 0); ASSERT (lstat (BASE "dir/link2", &l2) == 0); - nap (); + gnulib_nap (); errno = 0; ASSERT (func (BASE "dir/link2/", -1, st1.st_gid) == -1); ASSERT (errno == ENOTDIR); diff --git a/tests/test-futimens.h b/tests/test-futimens.h index b5645e6d1..bbac0db04 100644 --- a/tests/test-futimens.h +++ b/tests/test-futimens.h @@ -32,7 +32,7 @@ test_futimens (int (*func) (int, struct timespec const *), /* Sanity check. */ ASSERT (fstat (fd, &st1) == 0); - nap (); + gnulib_nap (); errno = 0; result = func (fd, NULL); if (result == -1 && errno == ENOSYS) @@ -68,7 +68,7 @@ test_futimens (int (*func) (int, struct timespec const *), ts[1] = ts[0]; ASSERT (func (fd, ts) == 0); ASSERT (fstat (fd, &st1) == 0); - nap (); + gnulib_nap (); } /* Invalid arguments. */ @@ -148,7 +148,7 @@ test_futimens (int (*func) (int, struct timespec const *), ts[0].tv_nsec = UTIME_OMIT; ts[1].tv_sec = 0; ts[1].tv_nsec = UTIME_NOW; - nap (); + gnulib_nap (); ASSERT (func (fd, ts) == 0); ASSERT (fstat (fd, &st3) == 0); ASSERT (st3.st_atime == Y2K); @@ -157,7 +157,7 @@ test_futimens (int (*func) (int, struct timespec const *), ASSERT (utimecmp (BASE "file", &st1, &st3, 0) <= 0); if (check_ctime) ASSERT (ctime_compare (&st2, &st3) < 0); - nap (); + gnulib_nap (); ts[0].tv_nsec = 0; ts[1].tv_nsec = UTIME_OMIT; ASSERT (func (fd, ts) == 0); diff --git a/tests/test-lchown.h b/tests/test-lchown.h index cf29e29c4..bcbe182f0 100644 --- a/tests/test-lchown.h +++ b/tests/test-lchown.h @@ -16,7 +16,7 @@ /* Written by Eric Blake , 2009. */ -#include "nap.h" +#include "gnulib_nap.h" #if !HAVE_GETEGID # define getegid() ((gid_t) -1) @@ -106,7 +106,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print) /* Even if the values aren't changing, ctime is required to change if at least one argument is not -1. */ - nap (); + gnulib_nap (); ASSERT (func (BASE "dir/file", st1.st_uid, st1.st_gid) == 0); ASSERT (stat (BASE "dir/file", &st2) == 0); ASSERT (st1.st_ctime < st2.st_ctime @@ -208,7 +208,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print) ASSERT (lstat (BASE "dir/link", &l1) == 0); ASSERT (lstat (BASE "dir/link2", &l2) == 0); - nap (); + gnulib_nap (); errno = 0; ASSERT (func (BASE "dir/link2/", -1, st1.st_gid) == -1); ASSERT (errno == ENOTDIR); @@ -237,7 +237,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print) /* Trailing slash follows through to directory. */ ASSERT (lstat (BASE "dir/sub", &st1) == 0); ASSERT (lstat (BASE "dir/link3", &l1) == 0); - nap (); + gnulib_nap (); ASSERT (func (BASE "dir/link3/", -1, st1.st_gid) == 0); ASSERT (lstat (BASE "dir/link3", &st2) == 0); ASSERT (l1.st_ctime == st2.st_ctime); diff --git a/tests/test-lutimens.h b/tests/test-lutimens.h index 90aa5141b..22e469ef0 100644 --- a/tests/test-lutimens.h +++ b/tests/test-lutimens.h @@ -60,7 +60,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print) ts[0].tv_sec = Y2K; ts[0].tv_nsec = 0; ts[1] = ts[0]; - nap (); + gnulib_nap (); ASSERT (func (BASE "file", ts) == 0); } ASSERT (stat (BASE "file", &st2) == 0); @@ -102,7 +102,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print) ASSERT (lstat (BASE "link", &st1) == 0); /* On cygwin, lstat() changes atime of symlinks, so that lutimens can only effectively modify mtime. */ - nap (); + gnulib_nap (); ASSERT (lstat (BASE "link", &st2) == 0); if (st1.st_atime != st2.st_atime || get_stat_atime_ns (&st1) != get_stat_atime_ns (&st2)) @@ -146,7 +146,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print) ts[0].tv_nsec = BILLION / 2 - 1; ts[1].tv_sec = Y2K; ts[1].tv_nsec = BILLION - 1; - nap (); + gnulib_nap (); ASSERT (func (BASE "link", ts) == 0); ASSERT (lstat (BASE "link", &st2) == 0); if (atime_supported) @@ -170,7 +170,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print) ts[0].tv_nsec = UTIME_OMIT; ts[1].tv_sec = 0; ts[1].tv_nsec = UTIME_NOW; - nap (); + gnulib_nap (); ASSERT (func (BASE "link", ts) == 0); ASSERT (lstat (BASE "link", &st3) == 0); if (atime_supported) @@ -182,7 +182,7 @@ test_lutimens (int (*func) (char const *, struct timespec const *), bool print) ASSERT (utimecmp (BASE "link", &st1, &st3, 0) <= 0); if (check_ctime) ASSERT (ctime_compare (&st2, &st3) < 0); - nap (); + gnulib_nap (); ts[0].tv_nsec = 0; ts[1].tv_nsec = UTIME_OMIT; ASSERT (func (BASE "link", ts) == 0); diff --git a/tests/test-stat-time.c b/tests/test-stat-time.c index 86d4346d9..09a3d0bb1 100644 --- a/tests/test-stat-time.c +++ b/tests/test-stat-time.c @@ -30,7 +30,7 @@ #include "macros.h" #define BASE "test-stat-time.t" -#include "nap.h" +#include "gnulib_nap.h" enum { NFILES = 4 }; @@ -110,13 +110,13 @@ prepare_test (struct stat *statinfo, struct timespec *modtimes) int i; create_file (filename_stamp1); - nap (); + gnulib_nap (); create_file (filename_testfile); - nap (); + gnulib_nap (); create_file (filename_stamp2); - nap (); + gnulib_nap (); ASSERT (chmod (filename_testfile, 0400) == 0); - nap (); + gnulib_nap (); create_file (filename_stamp3); do_stat (filename_stamp1, &statinfo[0]); diff --git a/tests/test-utime.c b/tests/test-utime.c index 4cf583606..1ee3de6eb 100644 --- a/tests/test-utime.c +++ b/tests/test-utime.c @@ -38,7 +38,7 @@ test_utime (bool print) ASSERT (close (creat (BASE "file", 0600)) == 0); ASSERT (stat (BASE "file", &st1) == 0); - nap (); + gnulib_nap (); ASSERT (utime (BASE "file", NULL) == 0); ASSERT (stat (BASE "file", &st2) == 0); ASSERT (0 <= utimecmp (BASE "file", &st2, &st1, UTIMECMP_TRUNCATE_SOURCE)); @@ -56,7 +56,7 @@ test_utime (bool print) ts.actime = ts.modtime = time (NULL); ASSERT (utime (BASE "file", &ts) == 0); ASSERT (stat (BASE "file", &st1) == 0); - nap (); + gnulib_nap (); } /* Invalid arguments. */ diff --git a/tests/test-utimens-common.h b/tests/test-utimens-common.h index e92362085..1df1fe7b7 100644 --- a/tests/test-utimens-common.h +++ b/tests/test-utimens-common.h @@ -31,7 +31,7 @@ # include "utimecmp.h" /* Gnulib test header. */ -# include "nap.h" +# include "gnulib_nap.h" enum { BILLION = 1000 * 1000 * 1000, diff --git a/tests/test-utimens.h b/tests/test-utimens.h index a05b232a8..10aef0892 100644 --- a/tests/test-utimens.h +++ b/tests/test-utimens.h @@ -33,7 +33,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print) UTIMECMP_TRUNCATE_SOURCE to compensate, with st1 as the source. */ ASSERT (stat (BASE "file", &st1) == 0); - nap (); + gnulib_nap (); ASSERT (func (BASE "file", NULL) == 0); ASSERT (stat (BASE "file", &st2) == 0); ASSERT (0 <= utimecmp (BASE "file", &st2, &st1, UTIMECMP_TRUNCATE_SOURCE)); @@ -52,7 +52,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print) ts[1] = ts[0]; ASSERT (func (BASE "file", ts) == 0); ASSERT (stat (BASE "file", &st1) == 0); - nap (); + gnulib_nap (); } /* Invalid arguments. */ @@ -126,7 +126,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print) ts[0].tv_nsec = UTIME_OMIT; ts[1].tv_sec = 0; ts[1].tv_nsec = UTIME_NOW; - nap (); + gnulib_nap (); ASSERT (func (BASE "file", ts) == 0); ASSERT (stat (BASE "file", &st3) == 0); ASSERT (st3.st_atime == Y2K); @@ -136,7 +136,7 @@ test_utimens (int (*func) (char const *, struct timespec const *), bool print) ASSERT (0 <= utimecmp (BASE "file", &st3, &st1, UTIMECMP_TRUNCATE_SOURCE)); if (check_ctime) ASSERT (ctime_compare (&st2, &st3) < 0); - nap (); + gnulib_nap (); ts[0].tv_nsec = 0; ts[1].tv_nsec = UTIME_OMIT; ASSERT (func (BASE "file", ts) == 0);