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 tests/make: add placeholders for .PA...



details:   https://anonhg.NetBSD.org/src/rev/dbc75a252686
branches:  trunk
changeset: 359567:dbc75a252686
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 09 20:53:53 2022 +0000

description:
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.

diffstat:

 usr.bin/make/unit-tests/Makefile                 |   5 ++++-
 usr.bin/make/unit-tests/directive-for-escape.exp |   4 ++--
 usr.bin/make/unit-tests/opt-debug-parse.exp      |  14 +++++++-------
 3 files changed, 13 insertions(+), 10 deletions(-)

diffs (73 lines):

diff -r 99d1aff87102 -r dbc75a252686 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sun Jan 09 20:30:04 2022 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sun Jan 09 20:53:53 2022 +0000
@@ -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,^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}
diff -r 99d1aff87102 -r dbc75a252686 usr.bin/make/unit-tests/directive-for-escape.exp
--- a/usr.bin/make/unit-tests/directive-for-escape.exp  Sun Jan 09 20:30:04 2022 +0000
+++ b/usr.bin/make/unit-tests/directive-for-escape.exp  Sun Jan 09 20:53:53 2022 +0000
@@ -96,11 +96,11 @@
 "
 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
diff -r 99d1aff87102 -r dbc75a252686 usr.bin/make/unit-tests/opt-debug-parse.exp
--- a/usr.bin/make/unit-tests/opt-debug-parse.exp       Sun Jan 09 20:30:04 2022 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-parse.exp       Sun Jan 09 20:53:53 2022 +0000
@@ -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 @@
 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



Home | Main Index | Thread Index | Old Index