Module Name:    src
Committed By:   rillig
Date:           Tue Jan 19 05:26:34 UTC 2021

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

Log Message:
make(1): fix tests for :gmtime and :localtime for 32-bit time_t

The comparison operator had accidentally been '!=' instead of '=='.

While here, proofread the documentation and add references for where the
32-bit time_t is defined on Linux and FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-gmtime.exp
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-gmtime.mk
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-localtime.exp \
    src/usr.bin/make/unit-tests/varmod-localtime.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/varmod-gmtime.exp
diff -u src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.10 src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.11
--- src/usr.bin/make/unit-tests/varmod-gmtime.exp:1.10	Mon Dec 21 21:04:18 2020
+++ src/usr.bin/make/unit-tests/varmod-gmtime.exp	Tue Jan 19 05:26:34 2021
@@ -1,13 +1,13 @@
-make: "varmod-gmtime.mk" line 60: Invalid time value: ${:U1593536400}} != "mtime=11593536400}"
-make: "varmod-gmtime.mk" line 60: Malformed conditional (${%Y:L:gmtime=${:U1593536400}} != "mtime=11593536400}")
-make: "varmod-gmtime.mk" line 70: Invalid time value: -1} != ""
-make: "varmod-gmtime.mk" line 70: Malformed conditional (${:L:gmtime=-1} != "")
-make: "varmod-gmtime.mk" line 79: Invalid time value:  1} != ""
-make: "varmod-gmtime.mk" line 79: Malformed conditional (${:L:gmtime= 1} != "")
-make: "varmod-gmtime.mk" line 118: Invalid time value: 10000000000000000000000000000000} != ""
-make: "varmod-gmtime.mk" line 118: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "")
-make: "varmod-gmtime.mk" line 129: Invalid time value: error} != ""
-make: "varmod-gmtime.mk" line 129: Malformed conditional (${:L:gmtime=error} != "")
+make: "varmod-gmtime.mk" line 57: Invalid time value: ${:U1593536400}} != "mtime=11593536400}"
+make: "varmod-gmtime.mk" line 57: Malformed conditional (${%Y:L:gmtime=${:U1593536400}} != "mtime=11593536400}")
+make: "varmod-gmtime.mk" line 67: Invalid time value: -1} != ""
+make: "varmod-gmtime.mk" line 67: Malformed conditional (${:L:gmtime=-1} != "")
+make: "varmod-gmtime.mk" line 76: Invalid time value:  1} != ""
+make: "varmod-gmtime.mk" line 76: Malformed conditional (${:L:gmtime= 1} != "")
+make: "varmod-gmtime.mk" line 119: Invalid time value: 10000000000000000000000000000000} != ""
+make: "varmod-gmtime.mk" line 119: Malformed conditional (${:L:gmtime=10000000000000000000000000000000} != "")
+make: "varmod-gmtime.mk" line 130: Invalid time value: error} != ""
+make: "varmod-gmtime.mk" line 130: Malformed conditional (${:L:gmtime=error} != "")
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/varmod-gmtime.mk
diff -u src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.9 src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.10
--- src/usr.bin/make/unit-tests/varmod-gmtime.mk:1.9	Tue Dec 22 07:22:39 2020
+++ src/usr.bin/make/unit-tests/varmod-gmtime.mk	Tue Jan 19 05:26:34 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-gmtime.mk,v 1.9 2020/12/22 07:22:39 rillig Exp $
+# $NetBSD: varmod-gmtime.mk,v 1.10 2021/01/19 05:26:34 rillig Exp $
 #
 # Tests for the :gmtime variable modifier, which formats a timestamp
 # using strftime(3) in UTC.
@@ -54,9 +54,6 @@
 #
 # If ApplyModifier_Gmtime were to pass its argument through
 # ParseModifierPart, this would work.
