summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2015-03-31 14:53:01 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2015-03-31 14:53:01 +0000
commit2dba2220b7ebf24b635c459fe70d5f9af1dadafe (patch)
treeb9561547a51124f1c23db18597327d948ce24bc3 /regress/usr.bin
parent1c93ec3a6d64afc63efc5322afac318c874475e4 (diff)
We need a dumb checksum like the System V one, cksum is too smart.
Since we've removed the obsolete sum versions just use a perl one liner.
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/sort/stests12
1 files changed, 8 insertions, 4 deletions
diff --git a/regress/usr.bin/sort/stests b/regress/usr.bin/sort/stests
index 6c349fcb59b..fa56258c386 100644
--- a/regress/usr.bin/sort/stests
+++ b/regress/usr.bin/sort/stests
@@ -1,5 +1,5 @@
#!/bin/sh -
-# $OpenBSD: stests,v 1.10 2015/03/31 12:49:37 bluhm Exp $
+# $OpenBSD: stests,v 1.11 2015/03/31 14:53:00 millert Exp $
# from: @(#)stests 8.1 (Berkeley) 6/6/93
#Latest version. My sort passes all tests because I wrote it.
@@ -64,12 +64,16 @@ trap "rm -f -- -k in in1 out xx -k xsort linecount fields; exit" 0 1 2 13 15
# "sum" must be dumb; insensitive to the
# order of lines within a file.
-# System V sum is suitable; sum -5 is the v10 equivalent.
+# System V sum is suitable; we use perl's builtin sum support.
PATH=.:$PATH
export PATH
cat <<'!' >xsort; chmod +x xsort
+ sum() {
+ perl -e 'local $/; $sum = unpack("%32W*",<>) % 65535; $total = tell(STDIN); print "$sum $total\n"'
+ }
+
X=$1; shift
if $SORTPROG "$@" in >xx && $SORTPROG -c "$@" xx
@@ -79,7 +83,7 @@ cat <<'!' >xsort; chmod +x xsort
cmp xx out >/dev/null && exit 0
echo $TEST$X comparison failed
else
- test "`cksum <in`" = "`cksum <xx`" && exit 0
+ test "`sum <in`" = "`sum <xx`" && exit 0
echo $TEST$X checksum failed
fi
else
@@ -109,7 +113,7 @@ rm -f out -o
$SORTPROG -c in 2>/dev/null && echo ${TEST}A failed
-xsort B || echo '"cksum"' is probably unsuitable - see comments
+xsort B || echo '"sum"' is probably unsuitable - see comments
$o $SORTPROG +0 in -o in || echo ${TEST}c failed