summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/targets/ONESHELL3
-rw-r--r--tests/scripts/targets/POSIX8
-rw-r--r--tests/scripts/variables/SHELL23
3 files changed, 23 insertions, 11 deletions
diff --git a/tests/scripts/targets/ONESHELL b/tests/scripts/targets/ONESHELL
index 5b86e48..997423f 100644
--- a/tests/scripts/targets/ONESHELL
+++ b/tests/scripts/targets/ONESHELL
@@ -62,8 +62,7 @@ all:
> @$$a=5
> +7;
> @y=qw(a b c);
->print "a = $$a, \
-y = (@y)\n";
+>print "a = $$a, y = (@y)\n";
!,
'', "a = 12, y = (a b c)\n");
diff --git a/tests/scripts/targets/POSIX b/tests/scripts/targets/POSIX
index 662c16d..1b57448 100644
--- a/tests/scripts/targets/POSIX
+++ b/tests/scripts/targets/POSIX
@@ -6,10 +6,12 @@ $details = "";
# Ensure turning on .POSIX enables the -e flag for the shell
+# We can't just use "false" because on different systems it provides a
+# different exit code.
run_make_test(q!
.POSIX:
-all: ; @false; true
+all: ; @r() { return 1; }; r; true
!,
'', "#MAKE#: *** [all] Error 1\n", 512);
@@ -18,9 +20,9 @@ all: ; @false; true
run_make_test(q!
.SHELLFLAGS = -xc
.POSIX:
-all: ; @false; true
+all: ; @r() { return 1; }; r; true
!,
- '', "+ false\n+ true\n");
+ '', "+ r\n+ return 1\n+ true\n");
# This tells the test driver that the perl test script executed properly.
1;
diff --git a/tests/scripts/variables/SHELL b/tests/scripts/variables/SHELL
index 69871d2..0028d9f 100644
--- a/tests/scripts/variables/SHELL
+++ b/tests/scripts/variables/SHELL
@@ -58,16 +58,27 @@ one two:;@echo "$@: $(SHELL) $$SHELL"
# Test .SHELLFLAGS
-run_make_test(q!
+# We can't assume the value here: on Solaris for example, every line printed
+# by the shell in -x mode has a trailing space (!!)
+my $script = 'true';
+my $out = `/bin/sh -xc '$script' 2>&1`;
+
+run_make_test(qq!
.SHELLFLAGS = -xc
-all: ; @true
+all: ; \@$script
!,
- '', "+ true\n");
+ '', $out);
+
+# We can't just use "false" because on different systems it provides a
+# different exit code.
+
+my $script = 'r() { return 1; }; true; r; true';
+my $out = `/bin/sh -xec '$script' 2>&1`;
-run_make_test(q!
+run_make_test(qq!
.SHELLFLAGS = -xec
-all: ; @true; false; true
+all: ; \@$script
!,
- '', "+ true\n+ false\n#MAKE#: *** [all] Error 1\n", 512);
+ '', "$out#MAKE#: *** [all] Error 1\n", 512);
1;