changeset 27557:28b5c4fcf48d

tests: Solaris diff -U also emits "No differences encountered" This came up before, but the tests in check-code.py don't find -U (only -u) and they don't work when the diff is inside a shell function. This fixes the offending tests and beefs up check-code.py.
author Danek Duvall <danek.duvall@oracle.com>
date Sun, 27 Dec 2015 15:24:48 -0800
parents 1df9b8b2abda
children b5b54825de6b
files contrib/check-code.py tests/test-merge-changedelete.t tests/test-merge-force.t
diffstat 3 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Tue Dec 29 18:11:14 2015 -0500
+++ b/contrib/check-code.py	Sun Dec 27 15:24:48 2015 -0800
@@ -122,7 +122,8 @@
     (r'^( *)\t', "don't use tabs to indent"),
     (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)',
      "put a backslash-escaped newline after sed 'i' command"),
-    (r'^diff *-\w*u.*$\n(^  \$ |^$)', "prefix diff -u with cmp"),
+    (r'^diff *-\w*[uU].*$\n(^  \$ |^$)', "prefix diff -u/-U with cmp"),
+    (r'^\s+(if)? diff *-\w*[uU]', "prefix diff -u/-U with cmp"),
     (r'seq ', "don't use 'seq', use $TESTDIR/seq.py"),
     (r'\butil\.Abort\b', "directly use error.Abort"),
     (r'\|&', "don't use |&, use 2>&1"),
--- a/tests/test-merge-changedelete.t	Tue Dec 29 18:11:14 2015 -0500
+++ b/tests/test-merge-changedelete.t	Sun Dec 27 15:24:48 2015 -0800
@@ -460,7 +460,7 @@
   --- file3 ---
   3
   changed2
-  $ diff -U8 $TESTTMP/fail.status $TESTTMP/prompt.status
+  $ cmp $TESTTMP/fail.status $TESTTMP/prompt.status || diff -U8 $TESTTMP/fail.status $TESTTMP/prompt.status
 
 
 Force prompts
@@ -583,7 +583,7 @@
   >         hg resolve --tool ":$tool" --all --config ui.interactive=True
   >         status > "$TESTTMP/compare.status" 2>&1
   >         echo '--- diff of status ---'
-  >         if diff -U8 "$TESTTMP/$tool.status" "$TESTTMP/compare.status"; then
+  >         if cmp "$TESTTMP/$tool.status" "$TESTTMP/compare.status" || diff -U8 "$TESTTMP/$tool.status" "$TESTTMP/compare.status"; then
   >             echo '(status identical)'
   >         fi
   >         lasttool="$tool"
@@ -868,7 +868,7 @@
   --- file3 ---
   3
   changed1
-  $ diff -U8 $TESTTMP/fail.status $TESTTMP/prompt.status
+  $ cmp $TESTTMP/fail.status $TESTTMP/prompt.status || diff -U8 $TESTTMP/fail.status $TESTTMP/prompt.status
 
 Choose to merge all files
 
--- a/tests/test-merge-force.t	Tue Dec 29 18:11:14 2015 -0500
+++ b/tests/test-merge-force.t	Sun Dec 27 15:24:48 2015 -0800
@@ -779,4 +779,4 @@
   warning: conflicts while merging missing_content2_missing_content4-untracked! (edit, then use 'hg resolve --mark')
   [1]
   $ checkstatus > $TESTTMP/status2 2>&1
-  $ diff -U8 $TESTTMP/status1 $TESTTMP/status2
+  $ cmp $TESTTMP/status1 $TESTTMP/status2 || diff -U8 $TESTTMP/status1 $TESTTMP/status2