From f6e65a299e1ade535902859f2c2b22ba9ec47689 Mon Sep 17 00:00:00 2001 From: Flammie A Pirinen Date: Mon, 10 Jun 2024 14:34:49 +0200 Subject: [PATCH] [Template merge] move yaml and morph testers to core --- m4/giella-macros.m4 | 5 +- src/fst/morphology/test/tag_test.sh | 4 +- src/fst/orthography/test/Makefile.am | 20 ++----- .../test/run-initcaps-genyaml-testcases.sh | 33 +++++++++-- src/fst/test/Makefile.am | 22 +++++--- .../run-dict-gt-desc-anayaml-testcases.sh | 34 +++++++++-- .../run-dict-gt-norm-genyaml-testcases.sh | 33 +++++++++-- src/fst/test/run-gt-desc-anayaml-testcases.sh | 33 +++++++++-- src/fst/test/run-gt-desc-genyaml-testcases.sh | 33 +++++++++-- src/fst/test/run-gt-desc-yaml-testcases.sh | 33 +++++++++-- src/fst/test/run-gt-norm-anayaml-testcases.sh | 33 +++++++++-- src/fst/test/run-gt-norm-genyaml-testcases.sh | 34 +++++++++-- src/fst/test/run-gt-norm-yaml-testcases.sh | 33 +++++++++-- src/fst/test/run-lexc-testcases.sh | 56 ++++++++++++++----- test/run-morph-tester.sh.in | 4 ++ test/run-yaml-testcases.sh.in | 4 ++ tools/mt/apertium/test/Makefile.am | 15 +++-- .../test/run-mt-gt-desc-anayaml-testcases.sh | 42 +++++++++++--- tools/spellcheckers/test/Makefile.am | 23 +++----- tools/spellcheckers/test/fstbased/Makefile.am | 3 + .../test/fstbased/desktop/hfst/Makefile.am | 7 +-- .../hfst/run-acceptor-yaml-testcases.sh | 28 +++++++++- .../run-fstspeller-gt-norm-yaml-testcases.sh | 30 +++++++++- .../run-spellers-gt-norm-yaml-testcases.sh | 33 +++++++++-- 24 files changed, 476 insertions(+), 119 deletions(-) diff --git a/m4/giella-macros.m4 b/m4/giella-macros.m4 index 4cec2dba8..a1609d633 100644 --- a/m4/giella-macros.m4 +++ b/m4/giella-macros.m4 @@ -88,7 +88,7 @@ AC_MSG_RESULT([$GIELLA_CORE]) ############################################################### ### This is the version of the Giella Core that we require. ### ### UPDATE AS NEEDED. -_giella_core_min_version=0.23.0 +_giella_core_min_version=1.0.0 # GIELLA_CORE/GTCORE env. variable, required by the infrastructure to find scripts: AC_ARG_VAR([GIELLA_CORE], [directory for the Giella infra core scripts and other required resources]) @@ -998,6 +998,9 @@ To build, test and install: make make check make install +The developers’ version of the test suite is available under: + make devtest +this version does not halt on errors and should be useful when fixing bugs EOF AS_IF([test x$gt_prog_xslt = xno -a \ "$(find ${srcdir}/src/fst/morphology/stems -name "*.xml" | head -n 1)" != "" ], diff --git a/src/fst/morphology/test/tag_test.sh b/src/fst/morphology/test/tag_test.sh index 79a95eb0e..b5440f3d5 100755 --- a/src/fst/morphology/test/tag_test.sh +++ b/src/fst/morphology/test/tag_test.sh @@ -21,7 +21,7 @@ fi # Extract USED tags: sed -e '1,/LEXICON Root/d' < \ - ../../../src/fst/lexicon.tmp.lexc | # Extract all lines after LEXICON Root + ../lexicon.tmp.lexc | # Extract all lines after LEXICON Root ${giella_core}/scripts/extract-used-tags.sh | # Extract tags, local mods after this line: grep -v '\+konto' | # Remove tag like entries found only in FAO LC_ALL=no_NO.UTF8 sort -u \ @@ -29,7 +29,7 @@ sed -e '1,/LEXICON Root/d' < \ # Extract DEFINED tags: sed -n '/LEXICON Root/q;p' \ - ../../../src/fst/lexicon.tmp.lexc | # Extract all lines before LEXICON Root + ../lexicon.lexc | # Extract all lines before LEXICON Root ${giella_core}/scripts/extract-defined-tags.sh | # Extract tags, local mods after this line: LC_ALL=no_NO.UTF8 sort -u \ > "${roottags}" diff --git a/src/fst/orthography/test/Makefile.am b/src/fst/orthography/test/Makefile.am index 556ed9566..380e0fbc1 100644 --- a/src/fst/orthography/test/Makefile.am +++ b/src/fst/orthography/test/Makefile.am @@ -2,14 +2,14 @@ ## Copyright: Sámediggi/Divvun/UiT ## Licence: GPL v3+ -######## Test targets: ########### +######## Local test targets: ########### # List here (space separated) all test scripts that should be run # _unconditionally_: TESTS= -# Yaml tests are run from shell scripts - specify them here: -YAML_TEST_RUNNERS=run-initcaps-genyaml-testcases.sh +# Add local yaml tests here +YAML_TEST_RUNNERS= # Specify other shell scripts here to make sure they are included in the distro # even though spellers are disabled: OTHER_TEST_RUNNERS= @@ -17,23 +17,13 @@ OTHER_TEST_RUNNERS= if CAN_YAML_TEST # Add your shell scripts for running python-based tests below here, so that # they are only run if the preconditions for yaml tests are met. -TESTS+=$(YAML_TEST_RUNNERS) +TESTS+= endif # CAN_YAML_TEST # List tests that are presently (expected) failures here, ie things that should # be fixed *later*, but is not critical at the moment: XFAIL_TESTS= -# Make sure all required files are included in the distribution: -YAML_FILES=$(wildcard *.yaml) -YAML_DIRS= -EXTRA_DIST=$(OTHER_TEST_RUNNERS) \ - $(YAML_TEST_RUNNERS) \ - $(YAML_FILES) \ - $(YAML_DIRS) - -####### Other targets: ########### -clean-local: - -rm -f *.txt +include $(top_srcdir)/../giella-core/am-shared/src-fst-orthography-test-include.am include $(top_srcdir)/../giella-core/am-shared/devtest-include.am diff --git a/src/fst/orthography/test/run-initcaps-genyaml-testcases.sh b/src/fst/orthography/test/run-initcaps-genyaml-testcases.sh index 356847b82..d3f7579a9 100755 --- a/src/fst/orthography/test/run-initcaps-genyaml-testcases.sh +++ b/src/fst/orthography/test/run-initcaps-genyaml-testcases.sh @@ -4,6 +4,25 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=inituppercase @@ -19,7 +38,13 @@ halftest=gen # same dir as this script: yaml_file_subdir=. -####### Include/source helper script from dir above - DO NOT CHANGE: ######## -# Relative path from test script to test runner: -testrunner="../../../../test/run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir ../../../../test/ $halftest +####### Run the helper script from giella core - DO NOT CHANGE: ######## +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/src/fst/test/Makefile.am b/src/fst/test/Makefile.am index da506ae81..c6cf022d1 100644 --- a/src/fst/test/Makefile.am +++ b/src/fst/test/Makefile.am @@ -2,12 +2,17 @@ ## Copyright: Sámediggi/Divvun/UiT ## Licence: GPL v3+ -######## Test targets: ########### +######## Local test targets: ########### -# List here (space separated) all test scripts that should be run -# _unconditionally_: +# Add local tests here that will be run always TESTS= +# Add local yaml testers here: +YAML_TEST_RUNNERS= + +# Add other local tests here: +OTHER_TEST_RUNNERS= + if CAN_YAML_TEST # Add your shell scripts for running python-based tests below here, so that # they are only run if the preconditions for yaml tests are met. @@ -16,12 +21,11 @@ if CAN_YAML_TEST if WANT_MORPHOLOGY TESTS+=run-gt-norm-anayaml-testcases.sh \ run-gt-desc-anayaml-testcases.sh - # This is for yaml tests requiring BOTH an analyser AND a generator: if WANT_GENERATION TESTS+=run-gt-norm-yaml-testcases.sh \ - run-gt-desc-yaml-testcases.sh \ - run-lexc-testcases.sh + run-gt-desc-yaml-testcases.sh + endif # WANT_GENERATION endif # WANT_MORPHOLOGY @@ -50,7 +54,9 @@ XFAIL_TESTS=run-dict-gt-desc-anayaml-testcases.sh \ run-gt-norm-yaml-testcases.sh \ run-lexc-testcases.sh + + ####### Other targets: ########### -clean-local: - -rm -f *.txt + +include $(top_srcdir)/../giella-core/am-shared/src-fst-test-include.am include $(top_srcdir)/../giella-core/am-shared/devtest-include.am diff --git a/src/fst/test/run-dict-gt-desc-anayaml-testcases.sh b/src/fst/test/run-dict-gt-desc-anayaml-testcases.sh index 5ecee1305..91981b594 100755 --- a/src/fst/test/run-dict-gt-desc-anayaml-testcases.sh +++ b/src/fst/test/run-dict-gt-desc-anayaml-testcases.sh @@ -4,6 +4,26 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. + +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=dict-gt-desc @@ -18,7 +38,13 @@ halftest=ana # same dir as this script: yaml_file_subdir=dict-gt-yamls -####### Include/source helper script from dir above - DO NOT CHANGE: ######## -# Relative path from test script to test runner: -testrunner="../../../test/run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir ../../../test $halftest +####### Run the helper script from giella core - DO NOT CHANGE: ######## +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/src/fst/test/run-dict-gt-norm-genyaml-testcases.sh b/src/fst/test/run-dict-gt-norm-genyaml-testcases.sh index eb23624ad..d8b5073ed 100755 --- a/src/fst/test/run-dict-gt-norm-genyaml-testcases.sh +++ b/src/fst/test/run-dict-gt-norm-genyaml-testcases.sh @@ -4,6 +4,25 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=dict-gt-norm @@ -18,7 +37,13 @@ halftest=gen # same dir as this script: yaml_file_subdir=dict-gt-yamls -####### Include/source helper script from dir above - DO NOT CHANGE: ######## -# Relative path from test script to test runner: -testrunner="../../../test/run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir ../../../test/ $halftest +####### Run the helper script from giella core - DO NOT CHANGE: ######## +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/src/fst/test/run-gt-desc-anayaml-testcases.sh b/src/fst/test/run-gt-desc-anayaml-testcases.sh index c3a31c3e2..335ce1962 100755 --- a/src/fst/test/run-gt-desc-anayaml-testcases.sh +++ b/src/fst/test/run-gt-desc-anayaml-testcases.sh @@ -4,6 +4,25 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=gt-desc @@ -18,7 +37,13 @@ halftest=ana # same dir as this script: yaml_file_subdir=gt-desc-yamls -####### Include/source helper script from dir above - DO NOT CHANGE: ######## -# Relative path from test script to test runner: -testrunner="../../../test/run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir ../../../test $halftest +####### Run the test script from giella-core - DO NOT CHANGE: ######## +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/src/fst/test/run-gt-desc-genyaml-testcases.sh b/src/fst/test/run-gt-desc-genyaml-testcases.sh index 799efb1a0..59c5c5ffb 100755 --- a/src/fst/test/run-gt-desc-genyaml-testcases.sh +++ b/src/fst/test/run-gt-desc-genyaml-testcases.sh @@ -4,6 +4,25 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=gt-desc @@ -18,7 +37,13 @@ halftest=gen # same dir as this script: yaml_file_subdir=gt-desc-yamls -####### Include/source helper script from dir above - DO NOT CHANGE: ######## -# Relative path from test script to test runner: -testrunner="../../../test/run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir ../../../test $halftest +####### Run the test script from giella-core - DO NOT CHANGE: ######## +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/src/fst/test/run-gt-desc-yaml-testcases.sh b/src/fst/test/run-gt-desc-yaml-testcases.sh index f2a9d9df2..7d5d1b7a2 100755 --- a/src/fst/test/run-gt-desc-yaml-testcases.sh +++ b/src/fst/test/run-gt-desc-yaml-testcases.sh @@ -4,6 +4,25 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=gt-desc @@ -18,7 +37,13 @@ halftest= # same dir as this script: yaml_file_subdir=gt-desc-yamls -####### Include/source helper script from dir above - DO NOT CHANGE: ######## -# Relative path from test script to test runner: -testrunner="../../../test/run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir ../../../test $halftest +####### Run the test script from giella-core - DO NOT CHANGE: ######## +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/src/fst/test/run-gt-norm-anayaml-testcases.sh b/src/fst/test/run-gt-norm-anayaml-testcases.sh index ffedb4005..f6bbfbe80 100755 --- a/src/fst/test/run-gt-norm-anayaml-testcases.sh +++ b/src/fst/test/run-gt-norm-anayaml-testcases.sh @@ -4,6 +4,25 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=gt-norm @@ -18,7 +37,13 @@ halftest=ana # same dir as this script: yaml_file_subdir=gt-norm-yamls -####### Include/source helper script from dir above - DO NOT CHANGE: ######## -# Relative path from test script to test runner: -testrunner="../../../test/run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir ../../../test $halftest +####### Run the test script from giella-core - DO NOT CHANGE: ######## +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/src/fst/test/run-gt-norm-genyaml-testcases.sh b/src/fst/test/run-gt-norm-genyaml-testcases.sh index d44222e0a..d35e45255 100755 --- a/src/fst/test/run-gt-norm-genyaml-testcases.sh +++ b/src/fst/test/run-gt-norm-genyaml-testcases.sh @@ -4,6 +4,26 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=gt-norm @@ -18,7 +38,13 @@ halftest=gen # same dir as this script: yaml_file_subdir=gt-norm-yamls -####### Include/source helper script from dir above - DO NOT CHANGE: ######## -# Relative path from test script to test runner: -testrunner="../../../test/run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir ../../../test $halftest +####### Run the helper script from giella core - DO NOT CHANGE: ######## +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/src/fst/test/run-gt-norm-yaml-testcases.sh b/src/fst/test/run-gt-norm-yaml-testcases.sh index 3bb20e8b1..54901474a 100755 --- a/src/fst/test/run-gt-norm-yaml-testcases.sh +++ b/src/fst/test/run-gt-norm-yaml-testcases.sh @@ -4,6 +4,25 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=gt-norm @@ -18,7 +37,13 @@ halftest= # same dir as this script: yaml_file_subdir=gt-norm-yamls -####### Include/source helper script from dir above - DO NOT CHANGE: ######## -# Relative path from test script to test runner: -testrunner="../../../test/run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir ../../../test $halftest +####### Run the test script from giella-core - DO NOT CHANGE: ######## +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/src/fst/test/run-lexc-testcases.sh b/src/fst/test/run-lexc-testcases.sh index 394c80bff..7324aa409 100755 --- a/src/fst/test/run-lexc-testcases.sh +++ b/src/fst/test/run-lexc-testcases.sh @@ -4,6 +4,19 @@ # specified transducer for each lexc file and for each transducer specified in # the test cases. +# ensure that we are ran from make or setup properly +if test -z "${srcdir}" ; then + echo "srcdir= not set, this must be run from make check or with srcdir=." + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi + ###### Variables: ####### transducer=gt-norm Fail=0 @@ -12,17 +25,13 @@ Skipped=no testtype=full concat_lexc_file="lexicon.lexc" -relpath=../../../test/ +relpath=$GIELLA_CORE/scripts/ testrunner=run-morph-tester.sh -while test ! -x $relpath/$testrunner ; do - relpath="$relpath/.." -# echo relpath: $relpath # debug - if test "$(cd $relpath && pwd)" = "/" ; then - echo "$0: No test runner found!" - exit 77 - fi -done +if ! test -x "$relpath/$testrunner" ; then + echo "$0: No test runner found in $relpath/$testrunner!" + exit 77 +fi # Get list of source files: source_files="$(find ${srcdir}/../ -name '*.lexc' \ @@ -69,20 +78,22 @@ for file in ${source_files}; do echo "Running $fst tests:" # Empty line before each new fst: echo - leadtext=$(echo "LEXC test $i: ") + leadtext="LEXC test $i: " # Check for possible one-sided tests (default is two-sided/full): if [[ "$fst" == *.gen ]]; then testtype="gen" - fst=$(basename $fst .gen) + fst=$(basename "$fst" .gen) elif [[ "$fst" == *.ana ]] ; then testtype="ana" - fst=$(basename $fst .ana) + fst=$(basename "$fst" .ana) fi # Run the actual tests for the given fst: - source $relpath/run-morph-tester.sh \ - $fst $file $relpath $testtype ../../../test all $leadtext + for tk in $TESTKITS ; do + "$relpath"/run-morph-tester.sh \ + "$fst" "$file" "$relpath" "$testtype" all "$srcdir" "$tk" "$leadtext" + done # echo "The $fst testing is done using $testtype testing." # debug # Reset testtype to default: @@ -91,4 +102,19 @@ for file in ${source_files}; do fi done -source $srcdir/$relpath/error-handling-stubs.sh + +if test "$Skipped" == "yes" ; then + exit 77 +fi + +# At least one of the Xerox or HFST tests failed: +if test "$Fail" -ge 1; then + exit 1 +fi + +# Skip if no transducer were found - failing is problematic for lexc tests: +if test "$Tests_found" = 0 ; then + echo "No lexcy tests found" + exit 77 +fi + diff --git a/test/run-morph-tester.sh.in b/test/run-morph-tester.sh.in index 39aeb9abd..e1e75ba37 100755 --- a/test/run-morph-tester.sh.in +++ b/test/run-morph-tester.sh.in @@ -15,6 +15,8 @@ # # This file must be processed by ./configure before being used. +echo "DEPRECATED run-morph-tester.sh MAYBE CALLED FROM $0" + # Wrong usage - short instruction: if ! test $# -ge 5 ; then echo @@ -311,3 +313,5 @@ for f in $fsttype; do continue fi done + +echo "DEPRECATED run-morph-tester.sh MAYBE CALLED FROM $0" diff --git a/test/run-yaml-testcases.sh.in b/test/run-yaml-testcases.sh.in index 4a4808899..0becc6494 100755 --- a/test/run-yaml-testcases.sh.in +++ b/test/run-yaml-testcases.sh.in @@ -13,6 +13,8 @@ # This script only contains the loop, and will for each found yaml file call # the actual test runner. +echo "DEPRECATED run-yaml-testcases.sh MAYBE CALLED FROM $0" + # Wrong usage - short instruction: if ! test $# -ge 2 ; then echo @@ -209,3 +211,5 @@ printf "${red}FAILS: ${totalfails}${reset} / " printf "${blue}TOTAL: ${totaltotals}${reset}\n" source $testerpath/error-handling-stubs.sh + +echo "DEPRECATED run-yaml-testcases.sh MAYBE CALLED FROM $0" diff --git a/tools/mt/apertium/test/Makefile.am b/tools/mt/apertium/test/Makefile.am index 12ae3e67f..24365123f 100644 --- a/tools/mt/apertium/test/Makefile.am +++ b/tools/mt/apertium/test/Makefile.am @@ -2,16 +2,21 @@ ## Copyright: Sámediggi/Divvun/UiT ## Licence: GPL v3+ -######## Test targets: ########### +######## Local test targets: ########### # List here (space separated) all test scripts that should be run: TESTS= -if CAN_YAML_TEST +# Add local yaml test runners here: +YAML_TEST_RUNNERS= # Add your shell scripts for running python-based tests here: +OTHER_TEST_RUNNERS= + +if CAN_YAML_TEST + if WANT_APERTIUM -TESTS+=run-mt-gt-desc-anayaml-testcases.sh +TESTS+= endif # WANT_APERTIUM endif # CAN_YAML_TEST @@ -20,7 +25,5 @@ endif # CAN_YAML_TEST # be fixed *later*, but is not critical at the moment: XFAIL_TESTS=run-mt-gt-desc-anayaml-testcases.sh -####### Other targets: ########### -clean-local: - -rm -f *.txt +include $(top_srcdir)/../giella-core/am-shared/tools-mt-apertium-test-include.am include $(top_srcdir)/../giella-core/am-shared/devtest-include.am diff --git a/tools/mt/apertium/test/run-mt-gt-desc-anayaml-testcases.sh b/tools/mt/apertium/test/run-mt-gt-desc-anayaml-testcases.sh index ccdc83a24..b2d5d0739 100755 --- a/tools/mt/apertium/test/run-mt-gt-desc-anayaml-testcases.sh +++ b/tools/mt/apertium/test/run-mt-gt-desc-anayaml-testcases.sh @@ -4,6 +4,26 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=mt-gt-desc @@ -11,15 +31,21 @@ transducer=mt-gt-desc # Specify whether the test runner should test only generation, analysis or both: # gen = generation test # ana = analysis test -# full / both / "" (ie nothing) = test both directions -# speller = to test one-tape automatons, like a speller acceptor +# full / both/ "" (ie nothing) = test both directions +# speller = t test one-tape automatons, like a speller acceptor halftest=ana -# Specify the name of the subdir where the yaml files are, use '.' if it is the -# same dir as this script: +# Specify thename of the subdir where the yaml files are, use '.' if it is the +# same dir asthis script: yaml_file_subdir=. -####### Include/source helper script from dir above - DO NOT CHANGE: ######## -# Relative path from test script to test runner: -testrunner="../../../../test/run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir ../../../../test $halftest +####### Run the helper script from giella core - DO NOT CHANGE: ######## +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/tools/spellcheckers/test/Makefile.am b/tools/spellcheckers/test/Makefile.am index ecc4075c1..84feba0c0 100644 --- a/tools/spellcheckers/test/Makefile.am +++ b/tools/spellcheckers/test/Makefile.am @@ -7,18 +7,18 @@ SUBDIRS = fstbased # Uncomment and list here (space separated) all test scripts that should be run: TESTS= -# Yaml tests are run from shell scripts - specify them here: -YAML_TEST_RUNNERS=run-spellers-gt-norm-yaml-testcases.sh +# Add local yaml test runners here: +YAML_TEST_RUNNERS= # Specify other shell scripts here to make sure they are included in the distro # even though spellers are disabled: -OTHER_TEST_RUNNERS=test-zhfst-file.sh +OTHER_TEST_RUNNERS= # Only test spellers if we build spellers: if WANT_SPELLERS -TESTS+=$(OTHER_TEST_RUNNERS) +TESTS+= # Only run yaml tests if we are able to: if CAN_YAML_TEST -TESTS+=$(YAML_TEST_RUNNERS) +TESTS+= endif # CAN_YAML_TEST endif # WANT_SPELLERS @@ -26,16 +26,7 @@ endif # WANT_SPELLERS # ie things that should be fixed *later*, but is not critical at the moment: XFAIL_TESTS=run-spellers-gt-norm-yaml-testcases.sh -# Make sure all required files are included in the distribution: -YAML_FILES=$(wildcard *.yaml) -YAML_DIRS= -EXTRA_DIST=$(OTHER_TEST_RUNNERS) \ - $(YAML_TEST_RUNNERS) \ - $(YAML_FILES) \ - $(YAML_DIRS) - -####### Other targets: ########### -clean-local: - -rm -f *.txt +include $(top_srcdir)/../giella-core/am-shared/tools-spellcheckers-test-include.am include $(top_srcdir)/../giella-core/am-shared/devtest-include.am + diff --git a/tools/spellcheckers/test/fstbased/Makefile.am b/tools/spellcheckers/test/fstbased/Makefile.am index a4416f692..d55bf3025 100644 --- a/tools/spellcheckers/test/fstbased/Makefile.am +++ b/tools/spellcheckers/test/fstbased/Makefile.am @@ -7,6 +7,7 @@ SUBDIRS = desktop mobile # Uncomment and list here (space separated) all test scripts that should be run: TESTS= +YAML_TEST_RUNNERS= # Only test spellers if we build spellers: if WANT_SPELLERS # Only run yaml tests if we are able to: @@ -18,4 +19,6 @@ endif # WANT_SPELLERS # List tests that are presently (expected) failures here (in addition to above), # ie things that should be fixed *later*, but is not critical at the moment: XFAIL_TESTS=run-fstspeller-gt-norm-yaml-testcases.sh + +include $(top_srcdir)/../giella-core/am-shared/tools-spellcheckers-fstbased-test-include.am include $(top_srcdir)/../giella-core/am-shared/devtest-include.am diff --git a/tools/spellcheckers/test/fstbased/desktop/hfst/Makefile.am b/tools/spellcheckers/test/fstbased/desktop/hfst/Makefile.am index 26b8f830f..ecebf53dc 100644 --- a/tools/spellcheckers/test/fstbased/desktop/hfst/Makefile.am +++ b/tools/spellcheckers/test/fstbased/desktop/hfst/Makefile.am @@ -29,7 +29,8 @@ endif # WANT_SPELLERS # List tests that are presently (expected) failures here (in addition to above), # ie things that should be fixed *later*, but is not critical at the moment: -XFAIL_TESTS=run-acceptor-yaml-testcases.sh +XFAIL_TESTS=run-acceptor-yaml-testcases.sh \ + accept-all-lemmas.sh # Make sure all required files are included in the distribution: YAML_FILES=$(wildcard *.yaml) @@ -40,7 +41,5 @@ EXTRA_DIST=$(OTHER_TEST_RUNNERS_IN) \ $(YAML_FILES) \ $(YAML_DIRS) -####### Other targets: ########### -clean-local: - -rm -f *.txt +include $(top_srcdir)/../giella-core/am-shared/tools-spellcheckers-fstbased-desktop-hfst-test-include.am include $(top_srcdir)/../giella-core/am-shared/devtest-include.am diff --git a/tools/spellcheckers/test/fstbased/desktop/hfst/run-acceptor-yaml-testcases.sh b/tools/spellcheckers/test/fstbased/desktop/hfst/run-acceptor-yaml-testcases.sh index 19c102c91..1414ca387 100755 --- a/tools/spellcheckers/test/fstbased/desktop/hfst/run-acceptor-yaml-testcases.sh +++ b/tools/spellcheckers/test/fstbased/desktop/hfst/run-acceptor-yaml-testcases.sh @@ -3,6 +3,23 @@ # This is a shell script that will call the actual test runner with the # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: @@ -21,5 +38,12 @@ yaml_file_subdir=hfst-acceptor-yamls ####### Include/source helper script from dir above - DO NOT CHANGE: ######## # Relative path from test script to test runner: -testrunner="../../../../../run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir $halftest +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/tools/spellcheckers/test/fstbased/run-fstspeller-gt-norm-yaml-testcases.sh b/tools/spellcheckers/test/fstbased/run-fstspeller-gt-norm-yaml-testcases.sh index ca06476d0..428e19721 100755 --- a/tools/spellcheckers/test/fstbased/run-fstspeller-gt-norm-yaml-testcases.sh +++ b/tools/spellcheckers/test/fstbased/run-fstspeller-gt-norm-yaml-testcases.sh @@ -4,6 +4,25 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=fstspeller-gt-norm @@ -21,5 +40,12 @@ yaml_file_subdir=fstspeller-gt-norm-yamls ####### Include/source helper script from dir above - DO NOT CHANGE: ######## # Relative path from test script to test runner: -testrunner="../../../run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir $halftest +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done diff --git a/tools/spellcheckers/test/run-spellers-gt-norm-yaml-testcases.sh b/tools/spellcheckers/test/run-spellers-gt-norm-yaml-testcases.sh index d8dfa5896..d49b14e1a 100755 --- a/tools/spellcheckers/test/run-spellers-gt-norm-yaml-testcases.sh +++ b/tools/spellcheckers/test/run-spellers-gt-norm-yaml-testcases.sh @@ -4,6 +4,25 @@ # specified transducer. This determines also the set of yaml test files looped # over by the test runner. +# ensure that we are ran from make or setup properly +if test -z "$srcdir" ; then + echo "srcdir= not set, this must be run from make or set srcdir=." + exit 2 +fi +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +if test -z "$TESTKITS" ; then + TESTKITS=hfst +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/run-yaml-testcases.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi + ###### User variables - adjust as needed: ####### # Specify the invariable part of the transducer name: transducer=speller-gt-norm @@ -19,7 +38,13 @@ halftest= # same dir as this script: yaml_file_subdir=speller-gt-norm-yamls -####### Include/source helper script from dir above - DO NOT CHANGE: ######## -# Relative path from test script to test runner: -testrunner="../../../test/run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir ../../../test $halftest +####### Run the helper script from giella core - DO NOT CHANGE: ######## +for tk in $TESTKITS ; do + "$testrunner" $transducer "$yaml_file_subdir" "$tk" "$relpath" "$srcdir" "$halftest" + rv=$? + if test $rv == 77 ; then + exit 77 + elif test $rv -gt 0 ; then + exit 1 + fi +done