Skip to content

Commit

Permalink
pass the totals file between scripts
Browse files Browse the repository at this point in the history
fixes #51
  • Loading branch information
flammie committed Jun 22, 2024
1 parent aa95922 commit ac0ca76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
11 changes: 9 additions & 2 deletions scripts/run-morph-tester.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if ! test $# -ge 7 ; then
echo " tested. Possible values are 'all' and 'specified'."
echo " SRCDIR srcdir from automake"
echo " TOOLKIT hfst or xfst or such"
echo " TOTALFILE will contain test totals, if empty mktemp"
echo " LEADTEXT is typically the number of the test in a test set loop."
echo
echo "LEADTEXT can contain spaces, it is effectively everything after the"
Expand All @@ -52,7 +53,11 @@ fsttest=$5
srcdir=$6
tk=$7
shift 7
leadtext="$@"
if test -f $1 ; then
testtotalsfile=$1
shift
fi
leadtext="$*"

testfileshort=$(echo "$(basename \
$(dirname $testfile))/$(basename $testfile)")
Expand All @@ -72,7 +77,9 @@ generatorfile=$fstdir/generator-$transducer
bare_fst_file=$fstdir/$transducer
pythonbin=@PYTHON@
runtests="$pythonbin $relpath/morph-test.py"
testtotalsfile=$(mktemp -t giella-yaml_test.XXXXXXXXXXX)
if test -z "$testtotalsfile" ; then
testtotalsfile=$(mktemp -t giella-yaml_test.XXXXXXXXXXX)
fi

# Use autotools mechanisms to only run the configured fst types in the tests:
fsttype=$tk
Expand Down
12 changes: 7 additions & 5 deletions scripts/run-yaml-testcases.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ for file in $testfiles; do
(( i += 1 ))
leadtext="YAML test $i: "
"$relpath/run-morph-tester.sh" \
"$transducer" "$file" "$relpath" "$halftest" "all" "$srcdir" "$tk" "$leadtext"
"$transducer" "$file" "$relpath" "$halftest" "all" "$srcdir" "$tk" \
"$testtotalsfile" "$leadtext"
rv=$?
if test $rv = 77 ; then
exit 77
Expand Down Expand Up @@ -179,7 +180,8 @@ for file in ${filepattern[@]}; do
(( i += 1 ))
leadtext="YAML test $i: "
"$relpath/run-morph-tester.sh" \
"$transducer" "$file" "$relpath" "$halftest" specified "$srcdir" "$tk" "$leadtext"
"$transducer" "$file" "$relpath" "$halftest" specified "$srcdir"\
"$tk" "$testtotalsfile" "$leadtext"
rv=$?
if test $rv = 77 ; then
exit 77
Expand All @@ -189,11 +191,11 @@ for file in ${filepattern[@]}; do
done

totalpasses=$( cat "$testtotalsfile" | tr ' ' '\n' | cut -d'/' -f1 \
| tr '\n' ' ' | sed 's/ / + /g' | sed 's/ + $//' | bc )
| tr '\n' ' ' | sed 's/ / + /g' | sed 's/ + $/\n/' | bc )
totalfails=$( cat "$testtotalsfile" | tr ' ' '\n' | cut -d'/' -f2 \
| tr '\n' ' ' | sed 's/ / + /g' | sed 's/ + $//' | bc )
| tr '\n' ' ' | sed 's/ / + /g' | sed 's/ + $/\n/' | bc )
totaltotals=$( cat "$testtotalsfile" | tr ' ' '\n' | cut -d'/' -f3 \
| tr '\n' ' ' | sed 's/ / + /g' | sed 's/ + $//' | bc )
| tr '\n' ' ' | sed 's/ / + /g' | sed 's/ + $/\n/' | bc )

red="\033[1;31m"
green="\033[0;32m"
Expand Down

0 comments on commit ac0ca76

Please sign in to comment.