3 system("mkdir -p NEW DIFF");
6 print "Usage: TESTonce name input output options\n";
17 if ($^O
eq 'MSWin32') {
18 $r = system "..\\windump -n -r $input $options 2>NUL | sed 's/\\r//' | tee NEW/$output | diff $output - >DIFF/$output.diff";
19 # need to do same as below for Cygwin.
22 # we used to do this as a nice pipeline, but the problem is that $r fails to
23 # to be set properly if the tcpdump core dumps.
24 $r = system "../tcpdump 2>/dev/null -n -r $input $options >NEW/$output";
26 # this means tcpdump exited with code 1.
27 open(OUTPUT
, ">>"."NEW/$output") || die "fail to open $output\n";
28 printf OUTPUT
"EXIT CODE %08x\n", $r;
33 $r = system "cat NEW/$output | diff $output - >DIFF/$output.diff";
35 #print sprintf("END: %08x\n", $r);
39 printf " %-30s: passed\n", $name;
40 unlink "DIFF/$output.diff";
43 printf " %-30s: TEST FAILED", $name;
44 open FOUT
, '>>failure-outputs.txt';
45 printf FOUT
"Failed test: $name\n\n";
47 if(-f
"DIFF/$output.diff") {
48 system "cat DIFF/$output.diff >> failure-outputs.txt";
52 print " (failed to execute: $!)\n";
56 # this is not working right, $r == 0x8b00 when there is a core dump.
57 # clearly, we need some platform specific perl magic to take this apart, so look for "core"
59 if($r & 127 || -f
"core") {
60 my $with = ($r & 128) ?
'with' : 'without';
64 printf " (terminated with signal %u, %s coredump)\n", ($r & 127), $with;
65 exit ($r & 128) ?
10 : 20;