Home | History | Annotate | Download | only in tests
      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 print "    ";
     36 exec("../tcpdump 2>/dev/null -n -r $input $options | tee NEW/$output | diff -w - $output >DIFF/$output.diff");
     37 @cores = glob("core*");
     38 exit 10 if (@cores > 0);
     39 exit 0;
     40