Module Name:    src
Committed By:   rillig
Date:           Sun Jan  9 20:53:54 UTC 2022

Modified Files:
        src/usr.bin/make/unit-tests: Makefile directive-for-escape.exp
            opt-debug-parse.exp

Log Message:
tests/make: add placeholders for .PARSEDIR and .INCLUDEDFROMDIR

When run via 'cd usr.bin/make/unit-tests && make test', the tests are in
the current directory.  When run via ATF, the tests are in
/usr/tests/usr.bin/make/unit-tests, while the current directory is a
temporary directory.  Allow both variants, plus others that may occur in
the bmake distribution.


To generate a diff of this commit:
cvs rdiff -u -r1.293 -r1.294 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.13 -r1.14 \
    src/usr.bin/make/unit-tests/directive-for-escape.exp
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/opt-debug-parse.exp

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/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.293 src/usr.bin/make/unit-tests/Makefile:1.294
--- src/usr.bin/make/unit-tests/Makefile:1.293	Tue Dec 28 01:04:03 2021
+++ src/usr.bin/make/unit-tests/Makefile	Sun Jan  9 20:53:53 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.293 2021/12/28 01:04:03 rillig Exp $
+# $NetBSD: Makefile,v 1.294 2022/01/09 20:53:53 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -693,6 +693,9 @@ _SED_CMDS+=	-e 's,${TEST_MAKE:T:S,.,\\.,
 _SED_CMDS+=	-e 's,^usage: ${TEST_MAKE:T:S,.,\\.,g} ,usage: make ,'
 # replace anything after 'stopped in' with unit-tests
 _SED_CMDS+=	-e '/stopped/s, /.*, unit-tests,'
+# Allow the test files to be placed anywhere.
+_SED_CMDS+=	-e 's,\(\.PARSEDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
+_SED_CMDS+=	-e 's,\(\.INCLUDEDFROMDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
 _SED_CMDS+=	-e 's,${TMPDIR},TMPDIR,g'
 # canonicalize ${.OBJDIR} and ${.CURDIR}
 .if ${.OBJDIR} != ${.CURDIR}

Index: src/usr.bin/make/unit-tests/directive-for-escape.exp
diff -u src/usr.bin/make/unit-tests/directive-for-escape.exp:1.13 src/usr.bin/make/unit-tests/directive-for-escape.exp:1.14
--- src/usr.bin/make/unit-tests/directive-for-escape.exp:1.13	Sun Jan  9 14:06:00 2022
+++ src/usr.bin/make/unit-tests/directive-for-escape.exp	Sun Jan  9 20:53:53 2022
@@ -96,11 +96,11 @@ make: "directive-for-escape.mk" line 152
 "
 For: loop body:
 : ${:U" "}
-SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `directive-for-escape.mk'
+SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `directive-for-escape.mk'
 Parsing line 153: : ${:U" "}
 ParseDependency(: " ")
 ParseEOF: returning to file directive-for-escape.mk, line 155
-SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `directive-for-escape.mk'
+SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `directive-for-escape.mk'
 Parsing line 155: .MAKEFLAGS: -d0
 ParseDependency(.MAKEFLAGS: -d0)
 make: Fatal errors encountered -- cannot continue

Index: src/usr.bin/make/unit-tests/opt-debug-parse.exp
diff -u src/usr.bin/make/unit-tests/opt-debug-parse.exp:1.8 src/usr.bin/make/unit-tests/opt-debug-parse.exp:1.9
--- src/usr.bin/make/unit-tests/opt-debug-parse.exp:1.8	Sun Jan  9 11:43:58 2022
+++ src/usr.bin/make/unit-tests/opt-debug-parse.exp	Sun Jan  9 20:53:53 2022
@@ -1,18 +1,18 @@
 Parse_PushInput: .for loop in opt-debug-parse.mk, line 16
-SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `opt-debug-parse.mk'
+SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk'
 Parsing line 20: .info trace with multi-line .for loop head
 make: "opt-debug-parse.mk" line 20: trace with multi-line .for loop head
 	in .for loop from opt-debug-parse.mk:16 with var = value
 ParseEOF: returning to file opt-debug-parse.mk, line 22
-SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `opt-debug-parse.mk'
+SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk'
 Parsing line 25: .include "/dev/null"
 Parse_PushInput: file /dev/null, line 1
-SetFilenameVars: ${.PARSEDIR} = `/dev' ${.PARSEFILE} = `null'
-SetFilenameVars: ${.INCLUDEDFROMDIR} = `<curdir>' ${.INCLUDEDFROMFILE} = `opt-debug-parse.mk'
+SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `null'
+SetFilenameVars: ${.INCLUDEDFROMDIR} = <some-dir> ${.INCLUDEDFROMFILE} = `opt-debug-parse.mk'
 ParseEOF: returning to file opt-debug-parse.mk, line 26
-SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `opt-debug-parse.mk'
+SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk'
 Parse_PushInput: .for loop in opt-debug-parse.mk, line 30
-SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `opt-debug-parse.mk'
+SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk'
 Parsing line 31: .info trace
 make: "opt-debug-parse.mk" line 31: trace
 	in .for loop from opt-debug-parse.mk:30 with a = 1, b = 2, c = 3
@@ -20,7 +20,7 @@ Parsing line 31: .info trace
 make: "opt-debug-parse.mk" line 31: trace
 	in .for loop from opt-debug-parse.mk:30 with a = 4, b = 5, c = 6
 ParseEOF: returning to file opt-debug-parse.mk, line 33
-SetFilenameVars: ${.PARSEDIR} = `<curdir>' ${.PARSEFILE} = `opt-debug-parse.mk'
+SetFilenameVars: ${.PARSEDIR} = <some-dir> ${.PARSEFILE} = `opt-debug-parse.mk'
 Parsing line 35: .MAKEFLAGS: -d0
 ParseDependency(.MAKEFLAGS: -d0)
 exit status 0

Reply via email to