]> The Tcpdump Group git mirrors - tcpdump/blob - tests/TESTonce
Merge branch 'master' of git+ssh://bpf.tcpdump.org/tcpdump/master/git/tcpdump
[tcpdump] / tests / TESTonce
1 #!/usr/bin/perl
2
3 $debug = 0;
4 system("mkdir -p NEW DIFF");
5
6 if(@ARGV == 1) {
7 open(TESTLIST, "TESTLIST") || die "can not open TESTLIST: $!\n";
8 $wanted = $ARGV[0];
9 #print "Searching for test case $wanted\n";
10 while(<TESTLIST>) {
11 #print "Processing $_\n";
12 next unless (/^$wanted/);
13
14 chop;
15 ($name,$input,$output,$options)=split(/\s+/,$_, 4);
16 last;
17 }
18 close(TESTLIST);
19
20 die "Can not find test $wanted\n" unless defined($input);
21
22 } elsif(@ARGV == 4) {
23 $name=$ARGV[0];
24 $input=$ARGV[1];
25 $output=$ARGV[2];
26 $options=$ARGV[3];
27 } else {
28 print "Usage: TESTonce name [input output options]\n";
29 exit 20;
30 }
31
32 print "Running $name. \n" if $debug;
33 print " Input: $input, OUTPUT: $output, OPTIONS: $options\n" if $debug;
34
35 if (! -f $input) {
36 ($puu = $input) =~ s/\.pcap/\.puu/;
37 if( -f $puu) {
38 print "Uudecoding $puu to make $input\n";
39 system("uudecode $puu");
40 }
41 }
42
43 print " ";
44 exec("../tcpdump 2>/dev/null -n -r $input $options | tee NEW/$output | diff -w - $output >DIFF/$output.diff");
45 @cores = glob("core*");
46 exit 10 if (@cores > 0);
47 exit 0;