y2038: Add test coverage

It is enabled through a new rule, tests-y2038, which is built only
when the ABI supports the comapt 64-bit time_t (defined by the
header time64-compat.h, which also enables the creation of the
symbol Version for Linux).  It means the tests are not built
for ABI which already provide default 64-bit time_t.

The new rule already adds the required LFS and 64-bit time_t
compiler flags.

The current coverage is:

  * libc:
    - adjtime                       tst-adjtime-time64
    - adjtimex                      tst-adjtimex-time64
    - clock_adjtime                 tst-clock_adjtime-time64
    - clock_getres                  tst-clock-time64, tst-cpuclock1-time64
    - clock_gettime                 tst-clock-time64, tst-clock2-time64,
				    tst-cpuclock1-time64
    - clock_nanosleep               tst-clock_nanosleep-time64,
				    tst-cpuclock1-time64
    - clock_settime                 tst-clock2-time64
    - cnd_timedwait                 tst-cnd-timedwait-time64
    - ctime                         tst-ctime-time64
    - ctime_r                       tst-ctime-time64
    - difftime                      tst-difftime-time64
    - fstat                         tst-stat-time64
    - fstatat                       tst-stat-time64
    - futimens                      tst-futimens-time64
    - futimes                       tst-futimes-time64
    - futimesat                     tst-futimesat-time64
    - fts_*                         tst-fts-time64
    - getitimer                     tst-itimer-timer64
    - getrusage
    - gettimeofday                  tst-clock_nanosleep-time64
    - glob / globfree               tst-gnuglob64-time64
    - gmtime                        tst-gmtime-time64
    - gmtime_r                      tst-gmtime-time64
    - lstat                         tst-stat-time64
    - localtime                     tst-y2039-time64
    - localtime_t                   tst-y2039-time64
    - lutimes                       tst-lutimes-time64
    - mktime                        tst-mktime4-time64
    - mq_timedreceive               tst-mqueue{1248}-time64
    - mq_timedsend                  tst-mqueue{1248}-time64
    - msgctl                        test-sysvmsg-time64
    - mtx_timedlock                 tst-mtx-timedlock-time64
    - nanosleep                     tst-cpuclock{12}-time64,
				    tst-mqueue8-time64, tst-clock-time64
    - nftw / ftw                    ftwtest-time64
    - ntp_adjtime                   tst-ntp_adjtime-time64
    - ntp_gettime                   tst-ntp_gettime-time64
    - ntp_gettimex                  tst-ntp_gettimex-time64
    - ppoll                         tst-ppoll-time64
    - pselect                       tst-pselect-time64
    - pthread_clockjoin_np          tst-join14-time64
    - pthread_cond_clockwait        tst-cond11-time64
    - pthread_cond_timedwait        tst-abstime-time64
    - pthread_mutex_clocklock       tst-abstime-time64
    - pthread_mutex_timedlock       tst-abstime-time64
    - pthread_rwlock_clockrdlock    tst-abstime-time64, tst-rwlock14-time64
    - pthread_rwlock_clockwrlock    tst-abstime-time64, tst-rwlock14-time64
    - pthread_rwlock_timedrdlock    tst-abstime-time64, tst-rwlock14-time64
    - pthread_rwlock_timedwrlock    tst-abstime-time64, tst-rwlock14-time64
    - pthread_timedjoin_np          tst-join14-time64
    - recvmmsg                      tst-cancel4_2-time64
    - sched_rr_get_interval         tst-sched_rr_get_interval-time64
    - select                        tst-select-time64
    - sem_clockwait                 tst-sem5-time64
    - sem_timedwait                 tst-sem5-time64
    - semctl                        test-sysvsem-time64
    - semtimedop                    test-sysvsem-time64
    - setitimer                     tst-mqueue2-time64, tst-itimer-timer64
    - settimeofday                  tst-settimeofday-time64
    - shmctl                        test-sysvshm-time64
    - sigtimedwait                  tst-sigtimedwait-time64
    - stat                          tst-stat-time64
    - thrd_sleep                    tst-thrd-sleep-time64
    - time                          tst-mqueue{1248}-time64
    - timegm                        tst-timegm-time64
    - timer_gettime                 tst-timer4-time64
    - timer_settime                 tst-timer4-time64
    - timerfd_gettime               tst-timerfd-time64
    - timerfd_settime               tst-timerfd-time64
    - timespec_get                  tst-timespec_get-time64
    - timespec_getres               tst-timespec_getres-time64
    - utime                         tst-utime-time64
    - utimensat                     tst-utimensat-time64
    - utimes                        tst-utimes-time64
    - wait3                         tst-wait3-time64
    - wait4                         tst-wait4-time64

  * librt:
    - aio_suspend                   tst-aio6-time64
    - mq_timedreceive               tst-mqueue{1248}-time64
    - mq_timedsend                  tst-mqueue{1248}-time64
    - timer_gettime                 tst-timer4-time64
    - timer_settime                 tst-timer4-time64

  * libanl:
    - gai_suspend

Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Adhemerval Zanella 2021-02-17 15:59:34 -03:00
parent 372d2ef1f9
commit 088d3291ef
80 changed files with 385 additions and 30 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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

1
io/ftwtest-time64.c Normal file
View File

