Commit Diff


commit - 364f10dbcd3b053730a4ad47042e0d8222aada47
commit + b3927be446193f54dde95d62852ce6757c75189b
blob - ab85561e6a1789ed01c3beda25db1a6868c322fc
blob + f7eda8aad700e666d9c51b9f5c8ec48e7e970c78
--- test/test.sh
+++ test/test.sh
@@ -12,7 +12,7 @@ get() {
 
 # check "path" "expected-sha256"
 check() {
-	got=`get "$1" | sha256`
+	got=`get "$1" | $sha | awk '{print \$1}'`
 	if [ "$got" '!=' "$2" ]; then
 		echo "FAIL $1 (with_cgi: $with_cgi)"
 		quit
@@ -26,6 +26,16 @@ quit() {
 	exit ${1:-1}
 }
 
+# check for sha256sum (linux) or sha256 (OpenBSD)
+if which sha256sum >/dev/null; then
+	sha=sha256sum
+elif which sha256 >/dev/null; then
+	sha=sha256
+else
+	echo "No sha256/sha256sum binary available"
+	exit 1
+fi
+
 with_cgi="no"
 ./../gmid -c no-cgi.conf 2>/dev/null &