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 make: test exporting a variable that...



details:   https://anonhg.NetBSD.org/src/rev/117735c2c968
branches:  trunk
changeset: 952755:117735c2c968
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Feb 16 19:01:18 2021 +0000

description:
make: test exporting a variable that itself depends on a subprocess

When the point that "isn't going to end well" is reached, the stacktrace
is quite long but still reasonable:

main
main_ReadFiles
ReadAllMakefiles
ReadMakefile            directive-export.mk
Parse_File
ParseLine                               # line 3 has: _!= :;:
ParseVarassign
Parse_DoVar
VarAssign_Eval
VarAssign_EvalShell                     # because of the '!='
Cmd_Exec                :;:
Var_ReexportVars                        # before starting the subprocess
ExportVar               EMPTY_SHELL
ExportVarEnv                            # was only marked for export
Var_Subst               ${EMPTY_SHELL}  # to get the value to export
VarSubstExpr            ${EMPTY_SHELL}
Var_Parse               ${EMPTY_SHELL}
Var_Subst               ${:sh}          # since EMPTY_SHELL= ${:sh}
VarSubstExpr            ${:sh}
Var_Parse               ${:sh}
ApplyModifiers
ApplySingleModifier     :sh
ApplyModifier
ApplyModifier_SunShell  :sh
Cmd_Exec                ""              # empty command
Var_ReexportVars
ExportVar               EMPTY_SHELL
ExportVarEnv                            # skipping this edge case

diffstat:

 usr.bin/make/unit-tests/directive-export.mk |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r a72eeba87510 -r 117735c2c968 usr.bin/make/unit-tests/directive-export.mk
--- a/usr.bin/make/unit-tests/directive-export.mk       Tue Feb 16 18:12:46 2021 +0000
+++ b/usr.bin/make/unit-tests/directive-export.mk       Tue Feb 16 19:01:18 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-export.mk,v 1.7 2021/02/16 18:12:46 rillig Exp $
+# $NetBSD: directive-export.mk,v 1.8 2021/02/16 19:01:18 rillig Exp $
 #
 # Tests for the .export directive.
 #
@@ -34,5 +34,11 @@
 # An empty argument means no additional variables to export.
 .export ${:U}
 
+
+# Trigger the "This isn't going to end well" in ExportVarEnv.
+EMPTY_SHELL=   ${:sh}
+.export EMPTY_SHELL    # only marked for export at this point
+_!=            :;:     # Force the variable to be actually exported.
+
+
 all:
-       @:;



Home | Main Index | Thread Index | Old Index