Browse Source

Merge remote-tracking branch 'twinshadow/test-sha1sum'

master
Reece H. Dunn 7 years ago
parent
commit
d040d90d01
1 changed files with 20 additions and 1 deletions
  1. 20
    1
      tests/languages.test

+ 20
- 1
tests/languages.test View File

#!/bin/sh #!/bin/sh


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

# Test some common commands to find the correct one for the system being tested on.
if check_hashcmd sha1sum; then
sha1sum=sha1sum
elif check_hashcmd sha1; then
sha1sum=sha1
elif check_hashcmd shasum; then
sha1sum=shasum
else
echo "No hashing commands found."
false
fi

test_lang() { test_lang() {
if test "$#" -eq 3; then if test "$#" -eq 3; then
TEST_LANG=$1 TEST_LANG=$1
echo "testing ${TEST_NAME}" echo "testing ${TEST_NAME}"
ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \ ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
src/espeak-ng --stdout -v ${TEST_LANG} "${TEST_TEXT}" | \ src/espeak-ng --stdout -v ${TEST_LANG} "${TEST_TEXT}" | \
sha1sum | awk '{ print $1 }' > actual.txt
$sha1sum | awk '{ print $1 }' > actual.txt
echo "${EXPECTED}" > expected.txt echo "${EXPECTED}" > expected.txt
diff expected.txt actual.txt || exit 1 diff expected.txt actual.txt || exit 1
} }

Loading…
Cancel
Save