Browse Source

tests: use autoconf-style output when checking for the sha1 command.

master
Reece H. Dunn 7 years ago
parent
commit
e05b478f22
2 changed files with 6 additions and 4 deletions
  1. 3
    2
      tests/languages.test
  2. 3
    2
      tests/phoneme-audio.test

+ 3
- 2
tests/languages.test View File



# Test a command for presence and ability to output the sha1 hash of a file. # Test a command for presence and ability to output the sha1 hash of a file.
check_hashcmd() { check_hashcmd() {
which $1 &>/dev/null &&
which $1 &&
$1 </dev/null 2>/dev/null | $1 </dev/null 2>/dev/null |
awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}'
} }


# Test some common commands to find the correct one for the system being tested on. # 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 if check_hashcmd sha1sum; then
sha1sum=sha1sum sha1sum=sha1sum
elif check_hashcmd sha1; then elif check_hashcmd sha1; then
elif check_hashcmd shasum; then elif check_hashcmd shasum; then
sha1sum=shasum sha1sum=shasum
else else
echo "No hashing commands found."
echo "no"
exit 1 exit 1
fi fi



+ 3
- 2
tests/phoneme-audio.test View File



# Test a command for presence and ability to output the sha1 hash of a file. # Test a command for presence and ability to output the sha1 hash of a file.
check_hashcmd() { check_hashcmd() {
which $1 &>/dev/null &&
which $1 &&
$1 </dev/null 2>/dev/null | $1 </dev/null 2>/dev/null |
awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}' awk '{if ($1 != "da39a3ee5e6b4b0d3255bfef95601890afd80709") { exit 1; }}'
} }


# Test some common commands to find the correct one for the system being tested on. # 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 if check_hashcmd sha1sum; then
sha1sum=sha1sum sha1sum=sha1sum
elif check_hashcmd sha1; then elif check_hashcmd sha1; then
elif check_hashcmd shasum; then elif check_hashcmd shasum; then
sha1sum=shasum sha1sum=shasum
else else
echo "No hashing commands found."
echo "no"
exit 1 exit 1
fi fi



Loading…
Cancel
Save