(md5sum): Set to $srcdir/md5sum.
[coreutils.git] / tests / md5sum / md5-rfc
blobc3e9298caede5b69e983983a42d6d68981ff18fd
1 #! /bin/sh
3 md5sum=${MD5SUM:-$srcdir/md5sum}
5 test "$VERBOSE" = yes && $md5sum --version
7 set - \
8 1 d41d8cd98f00b204e9800998ecf8427e "" \
9 2 0cc175b9c0f1b6a831c399e269772661 a \
10 3 900150983cd24fb0d6963f7d28e17f72 abc \
11 4 f96b697d7cb7938d525a2f31aaf161d0 'message digest' \
12 5 c3fcd3d76192e4007dfb496cca67e13b abcdefghijklmnopqrstuvwxyz \
13 6 d174ab98d277d9f5a5611c2c9f419d9f ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 \
14 7 57edf4a22be3c955ac49da2e2107b67a 12345678901234567890123456789012345678901234567890123456789012345678901234567890 \
15 LAST NA NA
17 fail=0
18 while :; do
19 test_name=$1
20 test x$test_name = xLAST && break
21 expected_result="$2 -"
22 string=$3
23 tmp=md-$$
24 tmp_exp=$tmp.exp
25 tmp_out=$tmp.out
26 tmp_files="$tmp_exp $tmp_out"
27 rm -f $tmp_files
28 if test "$VERBOSE" = yes; then
29 #echo "testing \`$nice $args $nice\` = $expected_result ..."
30 echo "test $test_name... " | tr -d '\012'
32 echo "$string"|tr -d '\012'| $md5sum - > $tmp_out
33 echo "$expected_result" > $tmp_exp
34 ${DIFF:-diff} $tmp_out $tmp_exp \
35 && ok=ok || ok=FAIL fail=1
36 test "$VERBOSE" = yes && echo $ok
37 rm -f $tmp_files
38 shift; shift; shift
39 done
41 exit $fail