]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use unified diff by default. [skip ci]
authorDenis Ovsienko <[email protected]>
Tue, 4 Jan 2022 21:53:00 +0000 (21:53 +0000)
committerDenis Ovsienko <[email protected]>
Tue, 4 Jan 2022 21:53:00 +0000 (21:53 +0000)
GNU/Linux (specifically, the GNU part), FreeBSD, NetBSD, OpenBSD,
illumos and even Solaris 9 and AIX 7.1 all have a diff that supports
"-u" for unified output format.  Let that be the default to make test
failures more intelligible for humans.  The old behaviour is available
with "DIFF_FLAGS= make check".

CHANGES
tests/TESTrun

diff --git a/CHANGES b/CHANGES
index f0987a58b33f7d51ffe9e5198349f2f8422994bb..05ab4f3527af108eb8ebf3974a0ae8b77d193d94 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -22,6 +22,7 @@ Monthday, Month DD, YYYY by gharris and denis
       RPKI-Router: Refine length and bounds checks.
     Building and testing:
       Treat "msys" as Windows for test exit statuses.
+      Use unified diff by default.
 
 TBD
   Summary for 4.99.2 tcpdump release: (so far)
index eddfacbc8522f8a05c108d9ac3e56b16cf7ac2cc..cca46e63084b1234d5d0570fa20618d08ff01be8 100755 (executable)
@@ -39,6 +39,8 @@ mkpath($newdir);
 mkpath($diffdir);
 my $origdir = getcwd();
 my $srcdir  = $ENV{'srcdir'} || ".";
+# Default to unified diff and allow to fall back to basic diff if necessary.
+my $diff_flags = defined $ENV{'DIFF_FLAGS'} ? $ENV{'DIFF_FLAGS'} : '-u';
 
 #
 # Force UTC, so time stamps are printed in a standard time zone, and
@@ -226,7 +228,7 @@ sub runtest {
             $r = system "fc /lb1000 /t /1 $winoutput tests\\NEW\\$outputbase >tests\\DIFF\\$outputbase.diff";
             $diffstat = $r >> 8;
         } else {
-            $r = system "diff $output tests/NEW/$outputbase >tests/DIFF/$outputbase.diff";
+            $r = system "diff $diff_flags $output tests/NEW/$outputbase >tests/DIFF/$outputbase.diff";
             $diffstat = WEXITSTATUS($r);
         }
     }