From 4c43a929191da9711045b8efe30bbdbbfb7e0bcb Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 27 May 2013 14:16:25 -0700 Subject: [PATCH] Add tests for 32- and 64-bit signed and unsigned time_t. * Makefile (TIME_T_ALTERNATIVES): New macro. (check_time_t_alternatives, clean_misc): New rules. (clean): Split out into clean_misc and removing tzpublic. (public): Add check_time_t. --- Makefile | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cca817c..912bab6 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,9 @@ TOPDIR= /usr/local TZDIR= $(TOPDIR)/etc/zoneinfo +# Types to try, as an alternative to time_t. int64_t should be first. +TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t + # The "tzselect", "zic", and "zdump" commands get installed in. . . ETCDIR= $(TOPDIR)/etc @@ -427,9 +430,10 @@ check_tables: checktab.awk $(PRIMARY_YDATA) check_web: $(WEB_PAGES) $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES) -clean: +clean_misc: rm -f core *.o *.out \ date tzselect version.h zdump zic yearistype +clean: clean_misc rm -f -r tzpublic maintainer-clean: clean @@ -440,7 +444,8 @@ maintainer-clean: clean names: @echo $(ENCHILADA) -public: check check_public set-timestamps tarballs signatures +public: check check_public check_time_t_alternatives \ + set-timestamps tarballs signatures # Set the time stamps to those of the git repository, if available, # and if the files have not changed since then. @@ -471,6 +476,35 @@ check_public: $(ENCHILADA) $(zic) -v -d tzpublic $(TDATA) rm -f -r tzpublic +# Check that the code works under various alternative +# implementations of time_t. +check_time_t_alternatives: + mkdir tzpublic + zones=`$(AWK) '/^[^#]/ { print $$3 }' tzpublic/int64_t.out && \ + tzpublic/$$type/etc/zdump -V -t $$range $$zones \ + >tzpublic/$$type.out && \ + diff -u tzpublic/int64_t.out tzpublic/$$type.out \ + || exit; \ + done + rm -f -r tzpublic + tarballs: tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz tzcode$(VERSION).tar.gz: $(COMMON) $(DOCS) $(SOURCES) $(MISC)