From: Lyndon Nerenberg Date: Thu, 31 Jan 2013 11:56:55 +0000 (-0800) Subject: Use cmp(1) to compare acheieved and expected test results. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/bdb55520b3ca4ca887497822aee7d399337228aa?ds=sidebyside;hp=-c Use cmp(1) to compare acheieved and expected test results. 'diff -c' on Solaris 11 generate a spurious 'No differences encountered' message (on stdout, no less!) when the compared files are identical. This changes the test logic to compare with 'cmp -s', and then perform a 'diff -c' if the results don't match expectations. --- bdb55520b3ca4ca887497822aee7d399337228aa diff --git a/test/common.sh.in b/test/common.sh.in index 3c916274..4c804155 100644 --- a/test/common.sh.in +++ b/test/common.sh.in @@ -128,10 +128,13 @@ check_for_hard_links () { #### If different, global variable "failed" is incremented. check() { #### POSIX diff should support -c. - if diff -c "$1" "$2"; then + if cmp -s "$1" "$2"; then test $# -lt 3 -o "$3" != 'keep first' && rm -f "$1" rm -f "$2" else + echo + diff -c "$1" "$2" + echo echo "$0: test failed, outputs are in $1 and $2." failed=`expr ${failed:-0} + 1` fi