]> The Tcpdump Group git mirrors - tcpdump/commitdiff
in some cases we expect tcpdump to fail with an error code
authorMichael Richardson <[email protected]>
Mon, 16 Feb 2015 02:21:29 +0000 (21:21 -0500)
committerMichael Richardson <[email protected]>
Mon, 9 Mar 2015 14:02:08 +0000 (10:02 -0400)
tests/TESTonce

index e58377b313aacaf2e72dc5224fede7cf69b41071..e6141d4b263f3e3f5c75095176cbda72ce06961c 100755 (executable)
@@ -12,13 +12,23 @@ $input=$ARGV[1];
 $output=$ARGV[2];
 $options=$ARGV[3];
 
+my $r;
+
 if ($^O eq 'MSWin32') {
-  $r = system "..\\windump -n -r $input $options 2>NUL | sed 's/\\r//' | tee NEW/$output | diff $output - >DIFF/$output.diff";
+    $r = system "..\\windump -n -r $input $options 2>NUL | sed 's/\\r//' | tee NEW/$output | diff $output - >DIFF/$output.diff";
+    # need to do same as below for Cygwin.
 }
 else {
     # we used to do this as a nice pipeline, but the problem is that $r fails to
     # to be set properly if the tcpdump core dumps.
     $r = system "../tcpdump 2>/dev/null -n -r $input $options >NEW/$output";
+    if($r == 0x100) {
+        # this means tcpdump exited with code 1.
+        open(OUTPUT, ">"."NEW/$output") || die "fail to open $output\n";
+        printf OUTPUT "EXIT CODE %08x\n", $r;
+        close(OUTPUT);
+        $r = 0;
+    }
     if($r == 0) {
         $r = system "cat NEW/$output | diff $output - >DIFF/$output.diff";
     }