blob: 6eddbd2524daef410ced43e0f1c95fd49bd81ae3 [file] [log] [blame]
#!/usr/bin/env perl
system("mkdir -p NEW DIFF");
if(@ARGV != 4) {
print "Usage: TESTonce name input output options\n";
exit 20;
}
$name=$ARGV[0];
$input=$ARGV[1];
$output=$ARGV[2];
$options=$ARGV[3];
if ($^O eq 'MSWin32') {
$r = system "..\\windump -n -r $input $options 2>NUL | tee NEW/$output | diff -w $output - >DIFF/$output.diff";
}
else {
$r = system "../tcpdump 2>/dev/null -n -r $input $options | tee NEW/$output | diff -w $output - >DIFF/$output.diff";
}
if($r == 0) {
printf " %-30s: passed\n", $name;
unlink "DIFF/$output.diff";
exit 0;
}
printf " %-30s: TEST FAILED", $name;
open FOUT, '>>failure-outputs.txt';
printf FOUT "Failed test: $name\n\n";
close FOUT;
system "cat DIFF/$output.diff >> failure-outputs.txt";
if($r == -1) {
print " (failed to execute: $!)\n";
exit 30;
}
if($r & 127) {
printf " (terminated with signal %u, %s coredump)\n", ($r & 127), ($r & 128) ? 'with' : 'without';
exit ($r & 128) ? 10 : 20;
}
print "\n";
exit $r >> 8;