diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-01-11 09:36:48 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-01-11 09:55:28 +1100 |
commit | d0123e0a9a4a9dc2e28d6f66afce73b9ab0b0936 (patch) | |
tree | 92666e8544ad326a00cc4d8aa632269c613d092b | |
parent | 1eebdfdbe7200fdc7788834a28818f8e0155904a (diff) | |
download | samba-d0123e0a9a4a9dc2e28d6f66afce73b9ab0b0936.tar.gz samba-d0123e0a9a4a9dc2e28d6f66afce73b9ab0b0936.tar.bz2 samba-d0123e0a9a4a9dc2e28d6f66afce73b9ab0b0936.zip |
s4-selftest: when a command fails show both normal and expanded command
It is sometimes hard to tell which varient of something like
$SMB_CONF_PATH or $USERNAME is being used in a test. By giving both
the expanded command ($command with environment variables expanded)
and non-expanded command it is easier to reproduce bugs outside the
test environment.
-rwxr-xr-x | selftest/selftest.pl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/selftest/selftest.pl b/selftest/selftest.pl index e7191efbf2..883d2a0d46 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -212,6 +212,17 @@ sub cleanup_pcap($$) unlink($pcap_file); } +# expand strings from %ENV +sub expand_environment_strings($) +{ + my $s = shift; + # we use a reverse sort so we do the longer ones first + foreach my $k (sort { $b cmp $a } keys %ENV) { + $s =~ s/\$$k/$ENV{$k}/g; + } + return $s; +} + sub run_testsuite($$$$$) { my ($envname, $name, $cmd, $i, $totalsuites) = @_; @@ -255,6 +266,7 @@ sub run_testsuite($$$$$) } print "command: $cmd\n"; + printf "expanded command: %s\n", expand_environment_strings($cmd); my $exitcode = $ret >> 8; |