public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/y2038] y2038: Add test coverage
Date: Tue, 23 Feb 2021 20:41:24 +0000 (GMT)	[thread overview]
Message-ID: <20210223204124.CD7C43947C11@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2da1ca6bc2497a6b6836a1bd628375f4c7933c37

commit 2da1ca6bc2497a6b6836a1bd628375f4c7933c37
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Feb 17 15:59:34 2021 -0300

    y2038: Add test coverage
    
    A new 'tests-y2038' rule is added, which adds the required 64 bit
    time flags and included in the 'tests' rule.
    
    The current coverage is:
    
      * libc:
        - adjtime
        - adjtimex
        - clock_adjtime
        - clock_getres                      tst-clock, tst-cpuclock1
        - clock_gettime                     tst-clock, tst-clock2, tst-cpuclock1
        - clock_nanosleep                   tst-clock_nanosleep, tst-cpuclock1
        - clock_settime                     tst-clock2
        - ctime                             tst-ctime
        - ctime_r
        - difftime                          tst-difftime
        - fstat
        - fstatat
        - futimens
        - futimes
        - futimesat
        - getitimer
        - getrusage
        - gettimeofday                      tst-clock_nanosleep
        - gmtime
        - gmtime_r
        - lstat
        - lutimes
        - mktime
        - mq_timedreceive                   tst-mqueue{1248}
        - mq_timedsend                      tst-mqueue{1248}
        - nanosleep                         tst-cpuclock2, tst-mqueue8, tst-clock, tst-cpuclock1
        - ntp_adjtime
        - ntp_gettime
        - ntp_gettimex
        - ppoll64
        - pselect
        - recvmmsg                          tst-cancel4_2
        - sched_rr_get_interval
        - select
        - semtimedop
        - setitimer
        - settimeofday
        - sigtimedwait
        - stat
        - time                              tst-mqueue1, tst-mqueue2, tst-mqueue4, tst-mqueue8
        - timegm
        - timer_gettime                     tst-timer4
        - timer_settime
        - timerfd_gettime
        - timerfd_settime
        - timespec_get
        - utime
        - utimensat
        - utimes
        - wait3
        - wait4_time64
    
      * libpthread:
        - cnd_timedwait
        - mtx_timedlock
        - pthread_clockjoin_np
        - pthread_cond_clockwait
        - pthread_cond_timedwait
        - pthread_mutex_clocklock
        - pthread_mutex_timedlock
        - pthread_rwlock_clockrdlock
        - pthread_rwlock_clockwrlock
        - pthread_rwlock_timedrdlock
        - pthread_rwlock_timedwrlock
        - pthread_timedjoin_np
        - sem_clockwait
        - sem_timedwait
        - thrd_sleep
    
      * librt:
        - aio_suspend
        - mq_timedreceive                   tst-mqueue{1248}
        - mq_timedsend                      tst-mqueue{1248}
        - timer_gettime                     tst-timer4
        - timer_settime                     tst-timer4
    
      * libanl:
        - gai_suspend_time

Diff:
---
 Makerules                        | 13 ++++++++++++-
 nptl/Makefile                    |  3 +++
 nptl/tst-cancel4_2-y2038.c       |  1 +
 rt/Makefile                      |  8 ++++++++
 rt/tst-cpuclock2-y2038.c         |  1 +
 rt/tst-cpuclock2.c               |  9 ++++++---
 rt/tst-mqueue1-y2038.c           |  1 +
 rt/tst-mqueue2-y2038.c           |  1 +
 rt/tst-mqueue4-y2038.c           |  1 +
 rt/tst-mqueue8-y2038.c           |  1 +
 rt/tst-timer4-y2038.c            |  1 +
 time/Makefile                    |  9 +++++++++
 time/tst-clock-y2038.c           |  1 +
 time/tst-clock2-y2038.c          |  1 +
 time/tst-clock_nanosleep-y2038.c |  1 +
 time/tst-cpuclock1-y2038.c       |  1 +
 time/tst-ctime-y2038.c           |  1 +
 time/tst-difftime-y2038.c        |  1 +
 time/tst-mktime4-y2038.c         |  1 +
 19 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/Makerules b/Makerules
index fc5251ffad..0917a0d463 100644
--- a/Makerules
+++ b/Makerules
@@ -771,7 +771,7 @@ 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-y2038))
 ifeq ($(build-programs),yes)
 +depfiles += $(addsuffix .d,$(others) $(sysdep-others))
 endif
@@ -1286,6 +1286,17 @@ check: tests
 .PHONY: xcheck
 xcheck: xtests
 
+# Handle tests-y2038 tests they should be built with LFS and 64-bit time
+# support.
+include $(o-iterator)
+define o-iterator-doit
+$(foreach f,$(tests-y2038),$(objpfx)$(f)$(o)): CFLAGS += -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64
+endef
+object-suffixes-left := $(all-object-suffixes)
+include $(o-iterator)
+
+tests += $(foreach t,$(tests-y2038),$(t))
+
 # 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/nptl/Makefile b/nptl/Makefile
index 4dd9c6a6a8..3b75590acb 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -375,6 +375,9 @@ xtests = tst-setuid1 tst-setuid1-static tst-setuid2 \
 	tst-mutexpp1 tst-mutexpp6 tst-mutexpp10 tst-setgroups \
 	tst-mutexpp5 tst-mutexpp9
 
+tests-y2038 := \
+  tst-cancel4_2-y2038
+
 # 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-y2038.c b/nptl/tst-cancel4_2-y2038.c
