Module Name:    src
Committed By:   rillig
Date:           Sun Nov 19 11:37:44 UTC 2023

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

Log Message:
tests/make: test non-integer fallback in ':mtime' modifier


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-mtime.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-mtime.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-mtime.exp
diff -u src/usr.bin/make/unit-tests/varmod-mtime.exp:1.4 src/usr.bin/make/unit-tests/varmod-mtime.exp:1.5
--- src/usr.bin/make/unit-tests/varmod-mtime.exp:1.4	Sat Aug 19 01:34:21 2023
+++ src/usr.bin/make/unit-tests/varmod-mtime.exp	Sun Nov 19 11:37:44 2023
@@ -1,8 +1,10 @@
-make: "varmod-mtime.mk" line 60: Cannot determine mtime for 'no/such/file1': <ENOENT>
-make: "varmod-mtime.mk" line 60: Cannot determine mtime for 'no/such/file2': <ENOENT>
-make: "varmod-mtime.mk" line 60: Malformed conditional (${no/such/file1 no/such/file2:L:mtime=error})
-make: "varmod-mtime.mk" line 71: Invalid argument 'errorhandler-no' for modifier ':mtime'
-make: "varmod-mtime.mk" line 71: Malformed conditional (${MAKEFILE:mtime=errorhandler-no} > 0)
+make: "varmod-mtime.mk" line 47: Unknown modifier "x"
+make: "varmod-mtime.mk" line 47: Malformed conditional (${no/such/file:L:mtime=123x})
+make: "varmod-mtime.mk" line 70: Cannot determine mtime for 'no/such/file1': <ENOENT>
+make: "varmod-mtime.mk" line 70: Cannot determine mtime for 'no/such/file2': <ENOENT>
+make: "varmod-mtime.mk" line 70: Malformed conditional (${no/such/file1 no/such/file2:L:mtime=error})
+make: "varmod-mtime.mk" line 81: Invalid argument 'errorhandler-no' for modifier ':mtime'
+make: "varmod-mtime.mk" line 81: Malformed conditional (${MAKEFILE:mtime=errorhandler-no} > 0)
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/varmod-mtime.mk
diff -u src/usr.bin/make/unit-tests/varmod-mtime.mk:1.5 src/usr.bin/make/unit-tests/varmod-mtime.mk:1.6
--- src/usr.bin/make/unit-tests/varmod-mtime.mk:1.5	Sat Aug 19 08:19:25 2023
+++ src/usr.bin/make/unit-tests/varmod-mtime.mk	Sun Nov 19 11:37:44 2023
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-mtime.mk,v 1.5 2023/08/19 08:19:25 rillig Exp $
+# $NetBSD: varmod-mtime.mk,v 1.6 2023/11/19 11:37:44 rillig Exp $
 #
 # Tests for the ':mtime' variable modifier, which maps each word of the
 # expression to that file's modification time.
@@ -41,6 +41,16 @@ not_found_mtime:=	${no/such/file:L:mtime
 .endif
 
 
+# The fallback timestamp must only be an integer, without trailing characters.
+# expect+2: Unknown modifier "x"
+# expect+1: Malformed conditional (${no/such/file:L:mtime=123x})
+.if ${no/such/file:L:mtime=123x}
+.  error
+.else
+.  error
+.endif
+
+
 # The timestamp of a newly created file must be at least as great as the
 # timestamp when parsing of this makefile started.
 COOKIE=	${TMPDIR:U/tmp}/varmod-mtime.cookie

Reply via email to