From b0056ea86d427d76bb4c08506198d0c97075fdf6 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 11 Jul 2016 19:51:08 +0200 Subject: {md5,shaN}sum: make -c EMPTY fail function old new delta md5_sha1_sum_main 466 485 +19 Signed-off-by: Denys Vlasenko --- testsuite/md5sum.tests | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'testsuite/md5sum.tests') diff --git a/testsuite/md5sum.tests b/testsuite/md5sum.tests index 6c75b6d1c..cca26dc64 100755 --- a/testsuite/md5sum.tests +++ b/testsuite/md5sum.tests @@ -23,6 +23,8 @@ test -f "$bindir/.config" && . "$bindir/.config" test x"$CONFIG_FEATURE_FANCY_HEAD" != x"y" \ && { echo "SKIPPED: $sum"; exit 0; } +FAILCOUNT=0 + text="The quick brown fox jumps over the lazy dog" text=`yes "$text" | head -c 9999` @@ -33,11 +35,21 @@ while test $n -le 999; do n=$(($n+1)) done | "$sum" )` - -if test x"$result" = x"$expected -"; then +if test x"$result" != x"$expected -"; then + echo "FAIL: $sum (r:$result exp:$expected)" + : $((FAILCOUNT++)) +else echo "PASS: $sum" - exit 0 fi -echo "FAIL: $sum (r:$result exp:$expected)" -exit 1 +# GNU compat: -c EMPTY must fail (exitcode 1)! +>EMPTY +if "$sum" -c EMPTY 2>/dev/null; then + echo "FAIL: $sum -c EMPTY" + : $((FAILCOUNT++)) +else + echo "PASS: $sum -c EMPTY" +fi +rm EMPTY + +exit $FAILCOUNT -- cgit v1.2.3