-#
-# XXX: Where does the empty line 4 in varmod-gmtime.exp come from?
-# TODO: Remove the \n from "Invalid time value: %s\n" in var.c.
 .if ${%Y:L:gmtime=${:U1593536400}} != "mtime=11593536400}"
 .  error
 .endif
@@ -74,8 +71,8 @@
 .endif
 
 
-# Spaces were allowed before var.c 1.631, not because it would make sense
-# but just as a side-effect from using strtoul.
+# Spaces were allowed before var.c 1.631 from 2020-10-31 21:40:20, not
+# because it would make sense but just as a side-effect from using strtoul.
 .if ${:L:gmtime= 1} != ""
 .  error
 .endif
@@ -102,8 +99,12 @@
 
 .if ${:L:gmtime=2147483648} == "Tue Jan 19 03:14:08 2038"
 # All systems that have unsigned time_t or 64-bit time_t.
-.elif ${:L:gmtime=2147483648} != "Fri Dec 13 20:45:52 1901"
-# FreeBSD-12.0-i386 still has 32-bit signed time_t.
+.elif ${:L:gmtime=2147483648} == "Fri Dec 13 20:45:52 1901"
+# FreeBSD-12.0-i386 still has 32-bit signed time_t, see
+# sys/x86/include/_types.h, __LP64__.
+#
+# Linux on 32-bit systems may still have 32-bit signed time_t, see
+# sysdeps/unix/sysv/linux/generic/bits/typesizes.h, __TIMESIZE.
 .else
 .  error
 .endif
@@ -122,7 +123,7 @@
 .endif
 
 # Before var.c 1.631 from 2020-10-31, there was no error handling while
-# parsing the :gmtime modifier, thus no error message is printed.  Parsing
+# parsing the :gmtime modifier, thus no error message was printed.  Parsing
 # stopped after the '=', and the remaining string was parsed for more variable
 # modifiers.  Because of the unknown modifier 'e' from the 'error', the whole
 # variable value was discarded and thus not printed.

Index: src/usr.bin/make/unit-tests/varmod-localtime.exp
diff -u src/usr.bin/make/unit-tests/varmod-localtime.exp:1.7 src/usr.bin/make/unit-tests/varmod-localtime.exp:1.8
--- src/usr.bin/make/unit-tests/varmod-localtime.exp:1.7	Mon Dec 21 21:04:18 2020
+++ src/usr.bin/make/unit-tests/varmod-localtime.exp	Tue Jan 19 05:26:34 2021
@@ -1,13 +1,13 @@
-make: "varmod-localtime.mk" line 60: Invalid time value: ${:U1593536400}} != "mtime=11593536400}"
-make: "varmod-localtime.mk" line 60: Malformed conditional (${%Y:L:localtime=${:U1593536400}} != "mtime=11593536400}")
-make: "varmod-localtime.mk" line 70: Invalid time value: -1} != ""
-make: "varmod-localtime.mk" line 70: Malformed conditional (${:L:localtime=-1} != "")
-make: "varmod-localtime.mk" line 79: Invalid time value:  1} != ""
-make: "varmod-localtime.mk" line 79: Malformed conditional (${:L:localtime= 1} != "")
-make: "varmod-localtime.mk" line 118: Invalid time value: 10000000000000000000000000000000} != ""
-make: "varmod-localtime.mk" line 118: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "")
-make: "varmod-localtime.mk" line 129: Invalid time value: error} != ""
-make: "varmod-localtime.mk" line 129: Malformed conditional (${:L:localtime=error} != "")
+make: "varmod-localtime.mk" line 57: Invalid time value: ${:U1593536400}} != "mtime=11593536400}"
+make: "varmod-localtime.mk" line 57: Malformed conditional (${%Y:L:localtime=${:U1593536400}} != "mtime=11593536400}")
+make: "varmod-localtime.mk" line 67: Invalid time value: -1} != ""
+make: "varmod-localtime.mk" line 67: Malformed conditional (${:L:localtime=-1} != "")
+make: "varmod-localtime.mk" line 76: Invalid time value:  1} != ""
+make: "varmod-localtime.mk" line 76: Malformed conditional (${:L:localtime= 1} != "")
+make: "varmod-localtime.mk" line 119: Invalid time value: 10000000000000000000000000000000} != ""
+make: "varmod-localtime.mk" line 119: Malformed conditional (${:L:localtime=10000000000000000000000000000000} != "")
+make: "varmod-localtime.mk" line 130: Invalid time value: error} != ""
+make: "varmod-localtime.mk" line 130: Malformed conditional (${:L:localtime=error} != "")
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
Index: src/usr.bin/make/unit-tests/varmod-localtime.mk
diff -u src/usr.bin/make/unit-tests/varmod-localtime.mk:1.7 src/usr.bin/make/unit-tests/varmod-localtime.mk:1.8
--- src/usr.bin/make/unit-tests/varmod-localtime.mk:1.7	Tue Dec 22 07:22:39 2020
+++ src/usr.bin/make/unit-tests/varmod-localtime.mk	Tue Jan 19 05:26:34 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-localtime.mk,v 1.7 2020/12/22 07:22:39 rillig Exp $
+# $NetBSD: varmod-localtime.mk,v 1.8 2021/01/19 05:26:34 rillig Exp $
 #
 # Tests for the :localtime variable modifier, which formats a timestamp
 # using strftime(3) in local time.
