Patchwork [2,of,3,STABLE] tests: use pdiff instead of diff for portability

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Aug. 1, 2017, 11:52 a.m.
Message ID <e5dac85fed4b0ebf699c.1501588341@juju>
Download mbox | patch
Permalink /patch/22603/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - Aug. 1, 2017, 11:52 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1501474594 -32400
#      Mon Jul 31 13:16:34 2017 +0900
# Branch stable
# Node ID e5dac85fed4b0ebf699cc55374356a4020a7a891
# Parent  3277d2061d402e571111a282e1568f8e3bec189d
# Available At https://bitbucket.org/foozy/mercurial-wip
#              hg pull https://bitbucket.org/foozy/mercurial-wip -r e5dac85fed4b
# EXP-Topic tests-portability
tests: use pdiff instead of diff for portability

"diff" command might cause redundant message, "No differences
encountered" on Solaris for example. But suppressing option like "-q"
isn't portable, because POSIX specification doesn't define it.

pdiff script was introduced by b59ef0c21405 to stabilize output of
standard diff command on each platforms.

Patch

diff --git a/tests/test-cache-abuse.t b/tests/test-cache-abuse.t
--- a/tests/test-cache-abuse.t
+++ b/tests/test-cache-abuse.t
@@ -47,21 +47,21 @@  Make a helper function to check cache da
   >  echo bad > $CACHE
   >  test -z "$CLEAN" || $CLEAN
   >  hg $CMD > after
-  >  diff -u before after || echo "*** overwrite corruption"
+  >  "$RUNTESTDIR/pdiff" before after || echo "*** overwrite corruption"
   >  echo corruption >> $CACHE
   >  test -z "$CLEAN" || $CLEAN
   >  hg $CMD > after
-  >  diff -u before after || echo "*** append corruption"
+  >  "$RUNTESTDIR/pdiff" before after || echo "*** append corruption"
   >  rm $CACHE
   >  mkdir $CACHE
   >  test -z "$CLEAN" || $CLEAN
   >  hg $CMD > after
-  >  diff -u before after || echo "*** read-only corruption"
+  >  "$RUNTESTDIR/pdiff" before after || echo "*** read-only corruption"
   >  test -d $CACHE || echo "*** directory clobbered"
   >  rmdir $CACHE
   >  test -z "$CLEAN" || $CLEAN
   >  hg $CMD > after
-  >  diff -u before after || echo "*** missing corruption"
+  >  "$RUNTESTDIR/pdiff" before after || echo "*** missing corruption"
   >  test -f $CACHE || echo "not rebuilt"
   > }