aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2010-08-11 23:12:39 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-08-11 23:12:39 +0200
commita43201e5787e087d99b99e8d72c97ae0688eaf85 (patch)
treeaf9f892a10abd89d32d62d4fcb7c7b285fe6f022 /tests
parent3c2ee9c341d0e9f22a1020c13deb87a2b6afafeb (diff)
runtests: clear old setenv remainders before test
Due to the layout of the singletest function there are situations where it returns before it clears the environment variables that were especially set for the single specific test case. That could lead to subsequent tests getting executed with environment variables sticking around from a previous test which could lead to badness. This change makes sure to clear all custom variables that may be laying around from a previous round, before running a test case. Reported by: Kamil Dudka Bug: http://curl.haxx.se/mail/lib-2010-08/0141.html
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runtests.pl14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/runtests.pl b/tests/runtests.pl
index a97d8647e..9ddccc084 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -238,6 +238,7 @@ my %timesrvrlog; # timestamp for each test server logs lock removal
my %timevrfyend; # timestamp for each test result verification end
my $testnumcheck; # test number, set in singletest sub.
+my %oldenv;
#######################################################################
# variables the command line options may set
@@ -2361,7 +2362,18 @@ sub singletest {
# test definition may instruct to (un)set environment vars
# this is done this early, so that the precheck can use environment
# variables and still bail out fine on errors
- my %oldenv;
+
+ # restore environment variables that were modified in a previous run
+ foreach my $var (keys %oldenv) {
+ if($oldenv{$var} eq 'notset') {
+ delete $ENV{$var} if($ENV{$var});
+ }
+ else {
+ $ENV{$var} = $oldenv{$var};
+ }
+ delete $oldenv{$var};
+ }
+
my @setenv = getpart("client", "setenv");
if(@setenv) {
foreach my $s (@setenv) {