Skip to content

Commit 57d3386

Browse files
committed
[Template merge] regresstest framework tts+anl
1 parent f8552b7 commit 57d3386

6 files changed

Lines changed: 132 additions & 6 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
/tools/analysers/modes
103103
/tools/analysers/pipespec.xml
104104
/tools/analysers/schemas.xml
105+
/tools/analysers/test/regresstest.sh
105106
/tools/grammarcheckers/*-postspell.cg3
106107
/tools/grammarcheckers/*-release.cg3
107108
/tools/grammarcheckers/after-speller-disambiguator.cg3
@@ -155,6 +156,7 @@
155156
/tools/tts/mwe-dis.cg3
156157
/tools/tts/pipespec.xml
157158
/tools/tts/schemas.xml
159+
/tools/tts/test/regresstest.sh
158160
/tools/tts/test/run_tests.sh
159161
Makefile
160162
Makefile.in

m4/giella-config-files.m4

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,26 @@ AC_CONFIG_FILES([Makefile \
6060
tools/tts/test/Makefile])
6161
# Add one AC_CONFIG_FILES for each script file that needs processing. This gives
6262
# the most pleasant user experience and most readable autoconf code to maintain.
63-
# Spell checker tests, all languages:
63+
# IF you need to add language specific scripts, put them in the end of the file
64+
# phonetics tests, all languages
6465
AC_CONFIG_FILES([src/fst/phonetics/tests/run_tests.sh],
6566
[chmod a+x src/fst/phonetics/tests/run_tests.sh])
67+
# analyser tests, all langauges
68+
AC_CONFIG_FILES([tools/analysers/test/regresstest.sh], \
69+
[chmod a+x tools/analysers/test/regresstest.sh])
70+
# tts tests, all langauges
71+
AC_CONFIG_FILES([tools/tts/test/regresstest.sh], \
72+
[chmod a+x tools/tts/test/regresstest.sh])
73+
# Spell checker tests, all languages:
6674
AC_CONFIG_FILES([tools/spellcheckers/test/test-zhfst-file.sh], \
6775
[chmod a+x tools/spellcheckers/test/test-zhfst-file.sh])
6876
AC_CONFIG_FILES([tools/spellcheckers/test/suggestion-quality.sh], \
6977
[chmod a+x tools/spellcheckers/test/suggestion-quality.sh])
7078
AC_CONFIG_FILES([tools/spellcheckers/test/test-zhfst-basic-sugg-speed.sh], \
7179
[chmod a+x tools/spellcheckers/test/test-zhfst-basic-sugg-speed.sh])
80+
# Lemma acceptance test for spellers, all languages:
81+
AC_CONFIG_FILES([tools/spellcheckers/test/accept-all-lemmas.sh], \
82+
[chmod a+x tools/spellcheckers/test/accept-all-lemmas.sh])
7283
# Phonology tests, all languages:
7384
AC_CONFIG_FILES([src/fst/morphology/test/phonology/pair-test-positive.sh], \
7485
[chmod a+x src/fst/morphology/test/phonology/pair-test-positive.sh])
@@ -95,9 +106,6 @@ AC_CONFIG_FILES([src/fst/morphology/test/generate-verb-paradigm.sh], \
95106
# Multichar symbol consistency
96107
AC_CONFIG_FILES([src/fst/morphology/test/missing-multichars.sh], \
97108
[chmod a+x src/fst/morphology/test/missing-multichars.sh])
98-
# Lemma acceptance test for spellers, all languages:
99-
AC_CONFIG_FILES([tools/spellcheckers/test/accept-all-lemmas.sh], \
100-
[chmod a+x tools/spellcheckers/test/accept-all-lemmas.sh])
101109
# Shorthand shell scripts instead of the old-type aliases - all languages:
102110
AC_CONFIG_FILES([tools/shellscripts/urus-gt.sh], \
103111
[chmod a+x tools/shellscripts/urus-gt.sh])
@@ -110,5 +118,5 @@ AC_CONFIG_FILES([devtools/test_voikkospell_suggestions.sh], \
110118
[chmod a+x devtools/test_voikkospell_suggestions.sh])
111119
AC_CONFIG_FILES([devtools/test_grammar_checker.sh], \
112120
[chmod a+x devtools/test_grammar_checker.sh])
113-
121+
# add language specific local tests in the end:
114122
]) # gt_CONFIG_FILES

tools/analysers/test/Makefile.am

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
## Copyright: Sámediggi/Divvun/UiT
33
## Licence: GPL v3+
44

5+
TESTS=
6+
if WANT_ANL_TOOL
7+
TESTS+=
8+
endif
59

10+
XFAIL_TESTS=
611

712
#### Do NOT edit below here: ####
8-
include $(top_srcdir)/../giella-core/am-shared/tools-analysers-dir-include.am
13+
include $(top_srcdir)/../giella-core/am-shared/tools-analysers-test-dir-include.am
914
include $(top_srcdir)/../giella-core/am-shared/devtest-include.am
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
# test script for ensuring that tts pipe output don't change
3+
4+
# change settings here:
5+
corpus=@abs_srcdir@/corpus.txt
6+
gold=@abs_srcdir@/corpus.gold.cg3text
7+
variant=analyser
8+
analyser_dir=@abs_builddir@/../
9+
analyser_archive=$analyser_dir/@GTLANG2@.zpipe
10+
level=tags
11+
threshold=99
12+
13+
# avoid changing common scripts from here:
14+
. "@GIELLA_CORE@/scripts/termcolors.bash"
15+
testscript=@GIELLA_CORE@/scripts/regresstest-pipespec.sh
16+
17+
# ensure this is run from make check and other things
18+
if test -z "$srcdir" ; then
19+
printf "%sfail%s %s needs to run from make check or set srcdir=.\n" \
20+
"$red" "$reset" "$0"
21+
exit 1
22+
fi
23+
if ! test -f "$testscript" ; then
24+
printf "%sskip%s missing tester script from core %s\n" "$light_blue" \
25+
"$reset" "$testscript"
26+
exit 77
27+
fi
28+
if ! test -f "$corpus" ; then
29+
printf "%sskip%s missing test data %s\n" "$light_blue" \
30+
"$reset" "$corpus"
31+
exit 77
32+
fi
33+
if ! test -f "$gold" ; then
34+
printf "%sskip%s missing gold corpus %s\n" "$light_blue" "$reset" "$gold"
35+
echo "you can use divvun-checker to create initial gold data..."
36+
exit 77
37+
fi
38+
if ! test -f "$analyser_archive" ; then
39+
printf "%sskip%s missing pipe archive %s\n" "$light_blue" "$reset" \
40+
"$analyser_archive"
41+
exit 77
42+
fi
43+
44+
"$testscript" "$analyser_archive" "$corpus" "$gold" "$variant" "$level" "$threshold"
45+
rv=$?
46+
if test $rv -eq 77 ; then
47+
printf "%sskip%s\n" "$light_blue" "$reset"
48+
exit 77
49+
elif test $rv -gt 0 ; then
50+
printf "%sfail%s\n" "$red" "$reset"
51+
exit $rv
52+
else
53+
printf "%spass%s\n" "$green" "$reset"
54+
fi

tools/tts/test/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ XFAIL_TESTS=
1919
####### Other targets: ###########
2020
clean-local:
2121
-rm -f *.txt
22+
23+
include $(top_srcdir)/../giella-core/am-shared/tools-tts-test-dir-include.am
2224
include $(top_srcdir)/../giella-core/am-shared/devtest-include.am

tools/tts/test/regresstest.sh.in

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
# test script for ensuring that tts pipe output don't change
3+
4+
# change settings here:
5+
corpus=@abs_srcdir@/corpus.txt
6+
gold=@abs_srcdir@/corpus.gold.cg3text
7+
variant=sme-normaliser
8+
tts_dir=@abs_builddir@/../
9+
tts_archive=$tts_dir/@GTLANG2@-tts.zpipe
10+
level=suffixed # we only care about "phon
11+
threshold=99
12+
13+
# avoid changing common scripts from here:
14+
. "@GIELLA_CORE@/scripts/termcolors.bash"
15+
testscript=@GIELLA_CORE@/scripts/regresstest-pipespec.sh
16+
17+
# ensure this is run from make check and other things
18+
if test -z "$srcdir" ; then
19+
printf "%sfail%s %s needs to run from make check or set srcdir=.\n" \
20+
"$red" "$reset" "$0"
21+
exit 1
22+
fi
23+
if ! test -f "$testscript" ; then
24+
printf "%sskip%s missing tester script from core %s\n" "$light_blue" \
25+
"$reset" "$testscript"
26+
exit 77
27+
fi
28+
if ! test -f "$corpus" ; then
29+
printf "%sskip%s missing test data %s\n" "$light_blue" \
30+
"$reset" "$corpus"
31+
exit 77
32+
fi
33+
if ! test -f "$gold" ; then
34+
printf "%sskip%s missing gold corpus %s\n" "$light_blue" "$reset"\
35+
"$gold"
36+
echo "you can use divvun-checker to create initial gold data..."
37+
exit 1
38+
fi
39+
if ! test -f "$tts_archive" ; then
40+
printf "%sskip%s missing pipe archive %s\n" "$light_blue" "$reset" \
41+
"$tts_archive"
42+
exit 77
43+
fi
44+
45+
"$testscript" "$tts_archive" "$corpus" "$gold" "$variant" "$level" "$threshold"
46+
rv=$?
47+
if test $rv -eq 77 ; then
48+
printf "%sskip%s\n" "$light_blue" "$reset"
49+
exit 77
50+
elif test $rv -gt 0 ; then
51+
printf "%sfail%s\n" "$red" "$reset"
52+
exit $rv
53+
else
54+
printf "%spass%s\n" "$green" "$reset"
55+
fi

0 commit comments

Comments
 (0)