X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/fef95dbbb2220e10f5a6bf7ac1b6ecdff0025bca..43ba2742c700d625dcdcdaf7bbadc2f72776854a:/test/runtest diff --git a/test/runtest b/test/runtest index fcc7a972e..b201d1cfa 100755 --- a/test/runtest +++ b/test/runtest @@ -348,7 +348,7 @@ $spid = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; # that are specific to certain file types, though there are also some of those # inline too. -while() +LINE: while() { RESET_AFTER_EXTRA_LINE_READ: # Custom munges @@ -563,6 +563,25 @@ RESET_AFTER_EXTRA_LINE_READ: # signature algorithm names s/RSA-SHA1/RSA-SHA/; + # -d produces a list of environement variables as they are checked if they exist in the + # in the environment. Unfortunately this list isn't always in the same order. For now we + # just remove this list + # + if (/^\w+ in keep_environment/) + { + my @lines = $_; + while () + { + if (/^\w+ in keep_environment/) + { + push @lines, $_; + next; + } + print MUNGED sort grep { !/^(SHLVL|_) / } @lines; + redo LINE; + } + } + # ======== Caller's login, uid, gid, home, gecos ======== @@ -1659,6 +1678,8 @@ my($commandnameref) = $_[3]; my($aux_info) = $_[4]; my($yield) = 1; +our %ENV = map { $_ => $ENV{$_} } grep { /^(?:USER|SHELL|PATH|TERM|EXIM_TEST_.*)$/ } keys %ENV; + if (/^(\d+)\s*$/) # Handle unusual return code { my($r) = $_[2]; @@ -2062,12 +2083,12 @@ if (/^client/ || /^(sudo\s+)?perl\b/) # not drop privilege when -C and -D options are present. To run the exim # command as root, we use sudo. -elsif (/^([A-Z_]+=\S+\s+)?(\d+)?\s*(sudo\s+)?exim(_\S+)?\s+(.*)$/) +elsif (/^((?i:[A-Z\d_]+=\S+\s+)+)?(\d+)?\s*(sudo(?:\s+-u\s+(\w+))?\s+)?exim(_\S+)?\s+(.*)$/) { - $args = $5; + $args = $6; my($envset) = (defined $1)? $1 : ""; - my($sudo) = (defined $3)? "sudo " : ""; - my($special)= (defined $4)? $4 : ""; + my($sudo) = (defined $3)? "sudo " . (defined $4 ? "-u $4 ":"") : ""; + my($special)= (defined $5)? $5 : ""; $wait_time = (defined $2)? $2 : 0; # Return 2 rather than 1 afterwards