new file mode 100644
index 0000000000..4ac086a312
--- /dev/null
+++ b/nptl/tst-cancel4_2-y2038.c
@@ -0,0 +1 @@
+#include "tst-cancel4_2.c"
diff --git a/rt/Makefile b/rt/Makefile
index 7b374f2073..5d037ea368 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -49,6 +49,14 @@ tests := tst-shm tst-timer tst-timer2 \
 	 tst-shm-cancel
 tests-internal := tst-timer-sigmask
 
+tests-y2038 := \
+  tst-cpuclock2-y2038 \
+  tst-mqueue1-y2038 \
+  tst-mqueue2-y2038 \
+  tst-mqueue4-y2038 \
+  tst-mqueue8-y2038 \
+  tst-timer4-y2038
+
 extra-libs := librt
 extra-libs-others := $(extra-libs)
 
diff --git a/rt/tst-cpuclock2-y2038.c b/rt/tst-cpuclock2-y2038.c
new file mode 100644
index 0000000000..05775522bb
--- /dev/null
+++ b/rt/tst-cpuclock2-y2038.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-y2038.c b/rt/tst-mqueue1-y2038.c
new file mode 100644
index 0000000000..9c600a9a97
--- /dev/null
+++ b/rt/tst-mqueue1-y2038.c
@@ -0,0 +1 @@
+#include "tst-mqueue1.c"
diff --git a/rt/tst-mqueue2-y2038.c b/rt/tst-mqueue2-y2038.c
new file mode 100644
index 0000000000..9d49f0b196
--- /dev/null
+++ b/rt/tst-mqueue2-y2038.c
@@ -0,0 +1 @@
+#include "tst-mqueue2.c"
diff --git a/rt/tst-mqueue4-y2038.c b/rt/tst-mqueue4-y2038.c
new file mode 100644
index 0000000000..c23a228dc4
--- /dev/null
+++ b/rt/tst-mqueue4-y2038.c
@@ -0,0 +1 @@
+#include "tst-mqueue4.c"
diff --git a/rt/tst-mqueue8-y2038.c b/rt/tst-mqueue8-y2038.c
new file mode 100644
index 0000000000..972637f7f5
--- /dev/null
+++ b/rt/tst-mqueue8-y2038.c
@@ -0,0 +1 @@
+#include "tst-mqueue8.c"
diff --git a/rt/tst-timer4-y2038.c b/rt/tst-timer4-y2038.c
new file mode 100644
index 0000000000..e47a593f10
--- /dev/null
+++ b/rt/tst-timer4-y2038.c
@@ -0,0 +1 @@
+#include "tst-timer4.c"
diff --git a/time/Makefile b/time/Makefile
index 0d571fb777..8b397d8c66 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -51,6 +51,15 @@ tests	:= test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
 	   tst-adjtime tst-ctime tst-difftime tst-mktime4 tst-clock_settime \
 	   tst-clock_adjtime
 
+tests-y2038 := \
+  tst-clock-y2038 \
+  tst-clock2-y2038 \
+  tst-clock_nanosleep-y2038 \
+  tst-cpuclock1-y2038 \
+  tst-ctime-y2038 \
+  tst-difftime-y2038 \
+  tst-mktime4-y2038
+
 include ../Rules
 
 ifeq ($(run-built-tests),yes)
diff --git a/time/tst-clock-y2038.c b/time/tst-clock-y2038.c
new file mode 100644
index 0000000000..a1349678c8
--- /dev/null
+++ b/time/tst-clock-y2038.c
@@ -0,0 +1 @@
+#include "tst-clock.c"
diff --git a/time/tst-clock2-y2038.c b/time/tst-clock2-y2038.c
new file mode 100644
index 0000000000..897f47b287
--- /dev/null
+++ b/time/tst-clock2-y2038.c
@@ -0,0 +1 @@
+#include "tst-clock2.c"
diff --git a/time/tst-clock_nanosleep-y2038.c b/time/tst-clock_nanosleep-y2038.c
new file mode 100644
index 0000000000..c8638aa3d2
--- /dev/null
+++ b/time/tst-clock_nanosleep-y2038.c
@@ -0,0 +1 @@
+#include "tst-clock_nanosleep.c"
diff --git a/time/tst-cpuclock1-y2038.c b/time/tst-cpuclock1-y2038.c
new file mode 100644
index 0000000000..5a7ffa27ac
--- /dev/null
+++ b/time/tst-cpuclock1-y2038.c
@@ -0,0 +1 @@
+#include "tst-cpuclock1.c"
diff --git a/time/tst-ctime-y2038.c b/time/tst-ctime-y2038.c
new file mode 100644
index 0000000000..24a5ae98ed
--- /dev/null
+++ b/time/tst-ctime-y2038.c
@@ -0,0 +1 @@
+#include "tst-ctime.c"
diff --git a/time/tst-difftime-y2038.c b/time/tst-difftime-y2038.c
new file mode 100644
index 0000000000..751ce6c483
--- /dev/null
+++ b/time/tst-difftime-y2038.c
@@ -0,0 +1 @@
+#include "tst-difftime.c"
diff --git a/time/tst-mktime4-y2038.c b/time/tst-mktime4-y2038.c
new file mode 100644
index 0000000000..bf5197c6f3
--- /dev/null
+++ b/time/tst-mktime4-y2038.c
@@ -0,0 +1 @@
+#include "tst-mktime4.c"


             reply	other threads:[~2021-02-23 20:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 20:41 Adhemerval Zanella [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-06-08 20:49 Adhemerval Zanella
2021-05-26 16:26 Adhemerval Zanella
2021-03-05 19:21 Adhemerval Zanella
2021-03-04 17:40 Adhemerval Zanella
2021-03-04 11:32 Adhemerval Zanella
2021-03-02 12:34 Adhemerval Zanella
2021-03-01 17:39 Adhemerval Zanella
2021-02-26 20:44 Adhemerval Zanella
2021-02-23 12:39 Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210223204124.CD7C43947C11@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).