changeset 28033:0707bbec682d

tests: omit -p for external diff via extdiff extension for portability Before this patch, some tests using external "diff" command via extdiff extension fail on Solaris, because "-p" (show which C function each change is in) option isn't supported by system standard "diff" on Solaris, even though extdiff passes it to external "diff" by default. Fortunately, this non-portable option isn't important for (current, at least) tests using external "diff" command via extdiff extension. This patch omits "-p" for external "diff" command via extdiff extension for portability of tests, and adds check-code.py a rule to detect invocation of "diff" with "-p". Newly added check-code.py rule examines only lines generated by external "diff" with "-r", because strict examination might misidentify "hg diff -p" or other complicated lines consisting of "diff" string as wrong one. This patch is a part of making tests using external "diff" portable, and tests below aren't yet portable even after this patch. test-graft.t test-largefiles-update.t test-subrepo-deep-nested-change.t
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 08 Feb 2016 18:29:17 +0900
parents 8157c6b82f40
children e7ff258f71df
files contrib/check-code.py tests/test-graft.t tests/test-largefiles-update.t tests/test-subrepo-deep-nested-change.t
diffstat 4 files changed, 32 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Sun Feb 07 22:18:24 2016 -0800
+++ b/contrib/check-code.py	Mon Feb 08 18:29:17 2016 +0900
@@ -176,6 +176,8 @@
      'write "file:/*/$TESTTMP" + (glob) to match on windows too'),
     (r'^  (cat|find): .*: No such file or directory',
      'use test -f to test for file existence'),
