Patchwork [4,of,6,V2] tests: make chunk header of external diff glob-ed for portability

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Feb. 8, 2016, 9:39 a.m.
Message ID <2f3a11fe655a6543353e.1454924360@juju>
Download mbox | patch
Permalink /patch/13047/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - Feb. 8, 2016, 9:39 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1454923757 -32400
#      Mon Feb 08 18:29:17 2016 +0900
# Node ID 2f3a11fe655a6543353e6b74bb59933792d3c6cd
# Parent  f142161fb45f90312f44f3502f746f99e93b1ad2
tests: make chunk header of external diff glob-ed for portability

Before this patch, some tests using external "diff" command via
extdiff extension fail on Solaris, because system standard "diff" (=
/usr/bin/diff) on Solaris always generates chunk headers below:

  - "@@ -1,0 +1,nnnn @@" for added file
  - "@@ -1,nnnn +1,0 @@" for removed file

even though "diff" on Linux generates:

  - "@@ -0,0 +1,nnnn @@" for added file
  - "@@ -1,nnnn +0,0 @@" for removed file

This patch makes chunk header of external diff glob-ed for portability
of tests.

"hg diff" output follows Linux style, and there are many such diff
output lines in existing tests. This is reason why this patch doesn't
add check-code.py any rule to detect such diff output in tests.

This patch is a part of making tests using external "diff" portable,
and test-subrepo-deep-nested-change.t isn't yet portable even after
this patch.

Patch

diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t
--- a/tests/test-subrepo-deep-nested-change.t
+++ b/tests/test-subrepo-deep-nested-change.t
@@ -738,17 +738,17 @@  Interaction with extdiff, largefiles and
   diff -Nru cloned.*/.hglf/b.dat cloned.*/.hglf/b.dat (glob)
   --- cloned.*/.hglf/b.dat	* (glob)
   +++ cloned.*/.hglf/b.dat	* (glob)
-  @@ -0,0 +1* @@ (glob)
+  @@ -*,0 +1* @@ (glob)
   +da39a3ee5e6b4b0d3255bfef95601890afd80709
   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* @@ (glob)
+  @@ -*,0 +1* @@ (glob)
   +2f6933b5ee0f5fdd823d9717d8729f3c2523811b
   diff -Nru cloned.*/.hglf/large.bin cloned.*/.hglf/large.bin (glob)
   --- cloned.*/.hglf/large.bin	* (glob)
   +++ cloned.*/.hglf/large.bin	* (glob)
-  @@ -0,0 +1* @@ (glob)
+  @@ -*,0 +1* @@ (glob)
   +7f7097b041ccf68cc5561e9600da4655d21c6d18
   diff -Nru cloned.*/.hgsub cloned.*/.hgsub (glob)
   --- cloned.*/.hgsub	* (glob)
@@ -766,7 +766,7 @@  Interaction with extdiff, largefiles and
   diff -Nru cloned.*/foo/bar/def cloned.*/foo/bar/def (glob)
   --- cloned.*/foo/bar/def	* (glob)
   +++ cloned.*/foo/bar/def	* (glob)
-  @@ -0,0 +1* @@ (glob)
+  @@ -*,0 +1* @@ (glob)
   +changed
   diff -Nru cloned.*/main cloned.*/main (glob)
   --- cloned.*/main	* (glob)
@@ -783,7 +783,7 @@  Interaction with extdiff, largefiles and
   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* @@ (glob)
+  @@ -*,0 +1* @@ (glob)
   +subfolder
   diff -Nru cloned.*/sub1/sub2/sub2 cloned.*/sub1/sub2/sub2 (glob)
   --- cloned.*/sub1/sub2/sub2	* (glob)
@@ -794,7 +794,7 @@  Interaction with extdiff, largefiles and
   diff -Nru cloned.*/sub3/a.txt cloned.*/sub3/a.txt (glob)
   --- cloned.*/sub3/a.txt	* (glob)
   +++ cloned.*/sub3/a.txt	* (glob)
-  @@ -0,0 +1* @@ (glob)
+  @@ -*,0 +1* @@ (glob)
   +xyz
   [1]