Module Name:    src
Committed By:   sjg
Date:           Tue Oct 19 15:59:26 UTC 2021

Modified Files:
        src/usr.bin/make/unit-tests: Makefile varname-empty.exp

Log Message:
Replace ${.OBJDIR} with <curdir> for consistent results.

If we replace ${.OBJDIR} with <objdir> some tests produce
different results depending on the value of .OBJDIR

For similar reasons eliminate .OBJDIR and .PATH from output of
varname-empty

Reviewed by: rillig


To generate a diff of this commit:
cvs rdiff -u -r1.283 -r1.284 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/make/unit-tests/varname-empty.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.283 src/usr.bin/make/unit-tests/Makefile:1.284
--- src/usr.bin/make/unit-tests/Makefile:1.283	Mon Aug 30 17:08:13 2021
+++ src/usr.bin/make/unit-tests/Makefile	Tue Oct 19 15:59:26 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.283 2021/08/30 17:08:13 rillig Exp $
+# $NetBSD: Makefile,v 1.284 2021/10/19 15:59:26 sjg Exp $
 #
 # Unit tests for make(1)
 #
@@ -530,9 +530,7 @@ SED_CMDS.varname-dot-parsefile=	-e '/in 
 SED_CMDS.varname-dot-shell=	-e 's, = /[^ ]*, = (details omitted),g'
 SED_CMDS.varname-dot-shell+=	-e 's,"/[^" ]*","(details omitted)",g'
 SED_CMDS.varname-dot-shell+=	-e 's,\[/[^] ]*\],[(details omitted)],g'
-SED_CMDS.varname-empty=		-e 's,${.CURDIR},<curdir>,g'
-SED_CMDS.varname-empty+=	-e '/\.PARSEDIR/d'
-SED_CMDS.varname-empty+=	-e '/\.SHELL/d'
+SED_CMDS.varname-empty=		${.OBJDIR .PARSEDIR .PATH .SHELL:L:@v@-e '/\\$v/d'@}
 
 # Some tests need an additional round of postprocessing.
 POSTPROC.deptgt-suffixes=	awk '/^\#\*\*\* Suffixes/,/^never-stop/'
@@ -689,8 +687,14 @@ _SED_CMDS+=	-e 's,^usage: ${TEST_MAKE:T:
 # replace anything after 'stopped in' with unit-tests
 _SED_CMDS+=	-e '/stopped/s, /.*, unit-tests,'
 _SED_CMDS+=	-e 's,${TMPDIR},TMPDIR,g'
-# strip ${.CURDIR}/ from the output
-_SED_CMDS+=	-e 's,${.CURDIR:S,.,\\.,g}/,,g'
+# canonicalize ${.OBJDIR} and ${.CURDIR}
+.if ${.OBJDIR} != ${.CURDIR}
+# yes this is inaccurate but none of the tests expect <objdir> anywhere
+# which we get depending on how MAKEOBJDIR is set.
+_SED_CMDS+=	-e 's,${.OBJDIR},<curdir>,g'
+.endif
+_SED_CMDS+=	-e 's,${.CURDIR},<curdir>,g'
+_SED_CMDS+=	-e 's,<curdir>/,,g'
 _SED_CMDS+=	-e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'
 
 .rawout.out:

Index: src/usr.bin/make/unit-tests/varname-empty.exp
diff -u src/usr.bin/make/unit-tests/varname-empty.exp:1.16 src/usr.bin/make/unit-tests/varname-empty.exp:1.17
--- src/usr.bin/make/unit-tests/varname-empty.exp:1.16	Wed Apr 14 17:20:48 2021
+++ src/usr.bin/make/unit-tests/varname-empty.exp	Tue Oct 19 15:59:26 2021
@@ -2,10 +2,6 @@ Var_SetExpand: variable name "${:U}" exp
 Var_SetExpand: variable name "" expands to empty string, with value "cmdline-plain" - ignored
 Global: .CURDIR = <curdir>
 Var_Parse: ${MAKE_OBJDIR_CHECK_WRITABLE} (eval)
-Global: .OBJDIR = <curdir>
-Global:delete .PATH (not found)
-Global: .PATH = .
-Global: .PATH = . <curdir>
 Global: .TARGETS = 
 Internal: MAKEFILE = varname-empty.mk
 Global: .MAKE.MAKEFILES = varname-empty.mk

Reply via email to