[tz] [PROPOSED PATCH] Distribute .tzs file for regression testing

Paul Eggert eggert at cs.ucla.edu
Mon Aug 22 03:55:05 UTC 2016


* NEWS: Document this.
* Makefile (TZS_YEAR, TZS, TZS_NEW, TZS_DEPS): New macros.
(ENCHILADA): Add TZS.
($(TZS_NEW), $(TZS), force_tzs, check_tzs): New targets.
(check): Add check_tzs.
(clean): Remove *.dir.
(maintainer-clean): Remove $(TZS).
(set-timestamps.out): Set $(TZS)'s time stamp.
(check_public, check_time_t_alternatives): Use a temporary
directory name ending in .dir, to make it easier to clean these
directories out systematically.
(tzdata$(VERSION).tar.gz): Add $(TZS).
(.PHONY): Add force_tzs, check_tzs.
---
 Makefile | 71 ++++++++++++++++++++++++++++++++++++++++++++++------------------
 NEWS     | 12 +++++++----
 2 files changed, 59 insertions(+), 24 deletions(-)

diff --git a/Makefile b/Makefile
index bbe1ba8..fc18819 100644
--- a/Makefile
+++ b/Makefile
@@ -378,7 +378,12 @@ DATA=		$(YDATA) $(NDATA) backzone $(TABDATA) \
 			leap-seconds.list yearistype.sh
 AWK_SCRIPTS=	checklinks.awk checktab.awk leapseconds.awk
 MISC=		$(AWK_SCRIPTS) zoneinfo2tdf.pl
-ENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC)
+TZS_YEAR=	2050
+TZS=		to$(TZS_YEAR).tzs
+TZS_NEW=	to$(TZS_YEAR)new.tzs
+TZS_DEPS=	$(PRIMARY_YDATA) asctime.c localtime.c \
+			private.h tzfile.h zdump.c zic.c
+ENCHILADA=	$(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS)
 
 # And for the benefit of csh users on systems that assume the user
 # shell should be used to handle commands in Makefiles. . .
@@ -477,6 +482,27 @@ posix_packrat:
 
 zones:		$(REDO)
 
+$(TZS_NEW):	$(TDATA) zdump zic
+		mkdir -p tzs.dir
+		$(zic) -d tzs.dir $(TDATA)
+		$(AWK) '/^Link/{print $$1 "\t" $$2 "\t" $$3}' \
+		   $(TDATA) | LC_ALL=C sort >$@.out
+		zones=$$($(AWK) -v wd="$$(pwd)" \
+				'/^Zone/{print wd "/tzs.dir/" $$2}' $(TDATA) \
+			 | LC_ALL=C sort) && \
+		./zdump -i -c $(TZS_YEAR) $$zones >>$@.out
+		sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@
+		rm -fr tzs.dir $@.out
+
+# If $(TZS) does not already exist (e.g., old-format tarballs), create it.
+# If it exists but 'make check_tzs' fails, a maintainer should inspect the
+# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
+$(TZS):
+		$(MAKE) force_tzs
+
+force_tzs:	$(TZS_NEW)
+		cp $(TZS_NEW) $(TZS)
+
 libtz.a:	$(LIBOBJS)
 		$(AR) ru $@ $(LIBOBJS)
 		$(RANLIB) $@
@@ -496,7 +522,7 @@ tzselect:	tzselect.ksh
 		chmod +x $@
 
 check:		check_character_set check_white_space check_links check_sorted \
-		  check_tables check_web
+		  check_tables check_tzs check_web
 
 check_character_set: $(ENCHILADA)
 		LC_ALL=en_US.utf8 && export LC_ALL && \
@@ -532,6 +558,9 @@ check_tables:	checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
 		    || exit; \
 		done
 
+check_tzs:	$(TZS) $(TZS_NEW)
+		diff -u $(TZS) $(TZS_NEW)
+
 check_web:	$(WEB_PAGES)
 		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
 
@@ -539,12 +568,12 @@ clean_misc:
 		rm -f core *.o *.out \
 		  date tzselect version.h zdump zic yearistype libtz.a
 clean:		clean_misc
-		rm -fr tzpublic
+		rm -fr *.dir $(TZS_NEW)
 
 maintainer-clean: clean
 		@echo 'This command is intended for maintainers to use; it'
 		@echo 'deletes files that may need special tools to rebuild.'
-		rm -f leapseconds $(MANTXTS) *.asc *.tar.gz
+		rm -f leapseconds $(MANTXTS) $(TZS) *.asc *.tar.gz
 
 names:
 		@echo $(ENCHILADA)
@@ -591,6 +620,7 @@ set-timestamps.out: $(ENCHILADA)
 		  touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \
 		    exit; \
 		done
