Add tests on SSML parsing

A corpus of SSML input files will also be needed for fuzzing.
https://github.com/espeak-ng/espeak-ng/issues/407
This commit is contained in:
Sascha Brawer
2018-03-02 11:32:36 +01:00
parent 8c41f6bd0c
commit 7e669f1812
11 changed files with 106 additions and 0 deletions
+1
View File
@@ -100,6 +100,7 @@ tests/*.test
!tests/languages.test
!tests/phoneme-output.test
!tests/phoneme-audio.test
!tests/ssml.test
espeak-ng.pc
+1
View File
@@ -252,6 +252,7 @@ check: tests/encoding.check \
tests/api.check \
tests/phoneme-output.check \
tests/phoneme-audio.check \
tests/ssml.check \
tests/languages.check
##### phoneme data:
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
test_ssml() {
INPUT=$1
echo "testing ${INPUT}"
cp $(dirname $INPUT)/$(basename ${INPUT%.*}).expected expected.txt
ESPEAK_DATA_PATH=`pwd` LD_LIBRARY_PATH=src:${LD_LIBRARY_PATH} \
src/espeak-ng -m -v en-US --ipa=2 -f ${INPUT} > actual.txt
diff expected.txt actual.txt || exit 1
}
for i in `ls tests/ssml/*.ssml` ; do test_ssml $i ; done
+3
View File
@@ -0,0 +1,3 @@
lˈɑːl ænd lˈɑːl nˈa͡ɪn
lˈɑːl
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!-- SSML version of the “Billion laughs” attack
https://en.wikipedia.org/wiki/Billion_laughs_attack
-->
<!DOCTYPE lolz [
<!ENTITY lol "lol">
<!ELEMENT lolz (#PCDATA)>
<!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;">
<!ENTITY lol2 "&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;">
<!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;">
<!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;">
<!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;">
<!ENTITY lol6 "&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;">
<!ENTITY lol7 "&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;">
<!ENTITY lol8 "&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;">
<!ENTITY lol9 "&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;">
]>
<speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis">
lol &lol9; lol
</speak>
+9
View File
@@ -0,0 +1,9 @@
hˈɪɹ ɑː͡ɹ ðə pˈæswɜːdz
ænd ˈɛkszˈiːɾæk
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!-- SSML version of the “XML External Entity” attack
https://en.wikipedia.org/wiki/XML_external_entity_attack
-->
<!DOCTYPE test [
<!ENTITY xxeattack SYSTEM "file:///etc/passwd">
]>
<speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis"
xml:lang="en-US">
<p>Here are the passwords:</p>
<p>&xxeattack;</p>
</speak>
+10
View File
@@ -0,0 +1,10 @@
bˈuːhuː
bˈoːhuː
booˈɔo
bˌooˈoo
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis">
<p xml:lang="en">Boohoo</p>
<p xml:lang="de">Boohoo</p>
<p xml:lang="it">Boohoo</p>
<p xml:lang="es">Boohoo</p>
</speak>
+12
View File
@@ -0,0 +1,12 @@
juː hæv fˈoː͡ɹ nˈuː mˈɛsɪd͡ʒᵻz
ðə fˈɜːst ɪz fɹʌm stˈɛfəni wˈɪljəmz ænd ɚɹˈa͡ɪvd æt
θɹˈiː fˈoː͡ɹɾi fˈa͡ɪv pˌiːˈɛm
ðə sˈʌbd͡ʒɛkt ɪz skˈiː tɹˈɪp
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<!-- Example from SSML 1.1 specification, Appendix E
https://www.w3.org/TR/speech-synthesis11/#AppE
-->
<speak version="1.1"
xmlns="http://www.w3.org/2001/10/synthesis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/10/synthesis
http://www.w3.org/TR/speech-synthesis11/synthesis.xsd"
xml:lang="en-US">
<p>
<s>You have 4 new messages.</s>
<s>The first is from Stephanie Williams and arrived at <break/> 3:45pm.</s>
<s>
The subject is <prosody rate="-20%">ski trip</prosody>
</s>
</p>
</speak>