Module Name: src Committed By: rillig Date: Wed Feb 3 08:34:15 UTC 2021
Modified Files: src/usr.bin/make/unit-tests: Makefile varname-empty.exp varname-empty.mk Log Message: make: in the test varname-empty, keep more debug output Filtering out the interesting lines based on the very specific pattern "Var_Set" was surprising. To generate a diff of this commit: cvs rdiff -u -r1.266 -r1.267 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varname-empty.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varname-empty.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/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.266 src/usr.bin/make/unit-tests/Makefile:1.267 --- src/usr.bin/make/unit-tests/Makefile:1.266 Tue Feb 2 17:27:35 2021 +++ src/usr.bin/make/unit-tests/Makefile Wed Feb 3 08:34:15 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.266 2021/02/02 17:27:35 rillig Exp $ +# $NetBSD: Makefile,v 1.267 2021/02/03 08:34:15 rillig Exp $ # # Unit tests for make(1) # @@ -519,11 +519,12 @@ 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 '/\.SHELL/d' # Some tests need an additional round of postprocessing. POSTPROC.deptgt-suffixes= awk '/^\#\*\*\* Suffixes/,/^never-stop/' POSTPROC.gnode-submake= awk '/Input graph/, /^$$/' -POSTPROC.varname-empty= ${TOOL_SED} -n -e '/^Var_Set/p' -e '/^out:/p' # Some tests reuse other tests, which makes them unnecessarily fragile. export-all.rawout: export.mk Index: src/usr.bin/make/unit-tests/varname-empty.exp diff -u src/usr.bin/make/unit-tests/varname-empty.exp:1.5 src/usr.bin/make/unit-tests/varname-empty.exp:1.6 --- src/usr.bin/make/unit-tests/varname-empty.exp:1.5 Sun Nov 15 20:50:46 2020 +++ src/usr.bin/make/unit-tests/varname-empty.exp Wed Feb 3 08:34:15 2021 @@ -1,13 +1,48 @@ +Var_Parse: ${:U} with VARE_WANTRES +Applying ${:U} to "" (VARE_WANTRES, none, VES_UNDEF) +Result of ${:U} is "" (VARE_WANTRES, none, VES_DEF) Var_Set("${:U}", "cmdline-u", ...) name expands to empty string - ignored Var_Set("", "cmdline-plain", ...) name expands to empty string - ignored +Global:.CURDIR = <curdir> +Var_Parse: ${MAKE_OBJDIR_CHECK_WRITABLE:U} with VARE_WANTRES +Applying ${MAKE_OBJDIR_CHECK_WRITABLE:U} to "" (VARE_WANTRES, none, VES_UNDEF) +Result of ${MAKE_OBJDIR_CHECK_WRITABLE:U} is "" (VARE_WANTRES, none, VES_DEF) +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 +Global:.PARSEDIR = <curdir> +Global:.PARSEFILE = varname-empty.mk +Global:delete .INCLUDEDFROMDIR (not found) +Global:delete .INCLUDEDFROMFILE (not found) Var_Set("", "default", ...) name expands to empty string - ignored Var_Set("", "assigned", ...) name expands to empty string - ignored Var_Set("", "appended", ...) name expands to empty string - ignored Var_Set("", "", ...) name expands to empty string - ignored Var_Set("", "subst", ...) name expands to empty string - ignored Var_Set("", "shell-output", ...) name expands to empty string - ignored +Var_Parse: ${:Ufallback} != "fallback" with VARE_UNDEFERR|VARE_WANTRES +Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF) +Result of ${:Ufallback} is "fallback" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF) +Var_Parse: ${:U} with VARE_WANTRES +Applying ${:U} to "" (VARE_WANTRES, none, VES_UNDEF) +Result of ${:U} is "" (VARE_WANTRES, none, VES_DEF) Var_Set("${:U}", "assigned indirectly", ...) name expands to empty string - ignored -Var_Set("", "assigned", ...) name expands to empty string - ignored +Var_Parse: ${:Ufallback} != "fallback" with VARE_UNDEFERR|VARE_WANTRES +Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF) +Result of ${:Ufallback} is "fallback" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF) +Var_Parse: ${:U} with VARE_WANTRES +Applying ${:U} to "" (VARE_WANTRES, none, VES_UNDEF) +Result of ${:U} is "" (VARE_WANTRES, none, VES_DEF) +Var_Append("${:U}", "appended indirectly", ...) name expands to empty string - ignored +Var_Parse: ${:Ufallback} != "fallback" with VARE_UNDEFERR|VARE_WANTRES +Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VES_UNDEF) +Result of ${:Ufallback} is "fallback" (VARE_UNDEFERR|VARE_WANTRES, none, VES_DEF) +Global:.MAKEFLAGS = -r -d v -d +Global:.MAKEFLAGS = -r -d v -d 0 out: fallback out: 1 2 3 exit status 0 Index: src/usr.bin/make/unit-tests/varname-empty.mk diff -u src/usr.bin/make/unit-tests/varname-empty.mk:1.7 src/usr.bin/make/unit-tests/varname-empty.mk:1.8 --- src/usr.bin/make/unit-tests/varname-empty.mk:1.7 Fri Oct 23 17:53:01 2020 +++ src/usr.bin/make/unit-tests/varname-empty.mk Wed Feb 3 08:34:15 2021 @@ -1,4 +1,4 @@ -# $NetBSD: varname-empty.mk,v 1.7 2020/10/23 17:53:01 rillig Exp $ +# $NetBSD: varname-empty.mk,v 1.8 2021/02/03 08:34:15 rillig Exp $ # # Tests for the special variable with the empty name. # @@ -41,6 +41,13 @@ ${:U}= assigned indirectly . error .endif +${:U}+= appended indirectly +.if ${:Ufallback} != "fallback" +. error +.endif + +.MAKEFLAGS: -d0 + # Before 2020-08-22, the simple assignment operator '=' after an empty # variable name had an off-by-one bug in Parse_DoVar. The code that was # supposed to "skip to operator character" started its search _after_ the