]> The Tcpdump Group git mirrors - tcpdump/commitdiff
TESTrun: use fc, rather than diff, on Windows.
authorGuy Harris <[email protected]>
Sat, 13 Jun 2020 08:55:49 +0000 (01:55 -0700)
committerGuy Harris <[email protected]>
Sat, 13 Jun 2020 08:55:49 +0000 (01:55 -0700)
diff doesn't come standard with Windows; fc does.

tests/TESTrun

index b5d2aa84424d1e91d4acd782f8397ac0686d283b..bd4c21bb796fec136dd2f663fd3440089acfda18 100755 (executable)
@@ -125,7 +125,17 @@ sub runtest {
             $r = 0;
         }
         if($r == 0) {
-            $r = system "diff $output tests/NEW/$outputbase >tests/DIFF/$outputbase.diff";
+            #
+            # Compare tcpdump's output with what we think it should be.
+            # If tcpdump failed to produce output, we've produced our own
+            # "output" above, with the exit status.
+            #
+            if ($^O eq 'MSWin32') {
+                my $winoutput = File::Spec->canonpath($output);
+                $r = system "fc/lb1000/t/1 $winoutput tests\\NEW\\$outputbase >tests\\DIFF\\$outputbase.diff";
+            } else {
+                $r = system "diff $output tests/NEW/$outputbase >tests/DIFF/$outputbase.diff";
+            }
             $diffstat = WEXITSTATUS($r);
         }
 
@@ -147,7 +157,15 @@ sub runtest {
         close(ERRORRAW);
 
         if ( -f "$output.stderr" ) {
-            $nr = system "diff $output.stderr $stderrlog >tests/DIFF/$outputbase.stderr.diff";
+            #
+            # Compare the standard error with what we think it should be.
+            #
+            if ($^O eq 'MSWin32') {
+                my $canonstderrlog = File::Spec->canonpath($stderrlog);
+                $nr = system "fc/lb1000/t/1 $output.stderr $canonstderrlog >tests/DIFF/$outputbase.stderr.diff";
+            } else {
+                $nr = system "diff $output.stderr $stderrlog >tests/DIFF/$outputbase.stderr.diff";
+            }
             if($r == 0) {
                 $r = $nr;
             }