Skip to content

Commit

Permalink
[Template merge] move yaml and morph testers to core
Browse files Browse the repository at this point in the history
  • Loading branch information
flammie committed Jun 12, 2024
1 parent 6635e37 commit 3ae9ebb
Show file tree
Hide file tree
Showing 24 changed files with 476 additions and 119 deletions.
5 changes: 4 additions & 1 deletion m4/giella-macros.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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)" != "" ],
Expand Down
4 changes: 2 additions & 2 deletions src/fst/morphology/test/tag_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ fi

# Extract USED tags:
sed -e '1,/LEXICON Root/d' < \
../../../src/fst/lexicon.tmp.lexc | # Extract all lines after LEXICON Root
../lexicon.lexc | # Extract all lines after LEXICON Root
${giella_core}/scripts/extract-used-tags.sh | # Extract tags, local mods after this line:
LC_ALL=no_NO.UTF8 sort -u \
> "${lexctags}"

# 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}"
Expand Down
20 changes: 5 additions & 15 deletions src/fst/orthography/test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,28 @@
## 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=

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
33 changes: 29 additions & 4 deletions src/fst/orthography/test/run-initcaps-genyaml-testcases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
22 changes: 14 additions & 8 deletions src/fst/test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand Down Expand Up @@ -50,7 +54,9 @@ XFAIL_TESTS=run-dict-gt-desc-anayaml-testcases.sh \
run-gt-norm-genyaml-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
34 changes: 30 additions & 4 deletions src/fst/test/run-dict-gt-desc-anayaml-testcases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
33 changes: 29 additions & 4 deletions src/fst/test/run-dict-gt-norm-genyaml-testcases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
33 changes: 29 additions & 4 deletions src/fst/test/run-gt-desc-anayaml-testcases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
33 changes: 29 additions & 4 deletions src/fst/test/run-gt-desc-genyaml-testcases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
33 changes: 29 additions & 4 deletions src/fst/test/run-gt-desc-yaml-testcases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Loading

0 comments on commit 3ae9ebb

Please sign in to comment.