From e05b478f22939b7fe1d81ce3f1870c50a54d30a8 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Tue, 6 Mar 2018 07:19:43 +0000 Subject: [PATCH] tests: use autoconf-style output when checking for the sha1 command. --- tests/languages.test | 5 +++-- tests/phoneme-audio.test | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/languages.test b/tests/languages.test index eba2b00e..b950ca0e 100755 --- a/tests/languages.test +++ b/tests/languages.test @@ -2,12 +2,13 @@ # Test a command for presence and ability to output the sha1 hash of a file. check_hashcmd() { - which $1 &>/dev/null && + which $1 && $1 /dev/null | awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' } # Test some common commands to find the correct one for the system being tested on. +echo -n "checking for SHA1 hashing command ... " if check_hashcmd sha1sum; then sha1sum=sha1sum elif check_hashcmd sha1; then @@ -15,7 +16,7 @@ elif check_hashcmd sha1; then elif check_hashcmd shasum; then sha1sum=shasum else - echo "No hashing commands found." + echo "no" exit 1 fi diff --git a/tests/phoneme-audio.test b/tests/phoneme-audio.test index c5291de7..e58709fb 100755 --- a/tests/phoneme-audio.test +++ b/tests/phoneme-audio.test @@ -2,12 +2,13 @@ # Test a command for presence and ability to output the sha1 hash of a file. check_hashcmd() { - which $1 &>/dev/null && + which $1 && $1 /dev/null | awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' } # Test some common commands to find the correct one for the system being tested on. +echo -n "checking for SHA1 hashing command ... " if check_hashcmd sha1sum; then sha1sum=sha1sum elif check_hashcmd sha1; then @@ -15,7 +16,7 @@ elif check_hashcmd sha1; then elif check_hashcmd shasum; then sha1sum=shasum else - echo "No hashing commands found." + echo "no" exit 1 fi