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.
This commit is contained in:
Paul Eggert
2013-05-27 14:59:14 -07:00
parent 8a883a64cb
commit 4c43a92919
+36 -2
View File
@@ -53,6 +53,9 @@ TOPDIR= /usr/local
TZDIR= $(TOPDIR)/etc/zoneinfo 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. . . # The "tzselect", "zic", and "zdump" commands get installed in. . .
ETCDIR= $(TOPDIR)/etc ETCDIR= $(TOPDIR)/etc
@@ -427,9 +430,10 @@ check_tables: checktab.awk $(PRIMARY_YDATA)
check_web: $(WEB_PAGES) check_web: $(WEB_PAGES)
$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES) $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
clean: clean_misc:
rm -f core *.o *.out \ rm -f core *.o *.out \
date tzselect version.h zdump zic yearistype date tzselect version.h zdump zic yearistype
clean: clean_misc
rm -f -r tzpublic rm -f -r tzpublic
maintainer-clean: clean maintainer-clean: clean
@@ -440,7 +444,8 @@ maintainer-clean: clean
names: names:
@echo $(ENCHILADA) @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, # Set the time stamps to those of the git repository, if available,
# and if the files have not changed since then. # and if the files have not changed since then.
@@ -471,6 +476,35 @@ check_public: $(ENCHILADA)
$(zic) -v -d tzpublic $(TDATA) $(zic) -v -d tzpublic $(TDATA)
rm -f -r tzpublic 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 }' <zone.tab` && \
for type in $(TIME_T_ALTERNATIVES); do \
mkdir tzpublic/$$type && \
make clean_misc && \
make TOPDIR=`pwd`/tzpublic/$$type \
CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
install && \
diff -qr tzpublic/int64_t/etc/zoneinfo tzpublic/$$type/etc/zoneinfo && \
case $$type in \
int32_t) range=-2147483648,2147483647;; \
uint32_t) range=0,4294967296;; \
int64_t) continue;; \
*u*) range=0,10000000000;; \
*) range=-10000000000,10000000000;; \
esac && \
echo checking $$type zones ... && \
tzpublic/int64_t/etc/zdump -V -t $$range $$zones \
>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 tarballs: tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
tzcode$(VERSION).tar.gz: $(COMMON) $(DOCS) $(SOURCES) $(MISC) tzcode$(VERSION).tar.gz: $(COMMON) $(DOCS) $(SOURCES) $(MISC)