aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/lib.sh17
-rwxr-xr-xregress/sha16
-rw-r--r--regress/tests.sh4
3 files changed, 18 insertions, 19 deletions
diff --git a/regress/lib.sh b/regress/lib.sh
index b38a729..6c741ce 100644
--- a/regress/lib.sh
+++ b/regress/lib.sh
@@ -159,23 +159,6 @@ check() {
return 1
}
-# usage: sha in out
-# writes the sha256 of `in' to `out'
-sha() {
- if which sha256 >/dev/null 2>&1; then
- sha256 < "$1" > "$2"
- return $?
- fi
-
- if which sha256sum >/dev/null 2>&1; then
- sha256sum "$1" | awk '{print $1}' > "$2"
- return $?
- fi
-
- echo "No sha binary found" >&2
- exit 1
-}
-
count() {
wc -l | xargs
}
diff --git a/regress/sha b/regress/sha
new file mode 100755
index 0000000..02b8eb2
--- /dev/null
+++ b/regress/sha
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# USAGE: ./sha in out
+# writes the sha256 of in to file out
+
+if which sha256 2>/dev/null >/dev/null; then
+ exec sha256 < "$1" > "$2"
+fi
+
+if which sha256sum 2>/dev/null >/dev/null; then
+ sha256sum "$1" | awk '{print $1}' > "$2"
+ exit $?
+fi
+
+echo "No sha binary found"
+exit 1
diff --git a/regress/tests.sh b/regress/tests.sh
index c01013e..ccb7ea7 100644
--- a/regress/tests.sh
+++ b/regress/tests.sh
@@ -38,7 +38,7 @@ test_serve_big_files() {
hdr="$(head /bigfile)"
get /bigfile > bigfile
- sha bigfile bigfile.sha
+ ./sha bigfile bigfile.sha
body="$(cat bigfile.sha)"
check_reply "20 application/octet-stream" "$(cat testdata/bigfile.sha)"
@@ -99,7 +99,7 @@ test_cgi_big_replies() {
hdr="$(head /serve-bigfile)"
get /bigfile > bigfile
- sha bigfile bigfile.sha
+ ./sha bigfile bigfile.sha
body="$(cat bigfile.sha)"
check_reply "20 application/octet-stream" "$(cat testdata/bigfile.sha)"
}