@ -0,0 +1 @@
#include "ftwtest.c"

1
io/tst-fts-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-fts.c"

2
io/tst-futimens-time64.c Normal file
View File

@ -0,0 +1,2 @@
#define struct_stat struct stat
#include "tst-futimens.c"

View File

@ -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 */

2
io/tst-futimes-time64.c Normal file
View File

@ -0,0 +1,2 @@
#define struct_stat struct stat
#include "tst-futimes.c"

View File

@ -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 */

View File

@ -0,0 +1,4 @@
#define struct_stat struct stat
#define fstat fstat
#define fstatat fstatat
#include "io/tst-futimesat.c"

View File

@ -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>

2
io/tst-lutimes-time64.c Normal file
View File

@ -0,0 +1,2 @@
#define struct_stat struct stat
#include "tst-lutimes.c"

View File

@ -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);

102
io/tst-stat-time64.c Normal file
View File

@ -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>

2
io/tst-utime-time64.c Normal file
View File

@ -0,0 +1,2 @@
#define struct_stat struct stat
#include "tst-utime.c"

View File

@ -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 */

View File

@ -0,0 +1,2 @@
#define struct_stat struct stat
#include "tst-utimensat.c"

View File

@ -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);

2
io/tst-utimes-time64.c Normal file
View File

@ -0,0 +1,2 @@
#define struct_stat struct stat
#include "tst-utimes.c"

View File

@ -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 */

View File

@ -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

View File

@ -0,0 +1 @@
#include "tst-pselect.c"

1
misc/tst-select-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-select.c"

View File

@ -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

View File

@ -0,0 +1 @@
#include "tst-cancel4_2.c"

View File

@ -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

View File

@ -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"

View File

@ -0,0 +1 @@
#include "tst-sched_rr_get_interval.c"

1
posix/tst-wait3-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-wait3.c"

1
posix/tst-wait4-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-wait4.c"

View File

@ -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)

1
rt/tst-aio6-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-aio6.c"

View File

@ -0,0 +1 @@
#include "tst-cpuclock2.c"

View File

@ -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>

1
rt/tst-mqueue1-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-mqueue1.c"

1
rt/tst-mqueue2-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-mqueue2.c"

1
rt/tst-mqueue4-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-mqueue4.c"

1
rt/tst-mqueue8-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-mqueue8.c"

1
rt/tst-timer4-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-timer4.c"

View File

@ -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

View File

@ -0,0 +1 @@
#include "tst-abstime.c"

View File

@ -0,0 +1 @@
#include "tst-cnd-timedwait.c"

View File

@ -0,0 +1 @@
#include "tst-cond11.c"

View File

@ -0,0 +1 @@
#include "tst-join14.c"

View File

@ -0,0 +1 @@
#include "tst-mtx-timedlock.c"

View File

@ -0,0 +1 @@
#include "tst-rwlock14.c"

View File

@ -0,0 +1 @@
#include "tst-sem5.c"

View File

@ -0,0 +1 @@
#include "tst-thrd-sleep.c"

View File

@ -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_*

View File

@ -0,0 +1 @@
#include "tst-adjtimex.c"

View File

@ -0,0 +1 @@
#include "tst-clock_adjtime.c"

View File

@ -0,0 +1 @@
#include "tst-ntp_adjtime.c"

View File

@ -0,0 +1 @@
#include "tst-ntp_gettime.c"

View File

@ -0,0 +1 @@
#include "tst-ntp_gettimex.c"

View File

@ -0,0 +1 @@
#include "tst-ppoll.c"

View File

@ -0,0 +1 @@
#include "tst-sigtimedwait.c"

View File

@ -0,0 +1 @@
#include "tst-timerfd.c"

View File

@ -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

View File

@ -0,0 +1 @@
#include "test-sysvmsg.c"

View File

@ -0,0 +1 @@
#include "test-sysvsem.c"

View File

@ -0,0 +1 @@
#include "test-sysvshm.c"

View File

@ -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)

View File

@ -0,0 +1 @@
#include <tst-adjtime.c>

1
time/tst-clock-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-clock.c"

1
time/tst-clock2-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-clock2.c"

View File

@ -0,0 +1 @@
#include "tst-clock_nanosleep.c"

View File

@ -0,0 +1 @@
#include <tst-clock_settime.c>

View File

@ -0,0 +1 @@
#include "tst-cpuclock1.c"

1
time/tst-ctime-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-ctime.c"

View File

@ -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;
}

View File

@ -0,0 +1 @@
#include "tst-difftime.c"

1
time/tst-gmtime-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-gmtime.c"

1
time/tst-itimer-time64.c Normal file
View File

@ -0,0 +1 @@
#include <time/tst-itimer.c>

View File

@ -0,0 +1 @@
#include "tst-mktime4.c"

View File

@ -0,0 +1 @@
#include <tst-settimeofday.c>

1
time/tst-timegm-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-timegm.c"

View File

@ -0,0 +1 @@
#include "tst-timespec_get.c"

View File

@ -0,0 +1 @@
#include "tst-timespec_getres.c"

1
time/tst-y2039-time64.c Normal file
View File

@ -0,0 +1 @@
#include "tst-y2039.c"

View File

@ -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");