Browse Source

Add test for MBROLA voice

master
Valdis Vitolins 5 years ago
parent
commit
3660a44bdc
3 changed files with 65 additions and 0 deletions
  1. 1
    0
      .gitignore
  2. 1
    0
      Makefile.am
  3. 63
    0
      tests/mbrola.test

+ 1
- 0
.gitignore View File

@@ -111,6 +111,7 @@ tests/*.check
!tests/translate.test
!tests/non-executable-files-with-executable-bit.test
!tests/bom.test
!tests/mbrola.test

espeak-ng.pc


+ 1
- 0
Makefile.am View File

@@ -257,6 +257,7 @@ check: tests/encoding.check \
tests/language-numbers-cardinal.check \
tests/language-numbers-ordinal.check \
tests/non-executable-files-with-executable-bit.check \
tests/mbrola.check \
tests/bom.check

##### fuzzer:

+ 63
- 0
tests/mbrola.test View File

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

check_voice_folder() {
voice_file=${1#mb-}
if [ -f "/usr/share/mbrola/$voice_file" ]; then
voice_file="/usr/share/mbrola/$voice_file"
elif [ -f "/usr/share/mbrola/$voice_file/$voice_file" ]; then
voice_file="/usr/share/mbrola/$voice_file/$voice_file"
elif [ -f "/usr/share/mbrola/voices/$voice_file" ]; then
voice_file="/usr/share/mbrola/voices/$voice_file"
else
voice_file=""
fi
}

test_voice () {
MBVOICE=$1
EXPECTED=$2
TEST_TEXT=$3
check_voice_folder $MBVOICE
if [ "$voice_file" != "" ]; then
echo "testing ${MBVOICE} ${TEST_TEXT} ... "
ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
src/espeak-ng --stdout -v ${MBVOICE} "${TEST_TEXT}" | \
$sha1sum | awk '{ print $1 }' > actual.txt
echo "${EXPECTED}" > expected.txt
diff expected.txt actual.txt || exit 1
else
echo "$MBVOICE was not tested"
fi
}

# 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
sha1sum=sha1
elif check_hashcmd shasum; then
sha1sum=shasum
else
echo "no"
exit 1
fi


echo -n "checking if MBROLA is installed ... "
if [ "`which mbrola`" != "" ]; then
echo "yes"
else
echo "no"
exit 1
fi

test_voice mb-fr4 31fae066f45d4a9dc56289344f28dd00bce77875 "Bonjour"



Loading…
Cancel
Save