Various fixes and updates from testers of the beta3 release (mostly Windows
[make.git] / tests / scripts / variables / SHELL
blob93c18723a87ebd8cb9f5cd322e024919b922efaa
1 #                                                                    -*-perl-*-
3 $description = "Test proper handling of SHELL.";
5 # Find the default value when SHELL is not set.  On UNIX it will be /bin/sh,
6 # but on other platforms who knows?
7 $oshell = $ENV{SHELL};
8 delete $ENV{SHELL};
9 $mshell = `echo 'all:;\@echo \$(SHELL)' | $make_path -f-`;
10 chop $mshell;
12 # According to POSIX, the value of SHELL in the environment has no impact on
13 # the value in the makefile.
15 $ENV{SHELL} = '/dev/null';
16 run_make_test('all:;@echo "$(SHELL)"', '', $mshell);
18 # According to POSIX, any value of SHELL set in the makefile should _NOT_ be
19 # exported to the subshell!  I wanted to set SHELL to be $^X (perl) in the
20 # makefile, but make runs $(SHELL) -c 'commandline' and that doesn't work at
21 # all when $(SHELL) is perl :-/.  So, we just add an extra initial / and hope
22 # for the best on non-UNIX platforms :-/.
24 $ENV{SHELL} = $mshell;
26 run_make_test("SHELL := /$mshell\n".'
27 all:;@echo "$(SHELL) $$SHELL"
28 ', '', "/$mshell $mshell");
30 # As a GNU make extension, if make's SHELL variable is explicitly exported,
31 # then we really _DO_ export it.
33 run_make_test("export SHELL := /$mshell\n".'
34 all:;@echo "$(SHELL) $$SHELL"
35 ', '', "/$mshell /$mshell");
38 # Test out setting of SHELL, both exported and not, as a target-specific
39 # variable.
41 run_make_test("all: SHELL := /$mshell\n".'
42 all:;@echo "$(SHELL) $$SHELL"
43 ', '', "/$mshell $mshell");
45 run_make_test("all: export SHELL := /$mshell\n".'
46 all:;@echo "$(SHELL) $$SHELL"
47 ', '', "/$mshell $mshell");