diff --git a/ChangeLog b/ChangeLog index 188bb8f2f..92527224c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2020-09-23 Tim Rice + + * tests/nap.h: avoid name space clash with UniWare's libc. + nap() dates back to Xenix 286. First discussed here + + * 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 + 2020-09-20 Norihiro Tanaka dfa: make dfasupported a global function diff --git a/tests/nap.h b/tests/nap.h index 5dd264f6d..784c22f07 100644 --- a/tests/nap.h +++ b/tests/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..79ca4d2ef 100644 --- a/tests/test-chown.h +++ b/tests/test-chown.h @@ -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..e4bedd9e7 100644 --- a/tests/test-lchown.h +++ b/tests/test-lchown.h @@ -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..c79ed6c0e 100644 --- a/tests/test-stat-time.c +++ b/tests/test-stat-time.c @@ -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.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);