diff options
author | Michael Richardson <mcr@sandelman.ca> | 2020-02-11 18:14:57 +0100 |
---|---|---|
committer | Michael Richardson <mcr@sandelman.ca> | 2020-03-02 10:33:23 -0500 |
commit | c0df5df0705df73818a91078e89fdb54edea6ff8 (patch) | |
tree | 72ad9f614713f2ae33cbdc63e5a1700f76d1f8d6 | |
parent | 02015506cc71b3a86aeb79632dff13acf9fb5223 (diff) | |
download | tcpdump-move-packets-captured-to-ndo.tar.gz |
change runtest to take keyword argumentsmove-packets-captured-to-ndo
-rwxr-xr-x | tests/TESTrun | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/tests/TESTrun b/tests/TESTrun index f6e1b3c0..d471b5bd 100755 --- a/tests/TESTrun +++ b/tests/TESTrun @@ -49,10 +49,15 @@ close(FAILUREOUTPUT); $confighhash = undef; sub runtest { - local($name, $input, $output, $options) = @_; + my %opt = @_; my $r; - $outputbase = basename($output); + my $name = %opt{'name'}; + my $input= %opt{'input'}; + my $output=%opt{'output'}; + my $args = %opt{'args'}; + + my $outputbase = basename($output); my $coredump = false; my $status = 0; my $linecount = 0; @@ -62,13 +67,13 @@ sub runtest { my $errdiffstat = 0; if ($^O eq 'MSWin32') { - $r = system "..\\windump -# -n -r $input $options 2>NUL | sed 's/\\r//' | tee tests/NEW/$outputbase | diff $output - >tests/DIFF/$outputbase.diff"; + $r = system "..\\windump -# -n -r $input $args 2>NUL | sed 's/\\r//' | tee tests/NEW/$outputbase | diff $output - >tests/DIFF/$outputbase.diff"; # need to do same as below for Cygwin. } else { # we used to do this as a nice pipeline, but the problem is that $r fails to # to be set properly if the tcpdump core dumps. - $r = system "$TCPDUMP 2>${rawstderrlog} -# -n -r $input $options >tests/NEW/${outputbase}"; + $r = system "$TCPDUMP 2>${rawstderrlog} -# -n -r $input $args >tests/NEW/${outputbase}"; if($r == -1) { # failed to start due to error. $status = $!; @@ -228,7 +233,7 @@ sub runOneComplexTest { my $output = $testconfig->{output}; my $input = $testconfig->{input}; my $name = $testconfig->{name}; - my $options= $testconfig->{args}; + my $args = $testconfig->{args}; my $foundit = 1; my $unfoundit=1; @@ -258,12 +263,12 @@ sub runOneComplexTest { #print Dumper($testconfig); # EXPAND any occurances of @TESTDIR@ to $testsdir - $options =~ s/\@TESTDIR\@/$testsdir/; + $args =~ s/\@TESTDIR\@/$testsdir/; - my $result = runtest($name, - $testsdir . "/" . $input, - $testsdir . "/" . $output, - $options); + my $result = runtest(name => $name, + input=> $testsdir . "/" . $input, + output=>$testsdir . "/" . $output, + args => $args); if($result == 0) { $passedcount++; |