comparison tests/pdiff @ 28337:869e65e68aee

tests: Solaris cmp complains about empty files, even with -s When you compare an empty file, such as /dev/null, with a non-empty file, Solaris cmp complains on stderr with "cmp: EOF on /dev/null", even if the -s argument is present. GNU cmp makes the complaint, but silences it with -s. We can change the pdiff utility to simply redirect stderr to /dev/null so that we don't have to worry about this difference in the test files.
author Danek Duvall <danek.duvall@oracle.com>
date Wed, 02 Mar 2016 14:58:29 -0800
parents b59ef0c21405
children a2b55ee62803
comparison
equal deleted inserted replaced
28336:a5a13eeffc59 28337:869e65e68aee
23 file2="$2" 23 file2="$2"
24 if test ! -f "$file2"; then 24 if test ! -f "$file2"; then
25 file2=/dev/null 25 file2=/dev/null
26 fi 26 fi
27 27
28 if cmp -s "$file1" "$file2"; then 28 if cmp -s "$file1" "$file2" 2> /dev/null; then
29 # Return immediately, because comparison isn't needed. This 29 # Return immediately, because comparison isn't needed. This
30 # also avoids redundant message of diff like "No differences 30 # also avoids redundant message of diff like "No differences
31 # encountered" (on Solaris) 31 # encountered" (on Solaris)
32 return 32 return
33 fi 33 fi