aboutsummaryrefslogtreecommitdiff
path: root/testsuite/md5sum.tests
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-10-16 21:26:47 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-10-16 21:26:47 +0200
commite8ee86250d78b7a9c59699aca597f392c1593225 (patch)
tree16e3bb1de014ee57bfcc8f1226c98e8f1180a99c /testsuite/md5sum.tests
parentbcccad35318004922cc04487e1df4eade4545966 (diff)
downloadbusybox-w32-e8ee86250d78b7a9c59699aca597f392c1593225.tar.gz
busybox-w32-e8ee86250d78b7a9c59699aca597f392c1593225.tar.bz2
busybox-w32-e8ee86250d78b7a9c59699aca597f392c1593225.zip
testsuite: add tests for {ms5,shaN}sum
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite/md5sum.tests')
-rwxr-xr-xtestsuite/md5sum.tests46
1 files changed, 46 insertions, 0 deletions
diff --git a/testsuite/md5sum.tests b/testsuite/md5sum.tests
new file mode 100755
index 000000000..5bbdb3b58
--- /dev/null
+++ b/testsuite/md5sum.tests
@@ -0,0 +1,46 @@
1#!/bin/sh
2# Used by {ms5,shaN}sum
3
4# We pipe texts 0...999 bytes long, {md5,shaN}sum them,
5# then {md5,shaN}sum the resulting list.
6# Then we compare the result with expected result.
7#
8# Here are the expected results:
9# efe30c482e0b687e0cca0612f42ca29b
10# d41337e834377140ae7f98460d71d908598ef04f
11# 8e1d3ed57ebc130f0f72508446559eeae06451ae6d61b1e8ce46370cfb8963c3
12# fe413e0f177324d1353893ca0772ceba83fd41512ba63895a0eebb703ef9feac2fb4e92b2cb430b3bda41b46b0cb4ea8307190a5cc795157cfb680a9cd635d0f
13
14if ! test "$1"; then
15 set -- md5sum efe30c482e0b687e0cca0612f42ca29b
16fi
17
18sum="$1"
19expected="$2"
20
21mkdir testdir 2>/dev/null
22
23result=`(
24cd testdir || { echo "cannot cd testdir!" >&2; exit 1; }
25
26text="The quick brown fox jumps over the lazy dog"
27
28n=0
29while test $n -le 999; do
30 yes "$text" | head -c $n | "$sum"
31 : $((n++))
32done | "$sum"
33
34)`
35
36rm -rf testdir
37
38FAILCOUNT=0
39
40if test x"$result" = x"$expected -"; then
41 echo "PASS: $sum"
42 exit 0
43fi
44
45echo "FAIL: $sum (r:$result exp:$expected)"
46exit 1