From 1e9dc3ce45ac44ea51292ca964b52ce47fee3ad3 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Tue, 12 Jul 2005 04:35:13 +0000 Subject: Various minor updates and code cleanups. --- tests/scripts/features/export | 8 ++------ tests/scripts/functions/eval | 4 +--- tests/scripts/functions/origin | 2 +- tests/scripts/options/dash-e | 2 +- tests/scripts/variables/SHELL | 13 ++++++++++--- 5 files changed, 15 insertions(+), 14 deletions(-) (limited to 'tests/scripts') diff --git a/tests/scripts/features/export b/tests/scripts/features/export index 1690ee8..38efe11 100644 --- a/tests/scripts/features/export +++ b/tests/scripts/features/export @@ -56,7 +56,7 @@ FOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; # TEST 1: make sure vars inherited from the parent are exported -$ENV{FOO} = 1; +$extraENV{FOO} = 1; &run_make_with_options($makefile,"",&get_logfile,0); @@ -65,8 +65,6 @@ FOO=foo BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n"; &compare_output($answer,&get_logfile(1)); -delete $ENV{FOO}; - # TEST 2: global export. Explicit unexport takes precedence. &run_make_with_options($makefile,"EXPORT_ALL=1",&get_logfile,0); @@ -237,14 +235,12 @@ EOF close(MAKEFILE); -@ENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10); +@extraENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10); &run_make_with_options($makefile5,"",&get_logfile,0); $answer = "A= B= C= D= E= F= G= H= I= J=\n"; &compare_output($answer,&get_logfile(1)); -delete @ENV{qw(A B C D E F G H I J)}; - # This tells the test driver that the perl test script executed properly. 1; diff --git a/tests/scripts/functions/eval b/tests/scripts/functions/eval index bc43053..9595d4e 100644 --- a/tests/scripts/functions/eval +++ b/tests/scripts/functions/eval @@ -127,13 +127,11 @@ EOF close(MAKEFILE); -$ENV{EVAR} = '1'; +$extraENV{EVAR} = '1'; &run_make_with_options($makefile4, "", &get_logfile); $answer = "OK\n"; &compare_output($answer,&get_logfile(1)); -delete $ENV{EVAR}; - # Clean out previous information to allow new run_make_test() interface. # If we ever convert all the above to run_make_test() we can remove this line. diff --git a/tests/scripts/functions/origin b/tests/scripts/functions/origin index d5116cd..49e6f38 100644 --- a/tests/scripts/functions/origin +++ b/tests/scripts/functions/origin @@ -16,7 +16,7 @@ defined per the following list: 'automatic' Automatic variable\n"; # Set an environment variable -$ENV{MAKETEST} = 1; +$extraENV{MAKETEST} = 1; open(MAKEFILE,"> $makefile"); diff --git a/tests/scripts/options/dash-e b/tests/scripts/options/dash-e index 472270d..17c3fc8 100644 --- a/tests/scripts/options/dash-e +++ b/tests/scripts/options/dash-e @@ -4,7 +4,7 @@ $description = "The following test creates a makefile to ..."; $details = ""; -$ENV{GOOGLE} = 'boggle'; +$extraENV{GOOGLE} = 'boggle'; open(MAKEFILE,"> $makefile"); diff --git a/tests/scripts/variables/SHELL b/tests/scripts/variables/SHELL index 93c1872..adfa5b1 100644 --- a/tests/scripts/variables/SHELL +++ b/tests/scripts/variables/SHELL @@ -4,15 +4,16 @@ $description = "Test proper handling of SHELL."; # Find the default value when SHELL is not set. On UNIX it will be /bin/sh, # but on other platforms who knows? -$oshell = $ENV{SHELL}; +resetENV(); delete $ENV{SHELL}; $mshell = `echo 'all:;\@echo \$(SHELL)' | $make_path -f-`; chop $mshell; # According to POSIX, the value of SHELL in the environment has no impact on # the value in the makefile. +# Note %extraENV takes precedence over the default value for the shell. -$ENV{SHELL} = '/dev/null'; +$extraENV{SHELL} = '/dev/null'; run_make_test('all:;@echo "$(SHELL)"', '', $mshell); # According to POSIX, any value of SHELL set in the makefile should _NOT_ be @@ -21,7 +22,7 @@ run_make_test('all:;@echo "$(SHELL)"', '', $mshell); # all when $(SHELL) is perl :-/. So, we just add an extra initial / and hope # for the best on non-UNIX platforms :-/. -$ENV{SHELL} = $mshell; +$extraENV{SHELL} = $mshell; run_make_test("SHELL := /$mshell\n".' all:;@echo "$(SHELL) $$SHELL" @@ -30,6 +31,8 @@ all:;@echo "$(SHELL) $$SHELL" # As a GNU make extension, if make's SHELL variable is explicitly exported, # then we really _DO_ export it. +$extraENV{SHELL} = $mshell; + run_make_test("export SHELL := /$mshell\n".' all:;@echo "$(SHELL) $$SHELL" ', '', "/$mshell /$mshell"); @@ -38,10 +41,14 @@ all:;@echo "$(SHELL) $$SHELL" # Test out setting of SHELL, both exported and not, as a target-specific # variable. +$extraENV{SHELL} = $mshell; + run_make_test("all: SHELL := /$mshell\n".' all:;@echo "$(SHELL) $$SHELL" ', '', "/$mshell $mshell"); +$extraENV{SHELL} = $mshell; + run_make_test("all: export SHELL := /$mshell\n".' all:;@echo "$(SHELL) $$SHELL" ', '', "/$mshell $mshell"); -- cgit v1.2.3