Skip to content

Commit 57881a0

Browse files
committed
divvun-runtime version of pipeline testing
1 parent 38689c8 commit 57881a0

3 files changed

Lines changed: 93 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
/scripts/run-yaml-testcases.sh
2121
/scripts/missing-multichars.sh
2222
/scripts/regresstest-pipespec.sh
23+
/scripts/regresstest-pipeline.sh
2324
/scripts/difftest-pipeline.sh
2425
Makefile
2526
Makefile.in

configure.ac

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
## You should have received a copy of the GNU General Public License
1616
## along with this program. If not, see <http://www.gnu.org/licenses/>.
17-
AC_INIT([giella-core], [1.11.0], [feedback@divvun.no], [giella-core], [https://github.com/giellalt/giella-core])
17+
AC_INIT([giella-core], [1.11.1], [feedback@divvun.no], [giella-core], [https://github.com/giellalt/giella-core])
1818
AC_REVISION([$Revision$])
1919
AC_CONFIG_AUX_DIR([build-aux])
2020
AM_INIT_AUTOMAKE([1.9 tar-pax -Wall -Werror foreign])
@@ -172,6 +172,8 @@ AC_CONFIG_FILES([scripts/missing-multichars.sh],
172172
[chmod +x scripts/missing-multichars.sh])
173173
AC_CONFIG_FILES([scripts/regresstest-pipespec.sh],
174174
[chmod +x scripts/regresstest-pipespec.sh])
175+
AC_CONFIG_FILES([scripts/regresstest-pipeline.sh],
176+
[chmod +x scripts/regresstest-pipeline.sh])
175177
AC_CONFIG_FILES([scripts/difftest-pipeline.sh],
176178
[chmod +x scripts/difftest-pipeline.sh])
177179
AC_CONFIG_FILES([scripts/simpler-yaml-runner.sh],

scripts/regresstest-pipeline.sh.in

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/bash
2+
# @configure_input@
3+
4+
# Test that running pipeline from bundle has same results as gold standard
5+
# (from previous runs)
6+
7+
if ! test $# -ge 4 ; then
8+
echo
9+
echo "Usage: $0 ARCHIVE TESTFILE GOLD VARIANT [LEVEL [THRESHOLD]]"
10+
echo
11+
echo "were:"
12+
echo " ARCHIVE is the .drb/.ts file"
13+
echo " TESTFILE is input text"
14+
echo " GOLD is expected output"
15+
echo " VARIANT is the variant in the pipeline"
16+
echo " LEVEL is the things to match: tags, lemmas, suffixed, all"
17+
echo " THRESHOLD is needed recall %"
18+
echo
19+
echo "LEVEL defaults to maintags if not given"
20+
echo "THRESHOLD defaults to 99 % if not given"
21+
exit 77
22+
fi
23+
24+
ANSIFILTER="@ANSIFILTER@"
25+
runner="@DIVVUN_RUNTIME@"
26+
python="@PYTHON@"
27+
comparator="@GIELLA_CORE@/scripts/vislcg-compare.py"
28+
archive=$1
29+
testfile=$2
30+
goldfile=$3
31+
variant=$4
32+
level=tags
33+
threshold=99
34+
if test $# -ge 5 ; then
35+
level=$5
36+
fi
37+
if test $# -ge 6 ; then
38+
threshold=$6
39+
fi
40+
41+
42+
. "@GIELLA_CORE@/scripts/termcolors.bash"
43+
44+
if ! test -f $comparator ; then
45+
printf "%sskip%s missing comparation script %s" "$light_blue" "$reset" \
46+
"$comparator"
47+
fi
48+
if ! test -f $runner ; then
49+
printf "%sskip%s missing pipespec runner from libdivvun" \
50+
"$light_blue" "$reset"
51+
exit 77
52+
fi
53+
if ! test -f $archive ; then
54+
printf "%sskip%s missing pipespec archive %s\n" "$light_blue" "$reset" \
55+
"$archive"
56+
exit 77
57+
fi
58+
if ! test -f $testfile ; then
59+
printf "%sskip%s missing test data %s\n" "$light_blue" "$reset" \
60+
"$testfile"
61+
exit 77
62+
fi
63+
if ! test -f $goldfile ; then
64+
printf "%sskip%s missing gold data %s\n" "$light_blue" "$reset" \
65+
"$goldfile"
66+
echo "hint: $runner -a $archive -n $variant < $testfile > $goldfile"
67+
exit 77
68+
fi
69+
70+
outfile=$(mktemp -t giella-pipe-test.XXXXXXXXXXX)
71+
72+
$runner run -p "$archive" -P "$variant" < "$testfile" | $ANSIFILTER > "$outfile"
73+
rv=$?
74+
if test $rv -gt 0 ; then
75+
printf "%sfail%s running $runner failed (see above?)\n" "$red" "$reset"
76+
exit $rv
77+
fi
78+
if cmp "$goldfile" "$outfile" > /dev/null ; then
79+
printf "%spass%s - exact match\n" "$green" "$reset"
80+
elif ! $python $comparator -r "$goldfile" -H "$outfile" \
81+
-t "$threshold" -L "$level" ; then
82+
printf "%sfail%s - outputs differ too muchly:\n" "$red" "$reset"
83+
diff -u "$goldfile" "$outfile"
84+
exit 1
85+
else
86+
printf "%spass%s - small regressions:\n" "$green" "$reset"
87+
diff -u "$goldfile" "$outfile"
88+
exit 0
89+
fi

0 commit comments

Comments
 (0)