+    (r'^  diff -[^ -]*p',
+     "don't use (external) diff with -p for portability"),
   ],
   # warnings
   [
--- a/tests/test-graft.t	Sun Feb 07 22:18:24 2016 -0800
+++ b/tests/test-graft.t	Mon Feb 08 18:29:17 2016 +0900
@@ -1,3 +1,9 @@
+  $ cat >> $HGRCPATH <<EOF
+  > [defaults]
+  > # for portability
+  > extdiff = --option -Nru
+  > EOF
+
 Create a repo with some stuff in it:
 
   $ hg init a
--- a/tests/test-largefiles-update.t	Sun Feb 07 22:18:24 2016 -0800
+++ b/tests/test-largefiles-update.t	Mon Feb 08 18:29:17 2016 +0900
@@ -6,6 +6,9 @@
   > merge = internal:fail
   > [extensions]
   > largefiles =
+  > [defaults]
+  > # for portability
+  > extdiff = --option -Nru
   > EOF
 
   $ hg init repo
@@ -21,13 +24,13 @@
   $ echo 'normal1 in #1' > normal1
   $ hg commit -m '#1'
   $ hg extdiff -r '.^' --config extensions.extdiff=
-  diff -Npru repo.0d9d9b8dc9a3/.hglf/large1 repo/.hglf/large1
+  diff -Nru repo.0d9d9b8dc9a3/.hglf/large1 repo/.hglf/large1
   --- repo.0d9d9b8dc9a3/.hglf/large1	* (glob)
   +++ repo/.hglf/large1	* (glob)
   @@ -1 +1 @@
   -4669e532d5b2c093a78eca010077e708a071bb64
   +58e24f733a964da346e2407a2bee99d9001184f5
-  diff -Npru repo.0d9d9b8dc9a3/normal1 repo/normal1
+  diff -Nru repo.0d9d9b8dc9a3/normal1 repo/normal1
   --- repo.0d9d9b8dc9a3/normal1	* (glob)
   +++ repo/normal1	* (glob)
   @@ -1 +1 @@
--- a/tests/test-subrepo-deep-nested-change.t	Sun Feb 07 22:18:24 2016 -0800
+++ b/tests/test-subrepo-deep-nested-change.t	Mon Feb 08 18:29:17 2016 +0900
@@ -1,3 +1,9 @@
+  $ cat >> $HGRCPATH <<EOF
+  > [defaults]
+  > # for portability
+  > extdiff = --option -Nru
+  > EOF
+
 Preparing the subrepository 'sub2'
 
   $ hg init sub2
@@ -714,13 +720,13 @@
   $ hg --config extensions.extdiff= extdiff -S
 
   $ hg --config extensions.extdiff= extdiff -r '.^' -S
-  diff -Npru cloned.*/.hgsub cloned/.hgsub (glob)
+  diff -Nru cloned.*/.hgsub cloned/.hgsub (glob)
   --- cloned.*/.hgsub	* +0000 (glob)
   +++ cloned/.hgsub	* +0000 (glob)
   @@ -1,2 +1 @@
    sub1 = ../sub1
   -sub3 = sub3
-  diff -Npru cloned.*/.hgsubstate cloned/.hgsubstate (glob)
+  diff -Nru cloned.*/.hgsubstate cloned/.hgsubstate (glob)
   --- cloned.*/.hgsubstate	* +0000 (glob)
   +++ cloned/.hgsubstate	* +0000 (glob)
   @@ -1,2 +1 @@
@@ -729,63 +735,63 @@
   [1]
 
   $ hg --config extensions.extdiff= extdiff -r 0 -r '.^' -S
-  diff -Npru cloned.*/.hglf/b.dat cloned.*/.hglf/b.dat (glob)
+  diff -Nru cloned.*/.hglf/b.dat cloned.*/.hglf/b.dat (glob)
   --- cloned.*/.hglf/b.dat	* (glob)
   +++ cloned.*/.hglf/b.dat	* (glob)
   @@ -0,0 +1 @@
   +da39a3ee5e6b4b0d3255bfef95601890afd80709
-  diff -Npru cloned.*/.hglf/foo/bar/large.dat cloned.*/.hglf/foo/bar/large.dat (glob)
+  diff -Nru cloned.*/.hglf/foo/bar/large.dat cloned.*/.hglf/foo/bar/large.dat (glob)
   --- cloned.*/.hglf/foo/bar/large.dat	* (glob)
   +++ cloned.*/.hglf/foo/bar/large.dat	* (glob)
   @@ -0,0 +1 @@
   +2f6933b5ee0f5fdd823d9717d8729f3c2523811b
-  diff -Npru cloned.*/.hglf/large.bin cloned.*/.hglf/large.bin (glob)
+  diff -Nru cloned.*/.hglf/large.bin cloned.*/.hglf/large.bin (glob)
   --- cloned.*/.hglf/large.bin	* (glob)
   +++ cloned.*/.hglf/large.bin	* (glob)
   @@ -0,0 +1 @@
   +7f7097b041ccf68cc5561e9600da4655d21c6d18
-  diff -Npru cloned.*/.hgsub cloned.*/.hgsub (glob)
+  diff -Nru cloned.*/.hgsub cloned.*/.hgsub (glob)
   --- cloned.*/.hgsub	* (glob)
   +++ cloned.*/.hgsub	* (glob)
   @@ -1 +1,2 @@
    sub1 = ../sub1
   +sub3 = sub3
-  diff -Npru cloned.*/.hgsubstate cloned.*/.hgsubstate (glob)
+  diff -Nru cloned.*/.hgsubstate cloned.*/.hgsubstate (glob)
   --- cloned.*/.hgsubstate	* (glob)
   +++ cloned.*/.hgsubstate	* (glob)
   @@ -1 +1,2 @@
   -fc3b4ce2696f7741438c79207583768f2ce6b0dd sub1
   +7a36fa02b66e61f27f3d4a822809f159479b8ab2 sub1
   +b1a26de6f2a045a9f079323693614ee322f1ff7e sub3
-  diff -Npru cloned.*/foo/bar/def cloned.*/foo/bar/def (glob)
+  diff -Nru cloned.*/foo/bar/def cloned.*/foo/bar/def (glob)
   --- cloned.*/foo/bar/def	* (glob)
   +++ cloned.*/foo/bar/def	* (glob)
   @@ -0,0 +1 @@
   +changed
-  diff -Npru cloned.*/main cloned.*/main (glob)
+  diff -Nru cloned.*/main cloned.*/main (glob)
   --- cloned.*/main	* (glob)
   +++ cloned.*/main	* (glob)
   @@ -1 +1 @@
   -main
   +foo
-  diff -Npru cloned.*/sub1/.hgsubstate cloned.*/sub1/.hgsubstate (glob)
+  diff -Nru cloned.*/sub1/.hgsubstate cloned.*/sub1/.hgsubstate (glob)
   --- cloned.*/sub1/.hgsubstate	* (glob)
   +++ cloned.*/sub1/.hgsubstate	* (glob)
   @@ -1 +1 @@
   -c57a0840e3badd667ef3c3ef65471609acb2ba3c sub2
   +c77908c81ccea3794a896c79e98b0e004aee2e9e sub2
-  diff -Npru cloned.*/sub1/sub2/folder/test.txt cloned.*/sub1/sub2/folder/test.txt (glob)
+  diff -Nru cloned.*/sub1/sub2/folder/test.txt cloned.*/sub1/sub2/folder/test.txt (glob)
   --- cloned.*/sub1/sub2/folder/test.txt	* (glob)
   +++ cloned.*/sub1/sub2/folder/test.txt	* (glob)
   @@ -0,0 +1 @@
   +subfolder
-  diff -Npru cloned.*/sub1/sub2/sub2 cloned.*/sub1/sub2/sub2 (glob)
+  diff -Nru cloned.*/sub1/sub2/sub2 cloned.*/sub1/sub2/sub2 (glob)
   --- cloned.*/sub1/sub2/sub2	* (glob)
   +++ cloned.*/sub1/sub2/sub2	* (glob)
   @@ -1 +1 @@
   -sub2
   +modified
-  diff -Npru cloned.*/sub3/a.txt cloned.*/sub3/a.txt (glob)
+  diff -Nru cloned.*/sub3/a.txt cloned.*/sub3/a.txt (glob)
   --- cloned.*/sub3/a.txt	* (glob)
   +++ cloned.*/sub3/a.txt	* (glob)
   @@ -0,0 +1 @@