summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/targets/POSIX44
1 files changed, 42 insertions, 2 deletions
diff --git a/tests/scripts/targets/POSIX b/tests/scripts/targets/POSIX
index ade0b1ee..325d58cb 100644
--- a/tests/scripts/targets/POSIX
+++ b/tests/scripts/targets/POSIX
@@ -7,12 +7,52 @@ $details = "";
# Ensure turning on .POSIX enables the -e flag for the shell
-run_make_test(qq!
+run_make_test(q!
.POSIX:
-all: ; \@#HELPER# -q fail 1; true
+all: ; @#HELPER# -q fail 1; #HELPER# out hello
!,
'', "#MAKE#: *** [#MAKEFILE#:3: all] Error 1\n", 512);
+# But explicit settings must still take precedence
+
+run_make_test(q!
+.POSIX:
+all: ; @-#HELPER# -q fail 1; #HELPER# out hello
+.SHELLFLAGS = -c
+!,
+ '', "hello");
+
+run_make_test(q!
+.POSIX:
+all: ; @-#HELPER# -q fail 1; #HELPER# out hello
+all: .SHELLFLAGS = -c
+!,
+ '', "hello");
+
+# SV 63667: We shouldn't add -e to sh if errors are ignored
+
+run_make_test(q!
+.POSIX:
+all: ; @-#HELPER# -q fail 1; #HELPER# out hello
+!,
+ '', "hello\n");
+
+# But explicit settings must still take precedence
+
+run_make_test(q!
+.POSIX:
+all: ; @-#HELPER# -q fail 1; #HELPER# out hello
+.SHELLFLAGS = -ec
+!,
+ '', "#MAKE#: [#MAKEFILE#:3: all] Error 1 (ignored)\n");
+
+run_make_test(q!
+.POSIX:
+all: ; @-#HELPER# -q fail 1; #HELPER# out hello
+all: .SHELLFLAGS = -ec
+!,
+ '', "#MAKE#: [#MAKEFILE#:3: all] Error 1 (ignored)\n");
+
# User settings must override .POSIX
# In the standard .POSIX must be the first thing in the makefile
# but we relax that rule in GNU Make.