@@ -36,7 +36,7 @@
 
 # If the modifier name is not matched exactly, fall back to the
 # :from=to modifier.
-.if ${gmtime:L:gm%=local%} != "localtime"
+.if ${localtime:L:local%=gm%} != "gmtime"
 .  error
 .endif
 
@@ -54,9 +54,6 @@
 #
 # If ApplyModifier_Localtime were to pass its argument through
 # ParseModifierPart, this would work.
-#
-# XXX: Where does the empty line 4 in varmod-localtime.exp come from?
-# TODO: Remove the \n from "Invalid time value: %s\n" in var.c.
 .if ${%Y:L:localtime=${:U1593536400}} != "mtime=11593536400}"
 .  error
 .endif
@@ -74,8 +71,8 @@
 .endif
 
 
-# Spaces were allowed before var.c 1.631, not because it would make sense
-# but just as a side-effect from using strtoul.
+# Spaces were allowed before var.c 1.631 from 2020-10-31 21:40:20, not
+# because it would make sense but just as a side-effect from using strtoul.
 .if ${:L:localtime= 1} != ""
 .  error
 .endif
@@ -102,8 +99,12 @@
 
 .if ${:L:localtime=2147483648} == "Tue Jan 19 04:14:08 2038"
 # All systems that have unsigned time_t or 64-bit time_t.
-.elif ${:L:localtime=2147483648} != "Fri Dec 13 21:45:52 1901"
-# FreeBSD-12.0-i386 still has 32-bit signed time_t.
+.elif ${:L:localtime=2147483648} == "Fri Dec 13 21:45:52 1901"
+# FreeBSD-12.0-i386 still has 32-bit signed time_t, see
+# sys/x86/include/_types.h, __LP64__.
+#
+# Linux on 32-bit systems may still have 32-bit signed time_t, see
+# sysdeps/unix/sysv/linux/generic/bits/typesizes.h, __TIMESIZE.
 .else
 .  error
 .endif
@@ -122,7 +123,7 @@
 .endif
 
 # Before var.c 1.631 from 2020-10-31, there was no error handling while
-# parsing the :localtime modifier, thus no error message is printed.  Parsing
+# parsing the :localtime modifier, thus no error message was printed.  Parsing
 # stopped after the '=', and the remaining string was parsed for more variable
 # modifiers.  Because of the unknown modifier 'e' from the 'error', the whole
 # variable value was discarded and thus not printed.

Reply via email to