mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-24 10:33:28 +08:00
38 lines
838 B
Perl
Executable File
38 lines
838 B
Perl
Executable File
#!/usr/bin/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];
|
|
|
|
$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;
|