Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests make(1): fix tests for :gmtime and :...
details: https://anonhg.NetBSD.org/src/rev/09fc0348c9ae
branches: trunk
changeset: 950179:09fc0348c9ae
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Jan 19 05:26:34 2021 +0000
description:
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.
diffstat:
usr.bin/make/unit-tests/varmod-gmtime.exp | 20 ++++++++++----------
usr.bin/make/unit-tests/varmod-gmtime.mk | 19 ++++++++++---------
usr.bin/make/unit-tests/varmod-localtime.exp | 20 ++++++++++----------
usr.bin/make/unit-tests/varmod-localtime.mk | 21 +++++++++++----------
4 files changed, 41 insertions(+), 39 deletions(-)
diffs (171 lines):
diff -r 7726e769f908 -r 09fc0348c9ae usr.bin/make/unit-tests/varmod-gmtime.exp
--- a/usr.bin/make/unit-tests/varmod-gmtime.exp Tue Jan 19 05:05:39 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-gmtime.exp Tue Jan 19 05:26:34 2021 +0000
@@ -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
diff -r 7726e769f908 -r 09fc0348c9ae usr.bin/make/unit-tests/varmod-gmtime.mk
--- a/usr.bin/make/unit-tests/varmod-gmtime.mk Tue Jan 19 05:05:39 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-gmtime.mk Tue Jan 19 05:26:34 2021 +0000
@@ -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.
diff -r 7726e769f908 -r 09fc0348c9ae usr.bin/make/unit-tests/varmod-localtime.exp
--- a/usr.bin/make/unit-tests/varmod-localtime.exp Tue Jan 19 05:05:39 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-localtime.exp Tue Jan 19 05:26:34 2021 +0000
@@ -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
diff -r 7726e769f908 -r 09fc0348c9ae usr.bin/make/unit-tests/varmod-localtime.mk
--- a/usr.bin/make/unit-tests/varmod-localtime.mk Tue Jan 19 05:05:39 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-localtime.mk Tue Jan 19 05:26:34 2021 +0000
@@ -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.
Home |
Main Index |
Thread Index |
Old Index