]> The Tcpdump Group git mirrors - tcpdump/commitdiff
added some debugging, found wrong failure-outputs file
authorMichael Richardson <[email protected]>
Wed, 18 Sep 2019 19:57:22 +0000 (15:57 -0400)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 24 Sep 2019 12:12:09 +0000 (14:12 +0200)
tests/TESTonce

index 3568d8f1c3b4e2e44d0d4346bf3938628629642d..08da37eb06fde8f41aaaa648c468d745bdc5a521 100755 (executable)
@@ -43,8 +43,8 @@ else {
     if($r != 0) {
         $coredump = false;
         $status = 0;
-        # this means tcpdump failed.
-        open(OUTPUT, ">>"."tests/NEW/$outputbase") || die "fail to open $outputbase\n";
+        # this means tcpdump failed, which however, might be expected.
+        open(OUTPUT, ">>"."tests/NEW/${outputbase}") || die "fail to open ${outputbase}\n";
         if( $r & 128 ) {
             $coredump = $r & 127;
         }
@@ -58,12 +58,14 @@ else {
             printf OUTPUT "\nEXIT CODE %08x\n", $r;
         }
         close(OUTPUT);
-        $r = 0;
-    }
-    if($r == 0) {
-        $r = system "cat tests/NEW/$outputbase | diff $output - >tests/DIFF/$outputbase.diff";
-        $diffstat = WEXITSTATUS($r);
+        $r = 0;  # clear the error so that the diff will occur.
     }
+    #print "RUNNING DIFF after ${r}\n";
+
+    # always run diff.
+    #print "RUNNING: cat tests/NEW/${outputbase} | diff $output - >tests/DIFF/${outputbase}.diff\n";
+    $r = system "cat tests/NEW/${outputbase} | diff $output - >tests/DIFF/${outputbase}.diff";
+    $diffstat = WEXITSTATUS($r);
 
     # process the file, sanitize "reading from" line, and count lines
     $linecount = 0;
@@ -94,6 +96,7 @@ else {
 
     if($r == 0) {
         if($linecount == 0 && $status == 0) {
+            #print "UNLINK: ${stderrlog}\n";
             unlink($stderrlog);
         } else {
             $errdiffstat = "+";
@@ -116,11 +119,11 @@ if($r == 0) {
 }
 # must have failed!
 printf "    %-35s: TEST FAILED(exit core=%d/diffstat=%d,%d/r=%d)", $name, $coredump, $diffstat, $errdiffstat, $r;
-open FOUT, '>>failure-outputs.txt';
+open FOUT, '>>tests/failure-outputs.txt';
 printf FOUT "\nFailed test: $name\n\n";
 close FOUT;
 if(-f "tests/DIFF/$outputbase.diff") {
-    system "cat tests/DIFF/$outputbase.diff >> failure-outputs.txt";
+    system "cat tests/DIFF/$outputbase.diff >> tests/failure-outputs.txt";
 }
 
 if($r == -1) {