+		touch -cmr $$(ls -t $(TZS_DEPS) | sed 1q) $(TZS)
 		touch $@
 
 # The zics below ensure that each data file can stand on its own.
@@ -599,12 +629,12 @@ set-timestamps.out: $(ENCHILADA)
 check_public:
 		$(MAKE) maintainer-clean
 		$(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL
-		mkdir tzpublic
+		mkdir -p public.dir
 		for i in $(TDATA) ; do \
-		  $(zic) -v -d tzpublic $$i 2>&1 || exit; \
+		  $(zic) -v -d public.dir $$i 2>&1 || exit; \
 		done
-		$(zic) -v -d tzpublic $(TDATA)
-		rm -fr tzpublic
+		$(zic) -v -d public.dir $(TDATA)
+		rm -fr public.dir
 
 # Check that the code works under various alternative
 # implementations of time_t.
@@ -616,15 +646,15 @@ check_time_t_alternatives:
 		fi && \
 		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
 		for type in $(TIME_T_ALTERNATIVES); do \
-		  mkdir -p tzpublic/$$type && \
+		  mkdir -p time_t.dir/$$type && \
 		  $(MAKE) clean_misc && \
-		  $(MAKE) TOPDIR=`pwd`/tzpublic/$$type \
+		  $(MAKE) TOPDIR=$$(pwd)/time_t.dir/$$type \
 		    CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
 		    REDO='$(REDO)' \
 		    install && \
 		  diff $$quiet_option -r \
-		    tzpublic/int64_t/etc/zoneinfo \
-		    tzpublic/$$type/etc/zoneinfo && \
+		    time_t.dir/int64_t/etc/zoneinfo \
+		    time_t.dir/$$type/etc/zoneinfo && \
 		  case $$type in \
 		  int32_t) range=-2147483648,2147483647;; \
 		  uint32_t) range=0,4294967296;; \
@@ -633,14 +663,14 @@ check_time_t_alternatives:
 		  *) 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 \
+		  time_t.dir/int64_t/etc/zdump -V -t $$range $$zones \
+		      >time_t.dir/int64_t.out && \
+		  time_t.dir/$$type/etc/zdump -V -t $$range $$zones \
+		      >time_t.dir/$$type.out && \
+		  diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \
 		    || exit; \
 		done
-		rm -fr tzpublic
+		rm -fr time_t.dir
 
 tarballs:	tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
 
@@ -652,7 +682,7 @@ tzcode$(VERSION).tar.gz: set-timestamps.out
 
 tzdata$(VERSION).tar.gz: set-timestamps.out
 		LC_ALL=C && export LC_ALL && \
-		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \
+		tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) $(TZS) | \
 		  gzip $(GZIPFLAGS) > $@
 
 signatures:	tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc
@@ -688,7 +718,8 @@ zic.o:		private.h tzfile.h version.h
 .PHONY: ALL INSTALL all
 .PHONY: check check_character_set check_links
 .PHONY: check_public check_sorted check_tables
-.PHONY: check_time_t_alternatives check_web check_white_space clean clean_misc
+.PHONY: check_time_t_alternatives check_tzs check_web check_white_space
+.PHONY: clean clean_misc force_tzs
 .PHONY: install install_data maintainer-clean names
 .PHONY: posix_only posix_packrat posix_right
 .PHONY: public right_only right_posix signatures tarballs typecheck
diff --git a/NEWS b/NEWS
index 3d01581..023883b 100644
--- a/NEWS
+++ b/NEWS
@@ -2,18 +2,18 @@ News for the tz database
 
 Unreleased, experimental changes
 
-  Changes affecting future time stamps
+  Changes to future time stamps
 
     New leap second 2016-12-31 23:59:60 UTC as per IERS Bulletin C 52.
     (Thanks to Tim Parenti.)
 
-  Changes affecting past time stamps
+  Changes to past time stamps
 
     For America/Los_Angeles, spring-forward transition times have been
     corrected from 02:00 to 02:01 in 1948, and from 02:00 to 01:00 in
     1950-1966.
 
-  Changes affecting code
+  Changes to code
 
     zic no longer generates binary files containing POSIX TZ-like
     strings that disagree with the local time type after the last
@@ -28,7 +28,11 @@ Unreleased, experimental changes
     (Thanks to Jon Skeet for suggesting that an option was needed,
     and thanks to Tim Parenti and Chris Rovick for further comments.)
 
-  Changes affecting documentation and commentary
+    The tzdata distribution has a new file to2050.tzs that contains
+    what should be the output of 'zdump -i -c 2050' on primary zones.
+    'make check' now checks that zdump generates this output.
+
+  Changes to documentation and commentary
 
     tzfile.5 now documents the new restriction on POSIX TZ-like
     strings that is now implemented by zic.
-- 
2.5.5



More information about the tz mailing list