Module Name:    src
Committed By:   rillig
Date:           Sat Aug 19 10:33:32 UTC 2023

Modified Files:
        src/usr.bin/make/unit-tests: directive-export-gmake.exp
            directive-export-gmake.mk varmod-gmtime.mk

Log Message:
tests/make: provide instructions for reproducing bug in gmtime

The test is not enabled because its results differ too much between the
platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
    src/usr.bin/make/unit-tests/directive-export-gmake.exp
cvs rdiff -u -r1.3 -r1.4 \
    src/usr.bin/make/unit-tests/directive-export-gmake.mk
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varmod-gmtime.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/directive-export-gmake.exp
diff -u src/usr.bin/make/unit-tests/directive-export-gmake.exp:1.1 src/usr.bin/make/unit-tests/directive-export-gmake.exp:1.2
--- src/usr.bin/make/unit-tests/directive-export-gmake.exp:1.1	Fri Oct  2 20:34:59 2020
+++ src/usr.bin/make/unit-tests/directive-export-gmake.exp	Sat Aug 19 10:33:32 2023
@@ -1 +1,4 @@
-exit status 0
+make: "directive-export-gmake.mk" line 74: Invalid line type
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1

Index: src/usr.bin/make/unit-tests/directive-export-gmake.mk
diff -u src/usr.bin/make/unit-tests/directive-export-gmake.mk:1.3 src/usr.bin/make/unit-tests/directive-export-gmake.mk:1.4
--- src/usr.bin/make/unit-tests/directive-export-gmake.mk:1.3	Tue Nov 17 20:16:44 2020
+++ src/usr.bin/make/unit-tests/directive-export-gmake.mk	Sat Aug 19 10:33:32 2023
@@ -1,4 +1,4 @@
-# $NetBSD: directive-export-gmake.mk,v 1.3 2020/11/17 20:16:44 rillig Exp $
+# $NetBSD: directive-export-gmake.mk,v 1.4 2023/08/19 10:33:32 rillig Exp $
 #
 # Tests for the export directive (without leading dot), as in GNU make.
 
@@ -60,5 +60,16 @@ export VAR=an ${UNDEF} variable
 .  error
 .endif
 
-all:
-	@:;
+
+# The body of the .for loop expands to 'export VAR=${:U1}', and the 'export'
+# directive is only recognized if the line does not contain a ':', to allow
+# 'export' to be a regular target.
+.for value in 1
+# FIXME: The below error message is missing all details.  But even if it
+# contained the text of the line, it would be confusing because at the point
+# where that error message is printed, all expressions from the line have
+# already been expanded as part of the dependency line parsing, which in this
+# case hides the ':' from the error message.
+# expect+1: Invalid line type
+export VAR=${value}
+.endfor

Index: src/usr.bin/make/unit-tests/varmod-gmtime.mk
diff -u src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.16 src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.17
--- src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.16	Sat Aug 19 08:19:25 2023
+++ src/usr.bin/make/unit-tests/varmod-gmtime.mk	Sat Aug 19 10:33:32 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-gmtime.mk,v 1.16 2023/08/19 08:19:25 rillig Exp $
+# $NetBSD: varmod-gmtime.mk,v 1.17 2023/08/19 10:33:32 rillig Exp $
 #
 # Tests for the :gmtime variable modifier, which formats a timestamp
 # using strftime(3) in UTC.
@@ -194,5 +194,33 @@
 #	* ':gmtime' reports the correct timezone offset '+0000'.
 #	* ':gmtime' reports different seconds since the Epoch, and the '%s'
 #	  value cannot be derived from the '%F %T %z' values.
+.if 0			# only for reference, due to platform differences
+export TZ=UTC
+.  for t in ${%s:L:gmtime} ${%s:L:localtime}
+TIMESTAMPS+= $t
+.  endfor
+export TZ=Europe/Berlin
+.  for t in ${%s:L:gmtime} ${%s:L:localtime}
+TIMESTAMPS+= $t
+.  endfor
+export TZ=UTC
+.  for t in ${%s:L:gmtime} ${%s:L:localtime}
+TIMESTAMPS+= $t
+.  endfor
+export TZ=America/Los_Angeles
+.  for t in ${%s:L:gmtime} ${%s:L:localtime}
+TIMESTAMPS+= $t
+.  endfor
+export TZ=UTC
+.  for t in ${%s:L:gmtime} ${%s:L:localtime}
+TIMESTAMPS+= $t
+.  endfor
+.  info ${TIMESTAMPS:u}
+.  for a b in ${TIMESTAMPS:[1]} ${TIMESTAMPS:@t@$t $t@} ${TIMESTAMPS:[-1]}
+.    if $a > $b
+.      warning timestamp $a > $b
+.    endif
+.  endfor
+.endif
 
 all:

Reply via email to