make(1): add test for ignoring assignment to read-only variablediff -r1.10 -r1.11 src/usr.bin/make/unit-tests/vardebug.exp
(rillig)
--- src/usr.bin/make/unit-tests/vardebug.exp 2020/10/29 18:19:41 1.10
+++ src/usr.bin/make/unit-tests/vardebug.exp 2020/10/29 18:38:24 1.11
@@ -68,18 +68,21 @@ Result of ${:Mvalu[e]} is "value" (VARE_ | @@ -68,18 +68,21 @@ Result of ${:Mvalu[e]} is "value" (VARE_ | |||
68 | Var_Parse: ${:UVAR} with VARE_WANTRES | 68 | Var_Parse: ${:UVAR} with VARE_WANTRES | |
69 | Applying ${:U...} to "" (VARE_WANTRES, none, VEF_UNDEF) | 69 | Applying ${:U...} to "" (VARE_WANTRES, none, VEF_UNDEF) | |
70 | Result of ${:UVAR} is "VAR" (VARE_WANTRES, none, VEF_UNDEF|VEF_DEF) | 70 | Result of ${:UVAR} is "VAR" (VARE_WANTRES, none, VEF_UNDEF|VEF_DEF) | |
71 | Global:delete VAR | 71 | Global:delete VAR | |
72 | Var_Parse: ${:Uvariable:unknown} with VARE_UNDEFERR|VARE_WANTRES | 72 | Var_Parse: ${:Uvariable:unknown} with VARE_UNDEFERR|VARE_WANTRES | |
73 | Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF) | 73 | Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF) | |
74 | Result of ${:Uvariable} is "variable" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF) | 74 | Result of ${:Uvariable} is "variable" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF) | |
75 | Applying ${:u...} to "variable" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF) | 75 | Applying ${:u...} to "variable" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF) | |
76 | make: Unknown modifier 'u' | 76 | make: Unknown modifier 'u' | |
77 | Result of ${:unknown} is error (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF) | 77 | Result of ${:unknown} is error (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF) | |
78 | make: "vardebug.mk" line 44: Malformed conditional (${:Uvariable:unknown}) | 78 | make: "vardebug.mk" line 44: Malformed conditional (${:Uvariable:unknown}) | |
79 | Var_Parse: ${UNDEFINED} with VARE_UNDEFERR|VARE_WANTRES | 79 | Var_Parse: ${UNDEFINED} with VARE_UNDEFERR|VARE_WANTRES | |
80 | make: "vardebug.mk" line 53: Malformed conditional (${UNDEFINED}) | 80 | make: "vardebug.mk" line 53: Malformed conditional (${UNDEFINED}) | |
81 | Global:delete .SHELL (not found) | |||
82 | Command:.SHELL = /bin/sh | |||
83 | Command:.SHELL = overwritten ignored (read-only) | |||
81 | Global:.MAKEFLAGS = -r -k -d v -d | 84 | Global:.MAKEFLAGS = -r -k -d v -d | |
82 | Global:.MAKEFLAGS = -r -k -d v -d 0 | 85 | Global:.MAKEFLAGS = -r -k -d v -d 0 | |
83 | make: Fatal errors encountered -- cannot continue | 86 | make: Fatal errors encountered -- cannot continue | |
84 | make: stopped in unit-tests | 87 | make: stopped in unit-tests | |
85 | exit status 1 | 88 | exit status 1 |
--- src/usr.bin/make/unit-tests/vardebug.mk 2020/10/29 18:19:41 1.4
+++ src/usr.bin/make/unit-tests/vardebug.mk 2020/10/29 18:38:24 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: vardebug.mk,v 1.4 2020/10/29 18:19:41 rillig Exp $ | 1 | # $NetBSD: vardebug.mk,v 1.5 2020/10/29 18:38:24 rillig Exp $ | |
2 | # | 2 | # | |
3 | # Demonstrates the debugging output for var.c. | 3 | # Demonstrates the debugging output for var.c. | |
4 | 4 | |||
5 | .MAKEFLAGS: -dv FROM_CMDLINE= | 5 | .MAKEFLAGS: -dv FROM_CMDLINE= | |
6 | 6 | |||
7 | VAR= added # VarAdd | 7 | VAR= added # VarAdd | |
8 | VAR= overwritten # Var_Set | 8 | VAR= overwritten # Var_Set | |
9 | .undef VAR # Var_Delete (found) | 9 | .undef VAR # Var_Delete (found) | |
10 | .undef VAR # Var_Delete (not found) | 10 | .undef VAR # Var_Delete (not found) | |
11 | 11 | |||
12 | # The variable with the empty name cannot be set at all. | 12 | # The variable with the empty name cannot be set at all. | |
13 | ${:U}= empty name # Var_Set | 13 | ${:U}= empty name # Var_Set | |
14 | ${:U}+= empty name # Var_Append | 14 | ${:U}+= empty name # Var_Append | |
@@ -43,17 +43,22 @@ VAR+= 3 | @@ -43,17 +43,22 @@ VAR+= 3 | |||
43 | # as "is error", without surrounding quotes. | 43 | # as "is error", without surrounding quotes. | |
44 | .if ${:Uvariable:unknown} | 44 | .if ${:Uvariable:unknown} | |
45 | .endif | 45 | .endif | |
46 | 46 | |||
47 | # XXX: The error message is "Malformed conditional", which is wrong. | 47 | # XXX: The error message is "Malformed conditional", which is wrong. | |
48 | # The condition is syntactically fine, it just contains an undefined variable. | 48 | # The condition is syntactically fine, it just contains an undefined variable. | |
49 | # | 49 | # | |
50 | # There is a specialized error message for "Undefined variable", but as of | 50 | # There is a specialized error message for "Undefined variable", but as of | |
51 | # 2020-08-08, that is not covered by any unit tests. It might even be | 51 | # 2020-08-08, that is not covered by any unit tests. It might even be | |
52 | # unreachable. | 52 | # unreachable. | |
53 | .if ${UNDEFINED} | 53 | .if ${UNDEFINED} | |
54 | .endif | 54 | .endif | |
55 | 55 | |||
56 | # By default, .SHELL is not defined and thus can be set. As soon as it is | |||
57 | # accessed, it is initialized in the command line context (during VarFind), | |||
58 | # where it is set to read-only. Assigning to it is ignored. | |||
59 | .MAKEFLAGS: .SHELL=overwritten | |||
60 | ||||
56 | .MAKEFLAGS: -d0 | 61 | .MAKEFLAGS: -d0 | |
57 | 62 | |||
58 | all: | 63 | all: | |
59 | @: | 64 | @: |