From fb6de052bace5b26346c1624b57d87326a97c7b6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 13 Nov 2011 21:20:59 +0100 Subject: [PATCH] Silence successful tests that use 'compare' on AIX, HP-UX, Solaris. * tests/init.sh (compare): Remove "No differences encountered" or synonymous output from the 'diff' program. --- ChangeLog | 7 +++++++ tests/init.sh | 41 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 59f84c4d5..962b2c4aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ 2011-11-13 Bruno Haible + Jim Meyering + + Silence successful tests that use 'compare' on AIX, HP-UX, Solaris. + * tests/init.sh (compare): Remove "No differences encountered" or + synonymous output from the 'diff' program. + +2011-11-13 Bruno Haible Makefile: Tweak indentation. * Makefile: Use tab as first character in every line that contains rule diff --git a/tests/init.sh b/tests/init.sh index 373d9d4fe..c78e5b67a 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -221,10 +221,43 @@ export MALLOC_PERTURB_ # a partition, or to undo any other global state changes. cleanup_ () { :; } -if ( diff -u "$0" "$0" < /dev/null ) > /dev/null 2>&1; then - compare () { diff -u "$@"; } -elif ( diff -c "$0" "$0" < /dev/null ) > /dev/null 2>&1; then - compare () { diff -c "$@"; } +if diff_out_=`( diff -u "$0" "$0" < /dev/null ) 2>/dev/null`; then + if test -z "$diff_out_"; then + compare () { diff -u "$@"; } + else + compare () + { + if diff -u "$@" > diff.out; then + # No differences were found, but Solaris 'diff' produces output + # "No differences encountered". Hide this output. + rm -f diff.out + true + else + cat diff.out + rm -f diff.out + false + fi + } + fi +elif diff_out_=`( diff -c "$0" "$0" < /dev/null ) 2>/dev/null`; then + if test -z "$diff_out_"; then + compare () { diff -c "$@"; } + else + compare () + { + if diff -c "$@" > diff.out; then + # No differences were found, but AIX and HP-UX 'diff' produce output + # "No differences encountered" or "There are no differences between the + # files.". Hide this output. + rm -f diff.out + true + else + cat diff.out + rm -f diff.out + false + fi + } + fi elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then compare () { cmp -s "$@"; } else -- 2.11.0