aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makeconfig14
-rw-r--r--Makerules18
-rw-r--r--io/Makefile22
-rw-r--r--io/ftwtest-time64.c1
-rw-r--r--io/tst-fts-time64.c1
-rw-r--r--io/tst-futimens-time64.c2
-rw-r--r--io/tst-futimens.c6
-rw-r--r--io/tst-futimes-time64.c2
-rw-r--r--io/tst-futimes.c6
-rw-r--r--io/tst-futimesat-time64.c4
-rw-r--r--io/tst-futimesat.c47
-rw-r--r--io/tst-lutimes-time64.c2
-rw-r--r--io/tst-lutimes.c10
-rw-r--r--io/tst-stat-time64.c102
-rw-r--r--io/tst-utime-time64.c2
-rw-r--r--io/tst-utime.c6
-rw-r--r--io/tst-utimensat-time64.c2
-rw-r--r--io/tst-utimensat.c12
-rw-r--r--io/tst-utimes-time64.c2
-rw-r--r--io/tst-utimes.c6
-rw-r--r--misc/Makefile4
-rw-r--r--misc/tst-pselect-time64.c1
-rw-r--r--misc/tst-select-time64.c1
-rw-r--r--nptl/Makefile3
-rw-r--r--nptl/tst-cancel4_2-time64.c1
-rw-r--r--posix/Makefile2
-rw-r--r--posix/tst-gnuglob64-time64.c7
-rw-r--r--posix/tst-sched_rr_get_interval-time64.c1
-rw-r--r--posix/tst-wait3-time64.c1
-rw-r--r--posix/tst-wait4-time64.c1
-rw-r--r--rt/Makefile9
-rw-r--r--rt/tst-aio6-time64.c1
-rw-r--r--rt/tst-cpuclock2-time64.c1
-rw-r--r--rt/tst-cpuclock2.c9
-rw-r--r--rt/tst-mqueue1-time64.c1
-rw-r--r--rt/tst-mqueue2-time64.c1
-rw-r--r--rt/tst-mqueue4-time64.c1
-rw-r--r--rt/tst-mqueue8-time64.c1
-rw-r--r--rt/tst-timer4-time64.c1
-rw-r--r--sysdeps/pthread/Makefile10
-rw-r--r--sysdeps/pthread/tst-abstime-time64.c1
-rw-r--r--sysdeps/pthread/tst-cnd-timedwait-time64.c1
-rw-r--r--sysdeps/pthread/tst-cond11-time64.c1
-rw-r--r--sysdeps/pthread/tst-join14-time64.c1
-rw-r--r--sysdeps/pthread/tst-mtx-timedlock-time64.c1
-rw-r--r--sysdeps/pthread/tst-rwlock14-time64.c1
-rw-r--r--sysdeps/pthread/tst-sem5-time64.c1
-rw-r--r--sysdeps/pthread/tst-thrd-sleep-time64.c1
-rw-r--r--sysdeps/unix/sysv/linux/Makefile10
-rw-r--r--sysdeps/unix/sysv/linux/tst-adjtimex-time64.c1
-rw-r--r--sysdeps/unix/sysv/linux/tst-clock_adjtime-time64.c1
-rw-r--r--sysdeps/unix/sysv/linux/tst-ntp_adjtime-time64.c1
-rw-r--r--sysdeps/unix/sysv/linux/tst-ntp_gettime-time64.c1
-rw-r--r--sysdeps/unix/sysv/linux/tst-ntp_gettimex-time64.c1
-rw-r--r--sysdeps/unix/sysv/linux/tst-ppoll-time64.c1
-rw-r--r--sysdeps/unix/sysv/linux/tst-sigtimedwait-time64.c1
-rw-r--r--sysdeps/unix/sysv/linux/tst-timerfd-time64.c1
-rw-r--r--sysvipc/Makefile2
-rw-r--r--sysvipc/test-sysvmsg-time64.c1
-rw-r--r--sysvipc/test-sysvsem-time64.c1
-rw-r--r--sysvipc/test-sysvshm-time64.c1
-rw-r--r--time/Makefile18
-rw-r--r--time/tst-adjtime-time64.c1
-rw-r--r--time/tst-clock-time64.c1
-rw-r--r--time/tst-clock2-time64.c1
-rw-r--r--time/tst-clock_nanosleep-time64.c1
-rw-r--r--time/tst-clock_settime-time64.c1
-rw-r--r--time/tst-cpuclock1-time64.c1
-rw-r--r--time/tst-ctime-time64.c1
-rw-r--r--time/tst-ctime.c16
-rw-r--r--time/tst-difftime-time64.c1
-rw-r--r--time/tst-gmtime-time64.c1
-rw-r--r--time/tst-itimer-time64.c1
-rw-r--r--time/tst-mktime4-time64.c1
-rw-r--r--time/tst-settimeofday-time64.c1
-rw-r--r--time/tst-timegm-time64.c1
-rw-r--r--time/tst-timespec_get-time64.c1
-rw-r--r--time/tst-timespec_getres-time64.c1
-rw-r--r--time/tst-y2039-time64.c1
-rw-r--r--time/tst-y2039.c10
80 files changed, 385 insertions, 30 deletions
diff --git a/Makeconfig b/Makeconfig
index c3496452b6..b6357d0b19 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1235,6 +1235,20 @@ $(common-objpfx)versions.stmp: $(common-objpfx)Versions.all \
touch $@
endif # avoid-generated
endif # $(build-shared) = yes
+
+-include $(common-objpfx)time64-compat.mk
+postclean-generated += time64-compat.mk
+
+$(common-objpfx)time64-compat.mk: $(sysd-versions-force) \
+ $(common-objpfx)time64-compat.i
+ sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T
+ mv -f $@T $@
+$(common-objpfx)time64-compat.i: $(..)Makeconfig
+ printf "#include <time64-compat.h>\n#ifdef TIME64_NON_DEFAULT\nhave-time64-compat = yes\n#endif" \
+ | $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - > $@T
+ mv -f $@T $@
+
+
endif # sysd-sorted-done
# The name under which the run-time dynamic linker is installed.
diff --git a/Makerules b/Makerules
index ca9885436e..12f1a5cb50 100644
--- a/Makerules
+++ b/Makerules
@@ -771,7 +771,8 @@ endif
$(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
$(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \
$(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \
- $(addsuffix .d,$(tests) $(tests-internal) $(xtests) $(test-srcs))
+ $(addsuffix .d,$(tests) $(tests-internal) $(xtests) \
+ $(test-srcs) $(tests-time64) $(xtests-time64))
ifeq ($(build-programs),yes)
+depfiles += $(addsuffix .d,$(others) $(sysdep-others))
endif
@@ -1286,6 +1287,21 @@ check: tests
.PHONY: xcheck
xcheck: xtests
+# Handle tests-time64 and xtests-time64 that should built with LFS
+# and 64-bit time support.
+include $(o-iterator)
+define o-iterator-doit
+$(foreach f,$(tests-time64) $(xtests-time64),\
+ $(objpfx)$(f)$(o)): CFLAGS += -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64
+endef
+object-suffixes-left := $(all-object-suffixes)
+include $(o-iterator)
+
+ifeq ($(have-time64-compat),yes)
+tests += $(foreach t,$(tests-time64),$(t))
+xtests += $(foreach t,$(xtests-time64),$(t))
+endif
+
# The only difference between MODULE_NAME=testsuite and MODULE_NAME=nonlib is
# that almost all internal declarations from config.h, libc-symbols.h, and
# include/*.h are not available to 'testsuite' code, but are to 'nonlib' code.
diff --git a/io/Makefile b/io/Makefile
index d35e966258..ba8bd37355 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -59,7 +59,7 @@ routines := \
ftw64-time64
others := pwd
-test-srcs := ftwtest
+test-srcs := ftwtest ftwtest-time64
tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \
tst-openat tst-unlinkat tst-fstatat tst-futimesat \
@@ -78,12 +78,24 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
tst-futimens \
tst-utimensat \
+tests-time64 := \
+ tst-futimens-time64 \
+ tst-futimes-time64\
+ tst-fts-time64 \
+ tst-lutimes-time64 \
+ tst-stat-time64 \
+ tst-futimesat-time64 \
+ tst-utime-time64 \
+ tst-utimensat-time64 \
+ tst-utimes-time64 \
+
# Likewise for statx, but we do not need static linking here.
tests-internal += tst-statx
tests-static += tst-statx
ifeq ($(run-built-tests),yes)
-tests-special += $(objpfx)ftwtest.out
+tests-special += $(objpfx)ftwtest.out \
+ $(objpfx)ftwtest-time64.out
endif
include ../Rules
@@ -125,8 +137,14 @@ tst-statvfs-ARGS = $(objpfx)tst-statvfs tst-statvfs.c /tmp
tst-open-tmpfile-ARGS = --test-dir=$(objpfx)
+CFLAGS-ftwtest-time64.c += -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64
+
ifeq ($(run-built-tests),yes)
$(objpfx)ftwtest.out: ftwtest-sh $(objpfx)ftwtest
$(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
$(evaluate-test)
+
+$(objpfx)ftwtest-time64.out: ftwtest-sh $(objpfx)ftwtest-time64
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
+ $(evaluate-test)
endif
diff --git a/io/ftwtest-time64.c b/io/ftwtest-time64.c
new file mode 100644
index 0000000000..67f1c46826
--- /dev/null
+++ b/io/ftwtest-time64.c
@@ -0,0 +1 @@
+#include "ftwtest.c"
diff --git a/io/tst-fts-time64.c b/io/tst-fts-time64.c
new file mode 100644
index 0000000000..a4a41fe1cf
--- /dev/null
+++ b/io/tst-fts-time64.c
@@ -0,0 +1 @@
+#include "tst-fts.c"
diff --git a/io/tst-futimens-time64.c b/io/tst-futimens-time64.c
new file mode 100644
index 0000000000..88fcb38489
--- /dev/null
+++ b/io/tst-futimens-time64.c
@@ -0,0 +1,2 @@
+#define struct_stat struct stat
+#include "tst-futimens.c"
diff --git a/io/tst-futimens.c b/io/tst-futimens.c
index b3e3f3137f..4c18ede573 100644
--- a/io/tst-futimens.c
+++ b/io/tst-futimens.c
@@ -20,13 +20,17 @@
#include <support/xunistd.h>
#include <sys/stat.h>
+#ifndef struct_stat
+# define struct_stat struct stat64
+#endif
+
static int
test_futimens_helper (const char *file, int fd, const struct timespec *ts)
{
int result = futimens (fd, ts);
TEST_VERIFY_EXIT (result == 0);
- struct stat64 st;
+ struct_stat st;
xfstat (fd, &st);
/* Check if seconds for atime match */
diff --git a/io/tst-futimes-time64.c b/io/tst-futimes-time64.c
new file mode 100644
index 0000000000..d489c265d1
--- /dev/null
+++ b/io/tst-futimes-time64.c
@@ -0,0 +1,2 @@
+#define struct_stat struct stat
+#include "tst-futimes.c"
diff --git a/io/tst-futimes.c b/io/tst-futimes.c
index bdef38d7cb..9575a4b08e 100644
--- a/io/tst-futimes.c
+++ b/io/tst-futimes.c
@@ -21,13 +21,17 @@
#include <sys/stat.h>
#include <sys/time.h>
+#ifndef struct_stat
+# define struct_stat struct stat64
+#endif
+
static int
test_futimens_helper (const char *file, int fd, const struct timeval *tv)
{
int r = futimes (fd, tv);
TEST_VERIFY_EXIT (r == 0);
- struct stat64 st;
+ struct_stat st;
xfstat (fd, &st);
/* Check if seconds for atime match */
diff --git a/io/tst-futimesat-time64.c b/io/tst-futimesat-time64.c
new file mode 100644
index 0000000000..f6c0500eef
--- /dev/null
+++ b/io/tst-futimesat-time64.c
@@ -0,0 +1,4 @@
+#define struct_stat struct stat
+#define fstat fstat
+#define fstatat fstatat
+#include "io/tst-futimesat.c"
diff --git a/io/tst-futimesat.c b/io/tst-futimesat.c
index af58ad06dd..c32ab2b668 100644
--- a/io/tst-futimesat.c
+++ b/io/tst-futimesat.c
@@ -1,4 +1,23 @@
+/* futimesat basic tests.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
#include <dirent.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -7,19 +26,19 @@
#include <sys/stat.h>
#include <sys/time.h>
+#include <support/test-driver.h>
+#include <support/temp_file.h>
-static void prepare (void);
-#define PREPARE(argc, argv) prepare ()
-
-static int do_test (void);
-#define TEST_FUNCTION do_test ()
-
-#include "../test-skeleton.c"
+#ifndef struct_stat
+# define struct_stat struct stat64
+# define fstat fstat64
+# define fstatat fstatat64
+#endif
static int dir_fd;
static void
-prepare (void)
+prepare (int argc, char *argv[])
{
size_t test_dir_len = strlen (test_dir);
static const char dir_name[] = "/tst-futimesat.XXXXXX";
@@ -48,7 +67,7 @@ prepare (void)
exit (1);
}
}
-
+#define PREPARE prepare
static int
do_test (void)
@@ -98,8 +117,8 @@ do_test (void)
write (fd, "hello", 5);
puts ("file created");
- struct stat64 st1;
- if (fstat64 (fd, &st1) != 0)
+ struct_stat st1;
+ if (fstat (fd, &st1) != 0)
{
puts ("fstat64 failed");
return 1;
@@ -118,8 +137,8 @@ do_test (void)
return 1;
}
- struct stat64 st2;
- if (fstatat64 (dir_fd, "some-file", &st2, 0) != 0)
+ struct_stat st2;
+ if (fstatat (dir_fd, "some-file", &st2, 0) != 0)
{
puts ("fstatat64 failed");
return 1;
@@ -146,3 +165,5 @@ do_test (void)
return 0;
}
+
+#include <support/test-driver.c>
diff --git a/io/tst-lutimes-time64.c b/io/tst-lutimes-time64.c
new file mode 100644
index 0000000000..06caec0a91
--- /dev/null
+++ b/io/tst-lutimes-time64.c
@@ -0,0 +1,2 @@
+#define struct_stat struct stat
+#include "tst-lutimes.c"
diff --git a/io/tst-lutimes.c b/io/tst-lutimes.c
index b2da3c5796..237a870415 100644
--- a/io/tst-lutimes.c
+++ b/io/tst-lutimes.c
@@ -21,23 +21,27 @@
#include <sys/stat.h>
#include <sys/time.h>
+#ifndef struct_stat
+# define struct_stat struct stat64
+#endif
+
static int
test_lutimes_helper (const char *testfile, int fd, const char *testlink,
const struct timeval *tv)
{
- struct stat64 stfile_orig;
+ struct_stat stfile_orig;
xlstat (testfile, &stfile_orig);
TEST_VERIFY_EXIT (lutimes (testlink, tv) == 0);
- struct stat64 stlink;
+ struct_stat stlink;
xlstat (testlink, &stlink);
TEST_COMPARE (stlink.st_atime, tv[0].tv_sec);
TEST_COMPARE (stlink.st_mtime, tv[1].tv_sec);
/* Check if the timestamp from original file is not changed. */
- struct stat64 stfile;
+ struct_stat stfile;
xlstat (testfile, &stfile);
TEST_COMPARE (stfile_orig.st_atime, stfile.st_atime);
diff --git a/io/tst-stat-time64.c b/io/tst-stat-time64.c
new file mode 100644
index 0000000000..8feded56d5
--- /dev/null
+++ b/io/tst-stat-time64.c
@@ -0,0 +1,102 @@
+/* Basic test of stat with 64-bit time_t interfaces.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <support/check.h>
+#include <support/support.h>
+#include <support/temp_file.h>
+#include <support/xunistd.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+
+/* The idea of the test is check whether the 64-bit time_t stat implementation
+ returns the expected value for comparable fields, so it does not really
+ matter whether statx uses a fallback implementation or not. */
+
+static void
+stat_check (int fd, const char *path, struct stat *st)
+{
+ TEST_COMPARE (stat (path, st), 0);
+}
+
+static void
+lstat_check (int fd, const char *path, struct stat *st)
+{
+ TEST_COMPARE (lstat (path, st), 0);
+}
+
+static void
+fstat_check (int fd, const char *path, struct stat *st)
+{
+ TEST_COMPARE (fstat (fd, st), 0);
+}
+
+static void
+fstatat_check (int fd, const char *path, struct stat *st)
+{
+ TEST_COMPARE (fstatat (fd, path, st, 0), 0);
+}
+
+typedef void (*test_t)(int, const char *path, struct stat *);
+
+static int
+do_test (void)
+{
+ char *path;
+ int fd = create_temp_file ("tst-statx-", &path);
+ TEST_VERIFY_EXIT (fd >= 0);
+ support_write_file_string (path, "abc");
+
+ struct statx stx;
+ TEST_COMPARE (statx (fd, path, 0, STATX_BASIC_STATS, &stx), 0);
+
+ for (test_t *test = (test_t[]) { stat_check, lstat_check, fstat_check,
+ fstatat_check, NULL };
+ *test != NULL; test++)
+ {
+ struct stat st;
+ (*test) (fd, path, &st);
+
+ TEST_COMPARE (stx.stx_dev_major, major (st.st_dev));
+ TEST_COMPARE (stx.stx_dev_minor, minor (st.st_dev));
+ TEST_COMPARE (stx.stx_ino, st.st_ino);
+ TEST_COMPARE (stx.stx_mode, st.st_mode);
+ TEST_COMPARE (stx.stx_nlink, st.st_nlink);
+ TEST_COMPARE (stx.stx_uid, st.st_uid);
+ TEST_COMPARE (stx.stx_gid, st.st_gid);
+ TEST_COMPARE (stx.stx_rdev_major, major (st.st_rdev));
+ TEST_COMPARE (stx.stx_rdev_minor, minor (st.st_rdev));
+ TEST_COMPARE (stx.stx_blksize, st.st_blksize);
+ TEST_COMPARE (stx.stx_blocks, st.st_blocks);
+
+ TEST_COMPARE (stx.stx_ctime.tv_sec, st.st_ctim.tv_sec);
+ TEST_COMPARE (stx.stx_ctime.tv_nsec, st.st_ctim.tv_nsec);
+ TEST_COMPARE (stx.stx_mtime.tv_sec, st.st_mtim.tv_sec);
+ TEST_COMPARE (stx.stx_mtime.tv_nsec, st.st_mtim.tv_nsec);
+ }
+
+ xclose (fd);
+ free (path);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/io/tst-utime-time64.c b/io/tst-utime-time64.c
new file mode 100644
index 0000000000..eb62f59126
--- /dev/null
+++ b/io/tst-utime-time64.c
@@ -0,0 +1,2 @@
+#define struct_stat struct stat
+#include "tst-utime.c"
diff --git a/io/tst-utime.c b/io/tst-utime.c
index 6269ef7929..0144e2a22a 100644
--- a/io/tst-utime.c
+++ b/io/tst-utime.c
@@ -21,13 +21,17 @@
#include <support/xunistd.h>
#include <sys/stat.h>
+#ifndef struct_stat
+# define struct_stat struct stat64
+#endif
+
static int
test_utime_helper (const char *file, int fd, const struct utimbuf *ut)
{
int result = utime (file, ut);
TEST_VERIFY_EXIT (result == 0);
- struct stat64 st;
+ struct_stat st;
xfstat (fd, &st);
/* Check if seconds for actime match */
diff --git a/io/tst-utimensat-time64.c b/io/tst-utimensat-time64.c
new file mode 100644
index 0000000000..7ac7d8df1d
--- /dev/null
+++ b/io/tst-utimensat-time64.c
@@ -0,0 +1,2 @@
+#define struct_stat struct stat
+#include "tst-utimensat.c"
diff --git a/io/tst-utimensat.c b/io/tst-utimensat.c
index 0c7c8470bc..062abdd8d3 100644
--- a/io/tst-utimensat.c
+++ b/io/tst-utimensat.c
@@ -22,6 +22,10 @@
#include <sys/stat.h>
#include <sys/time.h>
+#ifndef struct_stat
+# define struct_stat struct stat64
+#endif
+
static int
test_utimesat_helper (const char *testfile, int fd, const char *testlink,
const struct timespec *ts)
@@ -29,7 +33,7 @@ test_utimesat_helper (const char *testfile, int fd, const char *testlink,
{
TEST_VERIFY_EXIT (utimensat (fd, testfile, ts, 0) == 0);
- struct stat64 st;
+ struct_stat st;
xfstat (fd, &st);
/* Check if seconds for atime match */
@@ -40,20 +44,20 @@ test_utimesat_helper (const char *testfile, int fd, const char *testlink,
}
{
- struct stat64 stfile_orig;
+ struct_stat stfile_orig;
xlstat (testfile, &stfile_orig);
TEST_VERIFY_EXIT (utimensat (0 /* ignored */, testlink, ts,
AT_SYMLINK_NOFOLLOW)
== 0);
- struct stat64 stlink;
+ struct_stat stlink;
xlstat (testlink, &stlink);
TEST_COMPARE (stlink.st_atime, ts[0].tv_sec);
TEST_COMPARE (stlink.st_mtime, ts[1].tv_sec);
/* Check if the timestamp from original file is not changed. */
- struct stat64 stfile;
+ struct_stat stfile;
xlstat (testfile, &stfile);
TEST_COMPARE (stfile_orig.st_atime, stfile.st_atime);
diff --git a/io/tst-utimes-time64.c b/io/tst-utimes-time64.c
new file mode 100644
index 0000000000..234ec02541
--- /dev/null
+++ b/io/tst-utimes-time64.c
@@ -0,0 +1,2 @@
+#define struct_stat struct stat
+#include "tst-utimes.c"
diff --git a/io/tst-utimes.c b/io/tst-utimes.c
index 991ab0c7d3..e88efff45b 100644
--- a/io/tst-utimes.c
+++ b/io/tst-utimes.c
@@ -22,13 +22,17 @@
#include <sys/time.h>
#include <time.h>
+#ifndef struct_stat
+# define struct_stat struct stat64
+#endif
+
static int
test_utimes_helper (const char *file, int fd, const struct timeval *tv)
{
int result = utimes (file, tv);
TEST_VERIFY_EXIT (result == 0);
- struct stat64 st;
+ struct_stat st;
xfstat (fd, &st);
/* Check if seconds for atime match */
diff --git a/misc/Makefile b/misc/Makefile
index c103b6bff4..f34ab09fe3 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -90,6 +90,10 @@ tests := tst-dirname tst-tsearch tst-fdset tst-mntent tst-hsearch \
tst-ldbl-warn tst-ldbl-error tst-dbl-efgcvt tst-ldbl-efgcvt \
tst-mntent-autofs tst-syscalls tst-mntent-escape tst-select
+tests-time64 := \
+ tst-select-time64 \
+ tst-pselect-time64
+
# Tests which need libdl.
ifeq (yes,$(build-shared))
tests += tst-gethostid
diff --git a/misc/tst-pselect-time64.c b/misc/tst-pselect-time64.c
new file mode 100644
index 0000000000..15a1e49292
--- /dev/null
+++ b/misc/tst-pselect-time64.c
@@ -0,0 +1 @@
+#include "tst-pselect.c"
diff --git a/misc/tst-select-time64.c b/misc/tst-select-time64.c
new file mode 100644
index 0000000000..13120bfe31
--- /dev/null
+++ b/misc/tst-select-time64.c
@@ -0,0 +1 @@
+#include "tst-select.c"
diff --git a/nptl/Makefile b/nptl/Makefile
index 3e6cf0c21b..bbaf796771 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -325,6 +325,9 @@ xtests = tst-setuid1 tst-setuid1-static tst-setuid2 \
tst-mutexpp1 tst-mutexpp6 tst-mutexpp10 tst-setgroups \
tst-mutexpp5 tst-mutexpp9
+tests-time64 := \
+ tst-cancel4_2-time64
+
# This test can run into task limits because of a linux kernel bug
# and then cause the make process to fail too, see bug 24537.
xtests += tst-eintr1
diff --git a/nptl/tst-cancel4_2-time64.c b/nptl/tst-cancel4_2-time64.c
new file mode 100644
index 0000000000..4ac086a312
--- /dev/null
+++ b/nptl/tst-cancel4_2-time64.c
@@ -0,0 +1 @@
+#include "tst-cancel4_2.c"
diff --git a/posix/Makefile b/posix/Makefile
index c8c538fcee..8d139e54f6 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -122,7 +122,9 @@ endif
tests-internal := bug-regex5 bug-regex20 bug-regex33 \
tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3
tests-container := bug-ga2
+tests-time64 := tst-wait4-time64 tst-wait3-time64 tst-gnuglob64-time64
xtests := tst-getaddrinfo4 tst-getaddrinfo5 tst-sched_rr_get_interval
+xtests-time64 := tst-sched_rr_get_interval-time64
ifeq (yes,$(build-shared))
test-srcs := globtest
tests += wordexp-test tst-exec tst-spawn tst-spawn2 tst-spawn3
diff --git a/posix/tst-gnuglob64-time64.c b/posix/tst-gnuglob64-time64.c
new file mode 100644
index 0000000000..00922bcdc6
--- /dev/null
+++ b/posix/tst-gnuglob64-time64.c
@@ -0,0 +1,7 @@
+#define GLOB_FUNC glob
+#define GLOB_TYPE glob_t
+#define GLOBFREE_FUNC globfree
+#define DIRENT_STRUCT dirent
+#define STAT_STRUCT stat
+
+#include "tst-gnuglob-skeleton.c"
diff --git a/posix/tst-sched_rr_get_interval-time64.c b/posix/tst-sched_rr_get_interval-time64.c
new file mode 100644
index 0000000000..f4e66d2939
--- /dev/null
+++ b/posix/tst-sched_rr_get_interval-time64.c
@@ -0,0 +1 @@
+#include "tst-sched_rr_get_interval.c"
diff --git a/posix/tst-wait3-time64.c b/posix/tst-wait3-time64.c
new file mode 100644
index 0000000000..2837bc7a9e
--- /dev/null
+++ b/posix/tst-wait3-time64.c
@@ -0,0 +1 @@
+#include "tst-wait3.c"
diff --git a/posix/tst-wait4-time64.c b/posix/tst-wait4-time64.c
new file mode 100644
index 0000000000..12543b270f
--- /dev/null
+++ b/posix/tst-wait4-time64.c
@@ -0,0 +1 @@
+#include "tst-wait4.c"
diff --git a/rt/Makefile b/rt/Makefile
index 97c9bbd9de..797f2da51e 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -51,6 +51,15 @@ tests := tst-shm tst-timer tst-timer2 \
tst-shm-cancel
tests-internal := tst-timer-sigmask
+tests-time64 := \
+ tst-aio6-time64 \
+ tst-cpuclock2-time64 \
+ tst-mqueue1-time64 \
+ tst-mqueue2-time64 \
+ tst-mqueue4-time64 \
+ tst-mqueue8-time64 \
+ tst-timer4-time64
+
extra-libs := librt
extra-libs-others := $(extra-libs)
diff --git a/rt/tst-aio6-time64.c b/rt/tst-aio6-time64.c
new file mode 100644
index 0000000000..a386a577ec
--- /dev/null
+++ b/rt/tst-aio6-time64.c
@@ -0,0 +1 @@
+#include "tst-aio6.c"
diff --git a/rt/tst-cpuclock2-time64.c b/rt/tst-cpuclock2-time64.c
new file mode 100644
index 0000000000..05775522bb
--- /dev/null
+++ b/rt/tst-cpuclock2-time64.c
@@ -0,0 +1 @@
+#include "tst-cpuclock2.c"
diff --git a/rt/tst-cpuclock2.c b/rt/tst-cpuclock2.c
index c1c7ed2ad8..eebc3609d0 100644
--- a/rt/tst-cpuclock2.c
+++ b/rt/tst-cpuclock2.c
@@ -21,7 +21,11 @@
#if (_POSIX_THREADS - 0) <= 0
-# define TEST_FUNCTION 0
+static int
+do_test ()
+{
+ return 0;
+}
#else
@@ -330,7 +334,6 @@ do_test (void)
return result;
}
-# define TEST_FUNCTION do_test ()
#endif
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/rt/tst-mqueue1-time64.c b/rt/tst-mqueue1-time64.c
new file mode 100644
index 0000000000..9c600a9a97
--- /dev/null
+++ b/rt/tst-mqueue1-time64.c
@@ -0,0 +1 @@
+#include "tst-mqueue1.c"
diff --git a/rt/tst-mqueue2-time64.c b/rt/tst-mqueue2-time64.c
new file mode 100644
index 0000000000..9d49f0b196
--- /dev/null
+++ b/rt/tst-mqueue2-time64.c
@@ -0,0 +1 @@
+#include "tst-mqueue2.c"
diff --git a/rt/tst-mqueue4-time64.c b/rt/tst-mqueue4-time64.c
new file mode 100644
index 0000000000..c23a228dc4
--- /dev/null
+++ b/rt/tst-mqueue4-time64.c
@@ -0,0 +1 @@
+#include "tst-mqueue4.c"
diff --git a/rt/tst-mqueue8-time64.c b/rt/tst-mqueue8-time64.c
new file mode 100644
index 0000000000..972637f7f5
--- /dev/null
+++ b/rt/tst-mqueue8-time64.c
@@ -0,0 +1 @@
+#include "tst-mqueue8.c"
diff --git a/rt/tst-timer4-time64.c b/rt/tst-timer4-time64.c
new file mode 100644
index 0000000000..e47a593f10
--- /dev/null
+++ b/rt/tst-timer4-time64.c
@@ -0,0 +1 @@
+#include "tst-timer4.c"
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index e4690a7bc4..9e6ed3c6f7 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -124,6 +124,16 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
tst-unwind-thread \
tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
+tests-time64 := \
+ tst-abstime-time64 \
+ tst-cnd-timedwait-time64 \
+ tst-cond11-time64 \
+ tst-join14-time64 \
+ tst-mtx-timedlock-time64 \
+ tst-rwlock14-time64 \
+ tst-sem5-time64 \
+ tst-thrd-sleep-time64 \
+
# Files which must not be linked with libpthread.
tests-nolibpthread += tst-unload
diff --git a/sysdeps/pthread/tst-abstime-time64.c b/sysdeps/pthread/tst-abstime-time64.c
new file mode 100644
index 0000000000..2fc77cb365
--- /dev/null
+++ b/sysdeps/pthread/tst-abstime-time64.c
@@ -0,0 +1 @@
+#include "tst-abstime.c"
diff --git a/sysdeps/pthread/tst-cnd-timedwait-time64.c b/sysdeps/pthread/tst-cnd-timedwait-time64.c
new file mode 100644
index 0000000000..9b2abfd277
--- /dev/null
+++ b/sysdeps/pthread/tst-cnd-timedwait-time64.c
@@ -0,0 +1 @@
+#include "tst-cnd-timedwait.c"
diff --git a/sysdeps/pthread/tst-cond11-time64.c b/sysdeps/pthread/tst-cond11-time64.c
new file mode 100644
index 0000000000..9bccb8ec8b
--- /dev/null
+++ b/sysdeps/pthread/tst-cond11-time64.c
@@ -0,0 +1 @@
+#include "tst-cond11.c"
diff --git a/sysdeps/pthread/tst-join14-time64.c b/sysdeps/pthread/tst-join14-time64.c
new file mode 100644
index 0000000000..bed784ee24
--- /dev/null
+++ b/sysdeps/pthread/tst-join14-time64.c
@@ -0,0 +1 @@
+#include "tst-join14.c"
diff --git a/sysdeps/pthread/tst-mtx-timedlock-time64.c b/sysdeps/pthread/tst-mtx-timedlock-time64.c
new file mode 100644
index 0000000000..b3393c99ef
--- /dev/null
+++ b/sysdeps/pthread/tst-mtx-timedlock-time64.c
@@ -0,0 +1 @@
+#include "tst-mtx-timedlock.c"
diff --git a/sysdeps/pthread/tst-rwlock14-time64.c b/sysdeps/pthread/tst-rwlock14-time64.c
new file mode 100644
index 0000000000..ae9b1912cf
--- /dev/null
+++ b/sysdeps/pthread/tst-rwlock14-time64.c
@@ -0,0 +1 @@
+#include "tst-rwlock14.c"
diff --git a/sysdeps/pthread/tst-sem5-time64.c b/sysdeps/pthread/tst-sem5-time64.c
new file mode 100644
index 0000000000..89c2a14f94
--- /dev/null
+++ b/sysdeps/pthread/tst-sem5-time64.c
@@ -0,0 +1 @@
+#include "tst-sem5.c"
diff --git a/sysdeps/pthread/tst-thrd-sleep-time64.c b/sysdeps/pthread/tst-thrd-sleep-time64.c
new file mode 100644
index 0000000000..02837bd19f
--- /dev/null
+++ b/sysdeps/pthread/tst-thrd-sleep-time64.c
@@ -0,0 +1 @@
+#include "tst-thrd-sleep.c"
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index aedd02fd55..294c366e3b 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -125,6 +125,16 @@ endif
tests-internal += tst-sigcontext-get_pc
+tests-time64 += \
+ tst-adjtimex-time64 \
+ tst-clock_adjtime-time64 \
+ tst-ntp_adjtime-time64 \
+ tst-ntp_gettime-time64 \
+ tst-ntp_gettimex-time64 \
+ tst-ppoll-time64 \
+ tst-sigtimedwait-time64 \
+ tst-timerfd-time64 \
+
CFLAGS-tst-sigcontext-get_pc.c = -fasynchronous-unwind-tables
# Generate the list of SYS_* macros for the system calls (__NR_*
diff --git a/sysdeps/unix/sysv/linux/tst-adjtimex-time64.c b/sysdeps/unix/sysv/linux/tst-adjtimex-time64.c
new file mode 100644
index 0000000000..2b6988b7c4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-adjtimex-time64.c
@@ -0,0 +1 @@
+#include "tst-adjtimex.c"
diff --git a/sysdeps/unix/sysv/linux/tst-clock_adjtime-time64.c b/sysdeps/unix/sysv/linux/tst-clock_adjtime-time64.c
new file mode 100644
index 0000000000..9691e81229
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-clock_adjtime-time64.c
@@ -0,0 +1 @@
+#include "tst-clock_adjtime.c"
diff --git a/sysdeps/unix/sysv/linux/tst-ntp_adjtime-time64.c b/sysdeps/unix/sysv/linux/tst-ntp_adjtime-time64.c
new file mode 100644
index 0000000000..30e7380b02
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-ntp_adjtime-time64.c
@@ -0,0 +1 @@
+#include "tst-ntp_adjtime.c"
diff --git a/sysdeps/unix/sysv/linux/tst-ntp_gettime-time64.c b/sysdeps/unix/sysv/linux/tst-ntp_gettime-time64.c
new file mode 100644
index 0000000000..42caa66301
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-ntp_gettime-time64.c
@@ -0,0 +1 @@
+#include "tst-ntp_gettime.c"
diff --git a/sysdeps/unix/sysv/linux/tst-ntp_gettimex-time64.c b/sysdeps/unix/sysv/linux/tst-ntp_gettimex-time64.c
new file mode 100644
index 0000000000..3f017b3c22
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-ntp_gettimex-time64.c
@@ -0,0 +1 @@
+#include "tst-ntp_gettimex.c"
diff --git a/sysdeps/unix/sysv/linux/tst-ppoll-time64.c b/sysdeps/unix/sysv/linux/tst-ppoll-time64.c
new file mode 100644
index 0000000000..96ee2faee3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-ppoll-time64.c
@@ -0,0 +1 @@
+#include "tst-ppoll.c"
diff --git a/sysdeps/unix/sysv/linux/tst-sigtimedwait-time64.c b/sysdeps/unix/sysv/linux/tst-sigtimedwait-time64.c
new file mode 100644
index 0000000000..1513e81749
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-sigtimedwait-time64.c
@@ -0,0 +1 @@
+#include "tst-sigtimedwait.c"
diff --git a/sysdeps/unix/sysv/linux/tst-timerfd-time64.c b/sysdeps/unix/sysv/linux/tst-timerfd-time64.c
new file mode 100644
index 0000000000..bb17f48139
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-timerfd-time64.c
@@ -0,0 +1 @@
+#include "tst-timerfd.c"
diff --git a/sysvipc/Makefile b/sysvipc/Makefile
index a534791928..86911803b5 100644
--- a/sysvipc/Makefile
+++ b/sysvipc/Makefile
@@ -32,6 +32,8 @@ routines := ftok \
tests := test-sysvmsg test-sysvsem test-sysvshm
+tests-time64 := test-sysvmsg-time64 test-sysvsem-time64 test-sysvshm-time64
+
include ../Rules
CFLAGS-msgrcv.c += -fexceptions -fasynchronous-unwind-tables
diff --git a/sysvipc/test-sysvmsg-time64.c b/sysvipc/test-sysvmsg-time64.c
new file mode 100644
index 0000000000..c23e0c337e
--- /dev/null
+++ b/sysvipc/test-sysvmsg-time64.c
@@ -0,0 +1 @@
+#include "test-sysvmsg.c"
diff --git a/sysvipc/test-sysvsem-time64.c b/sysvipc/test-sysvsem-time64.c
new file mode 100644
index 0000000000..05c95068cd
--- /dev/null
+++ b/sysvipc/test-sysvsem-time64.c
@@ -0,0 +1 @@
+#include "test-sysvsem.c"
diff --git a/sysvipc/test-sysvshm-time64.c b/sysvipc/test-sysvshm-time64.c
new file mode 100644
index 0000000000..8e2963f563
--- /dev/null
+++ b/sysvipc/test-sysvshm-time64.c
@@ -0,0 +1 @@
+#include "test-sysvshm.c"
diff --git a/time/Makefile b/time/Makefile
index 805c79c4d0..c84bd5d3ec 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -52,6 +52,24 @@ tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
tst-settimeofday tst-itimer tst-gmtime tst-timegm \
tst-timespec_get tst-timespec_getres
+tests-time64 := \
+ tst-adjtime-time64 \
+ tst-clock-time64 \
+ tst-clock2-time64 \
+ tst-clock_nanosleep-time64 \
+ tst-clock_settime-time64 \
+ tst-cpuclock1-time64 \
+ tst-ctime-time64 \
+ tst-difftime-time64 \
+ tst-gmtime-time64 \
+ tst-itimer-time64 \
+ tst-mktime4-time64 \
+ tst-settimeofday-time64 \
+ tst-timegm-time64 \
+ tst-timespec_get-time64 \
+ tst-timespec_getres-time64 \
+ tst-y2039-time64
+
include ../Rules
ifeq ($(run-built-tests),yes)
diff --git a/time/tst-adjtime-time64.c b/time/tst-adjtime-time64.c
new file mode 100644
index 0000000000..097d6efc4b
--- /dev/null
+++ b/time/tst-adjtime-time64.c
@@ -0,0 +1 @@
+#include <tst-adjtime.c>
diff --git a/time/tst-clock-time64.c b/time/tst-clock-time64.c
new file mode 100644
index 0000000000..a1349678c8
--- /dev/null
+++ b/time/tst-clock-time64.c
@@ -0,0 +1 @@
+#include "tst-clock.c"
diff --git a/time/tst-clock2-time64.c b/time/tst-clock2-time64.c
new file mode 100644
index 0000000000..897f47b287
--- /dev/null
+++ b/time/tst-clock2-time64.c
@@ -0,0 +1 @@
+#include "tst-clock2.c"
diff --git a/time/tst-clock_nanosleep-time64.c b/time/tst-clock_nanosleep-time64.c
new file mode 100644
index 0000000000..c8638aa3d2
--- /dev/null
+++ b/time/tst-clock_nanosleep-time64.c
@@ -0,0 +1 @@
+#include "tst-clock_nanosleep.c"
diff --git a/time/tst-clock_settime-time64.c b/time/tst-clock_settime-time64.c
new file mode 100644
index 0000000000..328b04a030
--- /dev/null
+++ b/time/tst-clock_settime-time64.c
@@ -0,0 +1 @@
+#include <tst-clock_settime.c>
diff --git a/time/tst-cpuclock1-time64.c b/time/tst-cpuclock1-time64.c
new file mode 100644
index 0000000000..5a7ffa27ac
--- /dev/null
+++ b/time/tst-cpuclock1-time64.c
@@ -0,0 +1 @@
+#include "tst-cpuclock1.c"
diff --git a/time/tst-ctime-time64.c b/time/tst-ctime-time64.c
new file mode 100644
index 0000000000..24a5ae98ed
--- /dev/null
+++ b/time/tst-ctime-time64.c
@@ -0,0 +1 @@
+#include "tst-ctime.c"
diff --git a/time/tst-ctime.c b/time/tst-ctime.c
index e89a906bf8..884d69bfa0 100644
--- a/time/tst-ctime.c
+++ b/time/tst-ctime.c
@@ -24,6 +24,7 @@ static int
do_test (void)
{
char *str;
+ char strb[32];
time_t t;
/* Use glibc time zone extension "TZ=:" to to guarantee that UTC
@@ -36,11 +37,21 @@ do_test (void)
str = ctime (&t);
TEST_COMPARE_STRING (str, "Thu Jan 1 00:00:00 1970\n");
+ /* Same as before but with ctime_r. */
+ str = ctime_r (&t, strb);
+ TEST_VERIFY (str == strb);
+ TEST_COMPARE_STRING (str, "Thu Jan 1 00:00:00 1970\n");
+
/* Check if the max time value for 32 bit time_t can be converted. */
t = 0x7fffffff;
str = ctime (&t);
TEST_COMPARE_STRING (str, "Tue Jan 19 03:14:07 2038\n");
+ /* Same as before but with ctime_r. */
+ str = ctime_r (&t, strb);
+ TEST_VERIFY (str == strb);
+ TEST_COMPARE_STRING (str, "Tue Jan 19 03:14:07 2038\n");
+
/* Check if we run on port with 32 bit time_t size */
time_t tov;
if (__builtin_add_overflow (t, 1, &tov))
@@ -50,6 +61,11 @@ do_test (void)
str = ctime (&tov);
TEST_COMPARE_STRING (str, "Tue Jan 19 03:14:08 2038\n");
+ /* Same as before but with ctime_r. */
+ str = ctime_r (&tov, strb);
+ TEST_VERIFY (str == strb);
+ TEST_COMPARE_STRING (str, "Tue Jan 19 03:14:08 2038\n");
+
return 0;
}
diff --git a/time/tst-difftime-time64.c b/time/tst-difftime-time64.c
new file mode 100644
index 0000000000..751ce6c483
--- /dev/null
+++ b/time/tst-difftime-time64.c
@@ -0,0 +1 @@
+#include "tst-difftime.c"
diff --git a/time/tst-gmtime-time64.c b/time/tst-gmtime-time64.c
new file mode 100644
index 0000000000..0df11c1913
--- /dev/null
+++ b/time/tst-gmtime-time64.c
@@ -0,0 +1 @@
+#include "tst-gmtime.c"
diff --git a/time/tst-itimer-time64.c b/time/tst-itimer-time64.c
new file mode 100644
index 0000000000..ddd2efa175
--- /dev/null
+++ b/time/tst-itimer-time64.c
@@ -0,0 +1 @@
+#include <time/tst-itimer.c>
diff --git a/time/tst-mktime4-time64.c b/time/tst-mktime4-time64.c
new file mode 100644
index 0000000000..bf5197c6f3
--- /dev/null
+++ b/time/tst-mktime4-time64.c
@@ -0,0 +1 @@
+#include "tst-mktime4.c"
diff --git a/time/tst-settimeofday-time64.c b/time/tst-settimeofday-time64.c
new file mode 100644
index 0000000000..185d167a22
--- /dev/null
+++ b/time/tst-settimeofday-time64.c
@@ -0,0 +1 @@
+#include <tst-settimeofday.c>
diff --git a/time/tst-timegm-time64.c b/time/tst-timegm-time64.c
new file mode 100644
index 0000000000..8e3084f74e
--- /dev/null
+++ b/time/tst-timegm-time64.c
@@ -0,0 +1 @@
+#include "tst-timegm.c"
diff --git a/time/tst-timespec_get-time64.c b/time/tst-timespec_get-time64.c
new file mode 100644
index 0000000000..48f336385d
--- /dev/null
+++ b/time/tst-timespec_get-time64.c
@@ -0,0 +1 @@
+#include "tst-timespec_get.c"
diff --git a/time/tst-timespec_getres-time64.c b/time/tst-timespec_getres-time64.c
new file mode 100644
index 0000000000..59a0f36103
--- /dev/null
+++ b/time/tst-timespec_getres-time64.c
@@ -0,0 +1 @@
+#include "tst-timespec_getres.c"
diff --git a/time/tst-y2039-time64.c b/time/tst-y2039-time64.c
new file mode 100644
index 0000000000..3c8a504186
--- /dev/null
+++ b/time/tst-y2039-time64.c
@@ -0,0 +1 @@
+#include "tst-y2039.c"
diff --git a/time/tst-y2039.c b/time/tst-y2039.c
index ef024c0a77..66a22d4c2c 100644
--- a/time/tst-y2039.c
+++ b/time/tst-y2039.c
@@ -37,6 +37,16 @@ do_test (void)
> 0);
puts (buf);
TEST_VERIFY (strcmp (buf, "2039-04-30 14:00:00 PDT") == 0);
+
+ /* Same as before but for localtime_r. */
+ struct tm tmd;
+ tm = localtime_r (&ouch, &tmd);
+ TEST_VERIFY_EXIT (tm == &tmd);
+
+ TEST_VERIFY_EXIT (strftime (buf, sizeof buf, "%Y-%m-%d %H:%M:%S %Z", tm)
+ > 0);
+ puts (buf);
+ TEST_VERIFY (strcmp (buf, "2039-04-30 14:00:00 PDT") == 0);
}
else
FAIL_UNSUPPORTED ("32-bit time_t");