Files
espeak-ng/tests/mbrola.test
T

42 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# include common script
. "`dirname $0`/common"
# and run needed checks before
is_hash
is_mbrola
check_voice_folder() {
voice_file=${1#mb-} # remove mb- prefix
voice_file=${voice_file%+*} # remove variant suffix
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_voice mb-fr4 31fae066f45d4a9dc56289344f28dd00bce77875 "Bonjour"
test_voice mb-fr4+announcer f62c9cad15df194ac7cedfcfb36b6d9ccc70a634 "Bonjour" # mbrola + variant