From 794be9a5ac708f2d467a21c1e7df2bb228d152b4 Mon Sep 17 00:00:00 2001 From: Flammie A Pirinen Date: Wed, 15 May 2024 14:54:14 +0200 Subject: [PATCH] [Template merge] test/ reorg scripts --- .gitignore | 32 +-- m4/giella-config-files.m4 | 70 +++--- src/cg3/Makefile.am | 3 + src/fst/Makefile.am | 2 +- src/fst/Makefile.am.orig | 145 ------------ src/fst/Makefile.am.rej | 207 ------------------ src/fst/morphology/Makefile.am | 3 + src/fst/morphology/test/Makefile.am | 2 + .../test/generate-adjective-lemmas.sh.in | 8 +- .../test/generate-noun-lemmas.sh.in | 8 +- .../test/generate-propernoun-lemmas.sh.in | 8 +- .../test/generate-verb-lemmas.sh.in | 8 +- .../test/generate-verb-lemmas.sh.in.orig | 155 ------------- .../test/phonology/pair-test-hfst.sh.in | 6 +- src/fst/orthography/Makefile.am | 3 + .../test/run-initcaps-genyaml-testcases.sh | 4 +- src/fst/test/Makefile.am | 2 - .../run-dict-gt-desc-anayaml-testcases.sh | 4 +- .../run-dict-gt-norm-genyaml-testcases.sh | 4 +- src/fst/test/run-gt-desc-anayaml-testcases.sh | 4 +- src/fst/test/run-gt-desc-genyaml-testcases.sh | 4 +- src/fst/test/run-gt-desc-yaml-testcases.sh | 4 +- src/fst/test/run-gt-norm-anayaml-testcases.sh | 4 +- src/fst/test/run-gt-norm-genyaml-testcases.sh | 4 +- src/fst/test/run-gt-norm-yaml-testcases.sh | 4 +- src/fst/test/run-lexc-testcases.sh | 12 +- test/Makefile.am | 1 - test/run-morph-tester.sh.in | 14 +- test/run-yaml-testcases.sh.in | 20 +- tools/hyphenators/Makefile.am | 2 +- tools/mt/apertium/Makefile.am | 2 +- .../test/run-mt-gt-desc-anayaml-testcases.sh | 4 +- tools/spellcheckers/Makefile.am | 2 +- .../run-spellers-gt-norm-yaml-testcases.sh | 4 +- 34 files changed, 134 insertions(+), 625 deletions(-) delete mode 100644 src/fst/Makefile.am.orig delete mode 100644 src/fst/Makefile.am.rej delete mode 100644 src/fst/morphology/test/generate-verb-lemmas.sh.in.orig diff --git a/.gitignore b/.gitignore index 333766d1..475a3ae7 100644 --- a/.gitignore +++ b/.gitignore @@ -77,22 +77,22 @@ /src/fst/phonetics/tests/tests/*.sh /test/run-morph-tester.sh /test/run-yaml-testcases.sh -/test/src/morphology/all*.txt -/test/src/morphology/analysed*.txt -/test/src/morphology/filtered* -/test/src/morphology/generate-*-lemmas.sh -/test/src/morphology/generated*.txt -/test/src/morphology/missing_*.txt -/test/src/phonology/negative-*.txt -/test/src/phonology/hfst-twolc-error-messages.txt -/test/src/phonology/pair-*.txt -/test/src/phonology/pair-test-*.sh -/test/src/phonology/positive-*.txt -/test/src/phonology/twolcscript.sh -/test/tools/spellcheckers/fstbased/desktop/hfst/*.txt -/test/tools/spellcheckers/fstbased/desktop/hfst/accept-all-lemmas.sh -/test/tools/spellcheckers/fstbased/desktop/hfst/test-zhfst-basic-sugg-speed.sh -/test/tools/spellcheckers/test-zhfst-file.sh +/src/fst/morphology/test/all*.txt +/src/fst/morphology/test/analysed*.txt +/src/fst/morphology/test/filtered* +/src/fst/morphology/test/generate-*-lemmas.sh +/src/fst/morphology/test/generated*.txt +/src/fst/morphology/test/missing_*.txt +/src/fst/morphology/test/phonology/negative-*.txt +/src/fst/morphology/test/phonology/hfst-twolc-error-messages.txt +/src/fst/morphology/test/phonology/pair-*.txt +/src/fst/morphology/test/phonology/pair-test-*.sh +/src/fst/morphology/test/phonology/positive-*.txt +/src/fst/morphology/test/phonology/twolcscript.sh +/tools/spellcheckers/test/fstbased/desktop/hfst/*.txt +/tools/spellcheckers/test/fstbased/desktop/hfst/accept-all-lemmas.sh +/tools/spellcheckers/test/fstbased/desktop/hfst/test-zhfst-basic-sugg-speed.sh +/tools/spellcheckers/test/test-zhfst-file.sh /tools/analysers/*.cg3 /tools/analysers/*.pmhfst /tools/analysers/*.zcheck diff --git a/m4/giella-config-files.m4 b/m4/giella-config-files.m4 index 640cac4d..b0f810a8 100644 --- a/m4/giella-config-files.m4 +++ b/m4/giella-config-files.m4 @@ -12,30 +12,19 @@ AC_CONFIG_FILES([Makefile \ src/fst/syllabification/Makefile \ src/fst/Makefile \ src/fst/morphology/Makefile \ + src/fst/morphology/test/Makefile \ + src/fst/morphology/test/phonology/Makefile \ src/fst/orthography/Makefile \ + src/fst/orthography/test/Makefile \ src/fst/phonetics/Makefile \ src/fst/phonetics/tests/Makefile \ + src/fst/test/Makefile \ src/cg3/Makefile \ + src/cg3/test/Makefile \ src/fst/tagsets/Makefile \ src/fst/transcriptions/Makefile \ docs/Makefile \ test/Makefile \ - test/tools/Makefile \ - test/tools/hyphenators/Makefile \ - test/tools/hyphenators/fstbased/Makefile \ - test/tools/hyphenators/patternbased/Makefile \ - test/tools/mt/Makefile \ - test/tools/mt/apertium/Makefile \ - test/tools/spellcheckers/Makefile \ - test/tools/spellcheckers/fstbased/Makefile \ - test/tools/spellcheckers/fstbased/desktop/Makefile \ - test/tools/spellcheckers/fstbased/desktop/hfst/Makefile \ - test/tools/spellcheckers/fstbased/mobile/Makefile \ - test/src/Makefile \ - test/src/morphology/Makefile \ - test/src/orthography/Makefile \ - test/src/phonology/Makefile \ - test/src/syntax/Makefile \ tools/Makefile \ tools/analysers/Makefile \ tools/analysers/pipespec.xml \ @@ -45,11 +34,15 @@ AC_CONFIG_FILES([Makefile \ tools/grammarcheckers/tests/Makefile \ tools/hyphenators/Makefile \ tools/hyphenators/filters/Makefile \ + tools/hyphenators/test/Makefile \ + tools/hyphenators/test/fstbased/Makefile \ + tools/hyphenators/test/patternbased/Makefile \ tools/mt/Makefile \ tools/mt/filters/Makefile \ tools/mt/apertium/Makefile \ tools/mt/apertium/filters/Makefile \ tools/mt/apertium/tagsets/Makefile \ + tools/mt/apertium/test/Makefile \ tools/mt/cgbased/Makefile \ tools/tokenisers/Makefile \ tools/tokenisers/filters/Makefile \ @@ -60,6 +53,11 @@ AC_CONFIG_FILES([Makefile \ tools/spellcheckers/index.mobile.xml \ tools/spellcheckers/filters/Makefile \ tools/spellcheckers/neural/Makefile \ + tools/spellcheckers/test/Makefile \ + tools/spellcheckers/test/fstbased/Makefile \ + tools/spellcheckers/test/fstbased/desktop/Makefile \ + tools/spellcheckers/test/fstbased/desktop/hfst/Makefile \ + tools/spellcheckers/test/fstbased/mobile/Makefile \ tools/spellcheckers/weights/Makefile \ tools/tts/Makefile \ tools/tts/pipespec.xml \ @@ -69,33 +67,33 @@ AC_CONFIG_FILES([Makefile \ # Spell checker tests, all languages: AC_CONFIG_FILES([src/fst/phonetics/tests/run_tests.sh], [chmod a+x src/fst/phonetics/tests/run_tests.sh]) -AC_CONFIG_FILES([test/tools/spellcheckers/test-zhfst-file.sh], \ - [chmod a+x test/tools/spellcheckers/test-zhfst-file.sh]) -AC_CONFIG_FILES([test/tools/spellcheckers/fstbased/desktop/hfst/test-zhfst-basic-sugg-speed.sh], \ - [chmod a+x test/tools/spellcheckers/fstbased/desktop/hfst/test-zhfst-basic-sugg-speed.sh]) +AC_CONFIG_FILES([tools/spellcheckers/test/test-zhfst-file.sh], \ + [chmod a+x tools/spellcheckers/test/test-zhfst-file.sh]) +AC_CONFIG_FILES([tools/spellcheckers/test/fstbased/desktop/hfst/test-zhfst-basic-sugg-speed.sh], \ + [chmod a+x tools/spellcheckers/test/fstbased/desktop/hfst/test-zhfst-basic-sugg-speed.sh]) AC_CONFIG_FILES([test/run-yaml-testcases.sh], \ [chmod a+x test/run-yaml-testcases.sh]) AC_CONFIG_FILES([test/run-morph-tester.sh], \ [chmod a+x test/run-morph-tester.sh]) # Phonology tests, all languages: -AC_CONFIG_FILES([test/src/phonology/pair-test-positive.sh], \ - [chmod a+x test/src/phonology/pair-test-positive.sh]) -AC_CONFIG_FILES([test/src/phonology/pair-test-negative.sh], \ - [chmod a+x test/src/phonology/pair-test-negative.sh]) -AC_CONFIG_FILES([test/src/phonology/pair-test-hfst.sh], \ - [chmod a+x test/src/phonology/pair-test-hfst.sh]) +AC_CONFIG_FILES([src/fst/morphology/test/phonology/pair-test-positive.sh], \ + [chmod a+x src/fst/morphology/test/phonology/pair-test-positive.sh]) +AC_CONFIG_FILES([src/fst/morphology/test/phonology/pair-test-negative.sh], \ + [chmod a+x src/fst/morphology/test/phonology/pair-test-negative.sh]) +AC_CONFIG_FILES([src/fst/morphology/test/phonology/pair-test-hfst.sh], \ + [chmod a+x src/fst/morphology/test/phonology/pair-test-hfst.sh]) # Lemma generation tests, all languages: -AC_CONFIG_FILES([test/src/morphology/generate-adjective-lemmas.sh], \ - [chmod a+x test/src/morphology/generate-adjective-lemmas.sh]) -AC_CONFIG_FILES([test/src/morphology/generate-noun-lemmas.sh], \ - [chmod a+x test/src/morphology/generate-noun-lemmas.sh]) -AC_CONFIG_FILES([test/src/morphology/generate-propernoun-lemmas.sh], \ - [chmod a+x test/src/morphology/generate-propernoun-lemmas.sh]) -AC_CONFIG_FILES([test/src/morphology/generate-verb-lemmas.sh], \ - [chmod a+x test/src/morphology/generate-verb-lemmas.sh]) +AC_CONFIG_FILES([src/fst/morphology/test/generate-adjective-lemmas.sh], \ + [chmod a+x src/fst/morphology/test/generate-adjective-lemmas.sh]) +AC_CONFIG_FILES([src/fst/morphology/test/generate-noun-lemmas.sh], \ + [chmod a+x src/fst/morphology/test/generate-noun-lemmas.sh]) +AC_CONFIG_FILES([src/fst/morphology/test/generate-propernoun-lemmas.sh], \ + [chmod a+x src/fst/morphology/test/generate-propernoun-lemmas.sh]) +AC_CONFIG_FILES([src/fst/morphology/test/generate-verb-lemmas.sh], \ + [chmod a+x src/fst/morphology/test/generate-verb-lemmas.sh]) # Lemma acceptance test for spellers, all languages: -AC_CONFIG_FILES([test/tools/spellcheckers/fstbased/desktop/hfst/accept-all-lemmas.sh], \ - [chmod a+x test/tools/spellcheckers/fstbased/desktop/hfst/accept-all-lemmas.sh]) +AC_CONFIG_FILES([tools/spellcheckers/test/fstbased/desktop/hfst/accept-all-lemmas.sh], \ + [chmod a+x tools/spellcheckers/test/fstbased/desktop/hfst/accept-all-lemmas.sh]) # Shorthand shell scripts instead of the old-type aliases - all languages: AC_CONFIG_FILES([tools/shellscripts/uhdn-gt.sh], \ [chmod a+x tools/shellscripts/uhdn-gt.sh]) diff --git a/src/cg3/Makefile.am b/src/cg3/Makefile.am index 4d36fed3..7e390d78 100644 --- a/src/cg3/Makefile.am +++ b/src/cg3/Makefile.am @@ -2,6 +2,9 @@ ## Copyright: Sámediggi/Divvun/UiT ## Licence: GPL v3+ +# build before test +SUBDIRS=. test + ################################################################## #### BEGIN: Add local processing instructions BELOW this line #### ################################################################## diff --git a/src/fst/Makefile.am b/src/fst/Makefile.am index 3f1f9fc7..c2844c71 100644 --- a/src/fst/Makefile.am +++ b/src/fst/Makefile.am @@ -3,7 +3,7 @@ ## Licence: GPL v3+ # always build . last here, and tagsets have to be built after morphology -SUBDIRS = morphology filters phonetics syllabification orthography transcriptions tagsets . +SUBDIRS = morphology filters phonetics syllabification orthography transcriptions tagsets . test ####### Automake targets: ######## diff --git a/src/fst/Makefile.am.orig b/src/fst/Makefile.am.orig deleted file mode 100644 index 2c62961c..00000000 --- a/src/fst/Makefile.am.orig +++ /dev/null @@ -1,145 +0,0 @@ -## Process this file with automake to produce Makefile.in - -## Copyright (C) 2011 Samediggi - -## This program is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. - -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. - -## You should have received a copy of the GNU General Public License -## along with this program. If not, see . - -# Add language-specific flags for hfst-lexc compilation here: -if HAVE_SHARED_COMMON -HFST_LEXC_LOCAL_FLAGS= # --Werror # uncomment if lexc is good enough -else -HFST_LEXC_LOCAL_FLAGS= # No --Werror if deps are missing ! -endif - - -####### Morphology source file defs: ######## - -# Set this to name of lexc file containing Multichar_Symbols and LEXICON Root -GT_LEXC_ROOT=$(srcdir)/root.lexc - -# Set this to the names of all regular lexc source files: -GT_LEXC_SRCS_L1_L2=\ - affixes/nouns.lexc \ - affixes/symbols.lexc \ - affixes/verbs.lexc \ - stems/adjectives.lexc \ - stems/nouns.lexc \ - stems/prefixes.lexc \ - stems/pronouns.lexc \ - stems/adverbs.lexc \ - stems/postpositions.lexc \ - stems/particles.lexc \ - stems/verbs.lexc \ - stems/abbreviations.lexc \ - stems/numerals.lexc \ - affixes/adjectives.lexc -# affixes/propernouns.lexc \ -# If you are building an error-detecting L2 analyser, specify the lexc files -# that differ between the regular L1 and the L2 analysers below, in L1 and -# L2 respectively. L2 files must end in "*-L2.lexc". See SME for an example. -L1= - -L2= - -GT_LEXC_SRCS=\ - $(GT_LEXC_SRCS_L1_L2) \ - $(L1) - -GT_LEXC_L2_SRCS=\ - $(GT_LEXC_SRCS_L1_L2) \ - $(L2) - -# Set this to the names of all generated lexc files, if any -GENERATED_LEXC_SRCS=generated_files/eng-$(GTLANG)-propernouns.lexc \ - generated_files/mul-$(GLANG)-punctuation.lexc \ - generated_files/mul-$(GLANG)-symbols.lexc - -# change handling of shared lexical data here: -if HAVE_SHARED_COMMON -url.tmp.lexc: $(gt_SHARED_common)/src/fst/url.lexc - $(AM_V_CP)cp -f $< $@ - -generated_files/mul-$(GLANG)-%.lexc: $(gt_SHARED_common)/src/fst/stems/%.lexc - $(AM_V_at)$(MKDIR_P) generated_files - $(AM_V_CP)cp -f $< $@ -else -# this is "safe" fallback (compiles but you miss everything) -url.tmp.lexc: - echo "LEXICON Root" > $@ - echo "< h t t p (s) %: %/ %/ ?*> # ;" >> $@ - -generated_files/mul-$(GLANG)-%.lexc: - $(AM_V_at)$(MKDIR_P) generated_files - echo "! Missing shared common data" > $@ -endif -# add other lexical shared data handling here - - -# Set this to the names of all source xml files, if any -GT_XML_SRCS= - -# Define any additional lexc sources here (compiled on their own): -GT_LOCAL_SRCS= - -# Define local xfscripts here: -GT_LOCAL_XFSCRIPT_SRCS= - -# Define here any additional sources just included in the distro: -GT_DISTRO_SRCS=stems/$(GTLANG)-propernouns.lexc - -### BEGIN: Local processing: ### - -### List additional targets in the following variable, for build targets not -### covered by other means. This comes ***in addition to*** what you can do by -### just targeting lexicon.*: lexicon.tmp.*, and is useful if you want to build -### separate fst's that need further treatment in the src/ dir. See the language -### gle/ for an example of how this is used. - -GIELLA_LOCAL_TARGETS= - -if HAVE_SHARED_ENG -generated_files/eng-propernouns.lexc: \ - $(gt_SHARED_eng)/src/fst/stems/eng-propernouns.lexc - $(AM_V_at)$(MKDIR_P) generated_files - $(AM_V_GEN)cp -f $< $@ - -generated_files/eng-$(GTLANG)-propernouns.lexc: \ - generated_files/eng-propernouns.lexc \ - $(srcdir)/stems/$(GTLANG)-propernouns.lexc - $(AM_V_GEN)rm -f $@ && \ - cp -f $(srcdir)/stems/$(GTLANG)-propernouns.lexc $@ && \ - echo "" >> $@ && \ - echo "! <--- Dump from ENG -->" >> $@ && \ - echo "" >> $@ && \ - cat $< >> $@ -else -generated_files/eng-$(GLANG)-%.lexc: - $(AM_V_at)$(MKDIR_P) generated_files - $(AM_C_GEN)echo "! Missing shared common data" > $@ -endif - -### END: Local processing: ### - -####### Other targets: ########### -# Clean: add local clean targets on separate lines, so that the first line can -# easily get updates from the template dir through svn merge. -clean-local: - -rm -f *.all.* *fst *.foma *.script generated_files/*.lexc lexicon.* - -rm -f url.lexc *.tmp* - -rm -f *.relabel lexicon-tags.* lexicon-sigma.* - -include $(srcdir)/Makefile.modifications-phon.am -include $(top_srcdir)/../giella-core/am-shared/src-morphology-dir-include.am - -# vim: set ft=automake: diff --git a/src/fst/Makefile.am.rej b/src/fst/Makefile.am.rej deleted file mode 100644 index 4eeaed01..00000000 --- a/src/fst/Makefile.am.rej +++ /dev/null @@ -1,207 +0,0 @@ ---- src/fst/Makefile.am -+++ src/fst/Makefile.am -@@ -1,119 +1,86 @@ - ## Process this file with automake to produce Makefile.in -- --## Copyright (C) 2011 Samediggi -- --## This program is free software: you can redistribute it and/or modify --## it under the terms of the GNU General Public License as published by --## the Free Software Foundation, either version 3 of the License, or --## (at your option) any later version. -- --## This program is distributed in the hope that it will be useful, --## but WITHOUT ANY WARRANTY; without even the implied warranty of --## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --## GNU General Public License for more details. -- --## You should have received a copy of the GNU General Public License --## along with this program. If not, see . -- --# Add language-specific flags for hfst-lexc compilation here: --if HAVE_SHARED_COMMON --HFST_LEXC_LOCAL_FLAGS= # --Werror # uncomment if lexc is good enough --else --HFST_LEXC_LOCAL_FLAGS= # No --Werror if deps are missing ! --endif -- -- --####### Morphology source file defs: ######## -- --# Set this to name of lexc file containing Multichar_Symbols and LEXICON Root --GT_LEXC_ROOT=$(srcdir)/root.lexc -- --# Set this to the names of all regular lexc source files: --GT_LEXC_SRCS_L1_L2=\ -- affixes/adjectives.lexc \ -- affixes/nouns.lexc \ -- affixes/propernouns.lexc \ -- affixes/symbols.lexc \ -- affixes/verbs.lexc \ -- stems/adjectives.lexc \ -- stems/nouns.lexc \ -- stems/numerals.lexc \ -- stems/prefixes.lexc \ -- stems/pronouns.lexc \ -- stems/verbs.lexc -- --# If you are building an error-detecting L2 analyser, specify the lexc files --# that differ between the regular L1 and the L2 analysers below, in L1 and --# L2 respectively. L2 files must end in "*-L2.lexc". See SME for an example. --L1= -- --L2= -- --GT_LEXC_SRCS=\ -- $(GT_LEXC_SRCS_L1_L2) \ -- $(L1) -- --GT_LEXC_L2_SRCS=\ -- $(GT_LEXC_SRCS_L1_L2) \ -- $(L2) -- --# Set this to the names of all generated lexc files, if any --GENERATED_LEXC_SRCS=generated_files/mul-$(GLANG)-punctuation.lexc \ -- generated_files/mul-$(GLANG)-symbols.lexc -- --# change handling of shared lexical data here: --if HAVE_SHARED_COMMON --url.tmp.lexc: $(gt_SHARED_common)/src/fst/url.lexc -- $(AM_V_CP)cp -f $< $@ -- --generated_files/mul-$(GLANG)-%.lexc: $(gt_SHARED_common)/src/fst/stems/%.lexc -- $(AM_V_at)$(MKDIR_P) generated_files -- $(AM_V_CP)cp -f $< $@ --else --# this is "safe" fallback (compiles but you miss everything) --url.tmp.lexc: -- echo "LEXICON Root" > $@ -- echo "< h t t p (s) %: %/ %/ ?*> # ;" >> $@ -- --generated_files/mul-$(GLANG)-%.lexc: -- $(AM_V_at)$(MKDIR_P) generated_files -- echo "! Missing shared common data" > $@ --endif --# add other lexical shared data handling here -- --# Set this to the names of all source xml files, if any --GT_XML_SRCS= -- --# Define any additional lexc sources here (compiled on their own): --GT_LOCAL_SRCS= -- --# Define local xfscripts here: --GT_LOCAL_XFSCRIPT_SRCS= -- --# Define here any additional sources just included in the distro: --GT_DISTRO_SRCS= -- --### BEGIN: Local processing: ### -- --### List additional targets in the following variable, for build targets not --### covered by other means. This comes ***in addition to*** what you can do by --### just targeting lexicon.*: lexicon.tmp.*, and is useful if you want to build --### separate fst's that need further treatment in the src/ dir. See the language --### gle/ for an example of how this is used. -- --GIELLA_LOCAL_TARGETS= -- --### END: Local processing: ### -- --####### Other targets: ########### --# Clean: add local clean targets on separate lines, so that the first line can --# easily get updates from the template dir through svn merge. --clean-local: -- -rm -f *.all.* *fst *.foma *.script generated_files/*.lexc lexicon.* -- -rm -f url.lexc *.tmp* -- -rm -f *.relabel lexicon-tags.* lexicon-sigma.* -- --include $(srcdir)/Makefile.modifications-phon.am --include $(top_srcdir)/../giella-core/am-shared/src-morphology-dir-include.am -- --# vim: set ft=automake: -+## Copyright: Sámediggi/Divvun/UiT -+## Licence: GPL v3+ -+ -+# always build . last here, and tagsets have to be built after morphology -+SUBDIRS = morphology filters phonetics syllabification orthography transcriptions tagsets . -+ -+####### Automake targets: ######## -+ -+# Define target variables first, before assigning to them: -+GT_ANALYSERS= -+GT_GENERATORS= -+CUSTOM_FSTS= -+ -+#### Local modifications in *fst processing: #### -+#### -+#### Copy the fallback targets, and rename them to the desired targets. Then: -+#### Replace the 'cp' command (Xerox) / Prepend the hfst-invert command (Hfst - -+#### remember to move the $<) with whatever you need to complete -+#### the processing to get the final target transducer. -+#### Remember to add the dependencies as well. -+#### Also make sure that HFST and Xerox processing are the same. -+#### -+#### If you add new transducers to be built, you need to add them to the -+#### relevant variable, e.g.: -+#### -+#### if CAN_HFST -+#### GT_GENERATORS+=generator-oahpa-gt-norm.hfst -+#### endif -+#### -+#### NB!!!! The HFST targets should get a hyphen after 'analyser'/'generator' -+#### respectively, to make the local targets minimally different from and -+#### slightly more specific than the fallback targets. This is to avoid warnings -+#### about duplicate targets. That is, the local targets should looke like: -+#### -+#### analyser-%.hfst: analyser-%.tmp.hfst -+#### generator-%.hfst: generator-%.tmp.hfst -+ -+################################################################## -+#### BEGIN: Add local processing instructions BELOW this line #### -+################################################################## -+ -+######################################################## -+#### Add language-specific transducer targets here: #### -+ -+#### Xerox transducers: -+if CAN_XFST -+GT_ANALYSERS+= -+GT_GENERATORS+= -+ -+if WANT_CUSTOM_FSTS -+CUSTOM_FSTS+= -+endif # WANT_CUSTOM_FSTS -+ -+endif # CAN_XFST -+ -+#### HFST transducers -+if CAN_HFST -+GT_ANALYSERS+= -+GT_GENERATORS+= -+ -+if WANT_CUSTOM_FSTS -+CUSTOM_FSTS+= -+endif # WANT_CUSTOM_FSTS -+ -+endif # CAN_HFST -+ -+#### FOMA transducers -+if CAN_FOMA -+GT_ANALYSERS+= -+GT_GENERATORS+= -+ -+if WANT_CUSTOM_FSTS -+CUSTOM_FSTS+= -+endif # WANT_CUSTOM_FSTS -+ -+endif # CAN_FOMA -+ -+################################################# -+#### Add language-specific build rules here: #### -+ -+################################################################## -+#### END: Add local processing instructions ABOVE this line ###### -+################################################################## -+ -+include $(top_srcdir)/../giella-core/am-shared/src-fst-dir-include.am diff --git a/src/fst/morphology/Makefile.am b/src/fst/morphology/Makefile.am index dd5dda42..7390a84e 100644 --- a/src/fst/morphology/Makefile.am +++ b/src/fst/morphology/Makefile.am @@ -15,6 +15,9 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . +# build before test +SUBDIRS=. test + # Add language-specific flags for hfst-lexc compilation here: if HAVE_SHARED_COMMON HFST_LEXC_LOCAL_FLAGS= # --Werror # uncomment if lexc is good enough diff --git a/src/fst/morphology/test/Makefile.am b/src/fst/morphology/test/Makefile.am index c2fd785c..407f9de1 100644 --- a/src/fst/morphology/test/Makefile.am +++ b/src/fst/morphology/test/Makefile.am @@ -2,6 +2,8 @@ ## Copyright: Sámediggi/Divvun/UiT ## Licence: GPL v3+ +SUBDIRS=phonology + TESTS_ENVIRONMENT = export GIELLA_CORE=$(GIELLA_CORE); ######## Test targets: ########### diff --git a/src/fst/morphology/test/generate-adjective-lemmas.sh.in b/src/fst/morphology/test/generate-adjective-lemmas.sh.in index 4312f40e..fbfbf8b0 100755 --- a/src/fst/morphology/test/generate-adjective-lemmas.sh.in +++ b/src/fst/morphology/test/generate-adjective-lemmas.sh.in @@ -22,9 +22,9 @@ ###### Variables: ####### POS=adjectives ### in ### -source_file=${srcdir}/../../../src/fst/morphology/stems/${POS}.lexc -generator_file=./../../../src/fst/generator-gt-norm -analyser_file=./../../../src/fst/analyser-gt-norm +source_file=${srcdir}/../stems/${POS}.lexc +generator_file=./../../generator-gt-norm +analyser_file=./../../analyser-gt-norm ### out ### # Temporary files: @@ -144,7 +144,7 @@ if [ "$Fail" = "1" ]; then fi if [ $transducer_found -eq 0 ]; then - echo ERROR: No transducer found + echo ERROR: No transducer found $analyser_file $generator_file exit 77 fi diff --git a/src/fst/morphology/test/generate-noun-lemmas.sh.in b/src/fst/morphology/test/generate-noun-lemmas.sh.in index f62cc25f..af0a2928 100755 --- a/src/fst/morphology/test/generate-noun-lemmas.sh.in +++ b/src/fst/morphology/test/generate-noun-lemmas.sh.in @@ -22,9 +22,9 @@ ###### Variables: ####### POS=nouns ### in ### -source_file=${srcdir}/../../../src/fst/morphology/stems/${POS}.lexc -generator_file=./../../../src/fst/generator-gt-norm -analyser_file=./../../../src/fst/analyser-gt-norm +source_file=${srcdir}/../stems/${POS}.lexc +generator_file=./../../generator-gt-norm +analyser_file=./../../analyser-gt-norm ### out ### # Temporary files: @@ -145,7 +145,7 @@ if [ "$Fail" = "1" ]; then fi if [ $transducer_found -eq 0 ]; then - echo ERROR: No transducer found + echo ERROR: No transducer found $analyser_file $generator_file exit 77 fi diff --git a/src/fst/morphology/test/generate-propernoun-lemmas.sh.in b/src/fst/morphology/test/generate-propernoun-lemmas.sh.in index 55d5b78c..ba8be712 100644 --- a/src/fst/morphology/test/generate-propernoun-lemmas.sh.in +++ b/src/fst/morphology/test/generate-propernoun-lemmas.sh.in @@ -22,9 +22,9 @@ ###### Variables: ####### POS=propernouns ### in ### -source_file=${srcdir}/../../../src/fst/morphology/stems/${POS}.lexc -generator_file=./../../../src/fst/generator-gt-norm -analyser_file=./../../../src/fst/analyser-gt-norm +source_file=${srcdir}/../stems/${POS}.lexc +generator_file=./../../generator-gt-norm +analyser_file=./../../analyser-gt-norm ### out ### # Temporary files: @@ -153,7 +153,7 @@ if [ "$Fail" = "1" ]; then fi if [ $transducer_found -eq 0 ]; then - echo ERROR: No transducer found + echo ERROR: No transducer found $analyser_file $generator_file exit 77 fi diff --git a/src/fst/morphology/test/generate-verb-lemmas.sh.in b/src/fst/morphology/test/generate-verb-lemmas.sh.in index f8c651b8..851c605a 100644 --- a/src/fst/morphology/test/generate-verb-lemmas.sh.in +++ b/src/fst/morphology/test/generate-verb-lemmas.sh.in @@ -25,9 +25,9 @@ ###### Variables: ####### POS=verbs ### in ### -source_file=${srcdir}/../../../src/fst/morphology/stems/${POS}.lexc -generator_file=./../../../src/fst/generator-gt-norm -analyser_file=./../../../src/fst/analyser-gt-norm +source_file=${srcdir}/../stems/${POS}.lexc +generator_file=./../../generator-gt-norm +analyser_file=./../../analyser-gt-norm ### out ### # Temporary files: @@ -147,7 +147,7 @@ if [ "$Fail" = "1" ]; then fi if [ $transducer_found -eq 0 ]; then - echo ERROR: No transducer found + echo ERROR: No transducer found $analyser_file $generator_file exit 77 fi diff --git a/src/fst/morphology/test/generate-verb-lemmas.sh.in.orig b/src/fst/morphology/test/generate-verb-lemmas.sh.in.orig deleted file mode 100644 index 6e1cd009..00000000 --- a/src/fst/morphology/test/generate-verb-lemmas.sh.in.orig +++ /dev/null @@ -1,155 +0,0 @@ -#!/bin/bash -# @configure_input@ - -# Automake interprets the exit status as follows: -# - an exit status of 0 will denote a success -# - an exit status of 77 a skipped test -# - an exit status of 99 a hard error -# - any other exit status will denote a failure. - -# To run this test script only, do: -# -# make check TESTS=generate-noun-lemmas.sh - -# This test script will test that all noun lemmas do generate as themselves. -# Extend as needed, and copy to new files to adapt to other parts of speech. -# The changes usually needed are: -# -# 1. change the reference to the source file (line 23) -# 2. extend the extract lemmas egrep expression (lines 53 ff) -# 3. adapt the tag addition and lemma generation instructions (lines 79 ff) - -# script adjusted to Haida -# Testing independent verbs - -###### Variables: ####### -POS=verbs -### in ### -source_file=${srcdir}/../../../src/fst/morphology/stems/${POS}.lexc -generator_file=./../../../src/generator-gt-norm -analyser_file=./../../../src/analyser-gt-norm - -### out ### -# Temporary files: -lemmas=./filtered-${POS}.txt -# Result files, will get filename suffix programmatically further down: -generated_lemmas=./generated-${POS} -result_file=missing_${POS}_lemmas -gen_result_file=generated_missing_${POS}_lemmas -ana_result_file=analysed_missing_${POS}_lemmas - -# SKIP if source file does not exist (works with both single and -# multiple files): -if [ ! `ls -1 $source_file 2>/dev/null | wc -l ` -gt 0 ]; then - echo - echo "*** Warning: Source file(s) $source_file not found." - echo - exit 77 -fi - -# Use autotools mechanisms to only run the configured fst types in the tests: -fsttype= -@CAN_HFST_TRUE@fsttype="$fsttype hfst" -@CAN_XFST_TRUE@fsttype="$fsttype xfst" - -# Exit if both hfst and xerox have been shut off: -if test -z "$fsttype" ; then - echo "All transducer types have been shut off at configure time." - echo "Nothing to test. Skipping." - exit 77 -fi - -# Get external Mac editor for viewing failed results from configure: -EXTEDITOR=@SEE@ - -##### Extract lemmas - add additional egrep pattern as parameters: ##### -##### --include "(pattern1|pattern2|...)" ##### -##### --exclude "(pattern1|pattern2|...)" ##### -@GTCORE@/scripts/extract-lemmas.sh \ - --exclude "(NEEDS|INS)" \ - $source_file > $lemmas - -###### Start testing: ####### -transducer_found=0 -Fail=0 - -# The script tests both Xerox and Hfst transducers if available: -for f in $fsttype; do - if [ $f == "xfst" ]; then - lookup_tool="@LOOKUP@ -flags mbTT" - suffix="xfst" - # Does lookup support -q / quiet mode? - lookup_quiet=$($lookup_tool -q 2>&1 | grep USAGES) - if ! [[ $lookup_quiet == *"USAGES"* ]] ; then - # it does support quiet mode, add the -q flag: - lookup_tool="@LOOKUP@ -q -flags mbTT" - fi - elif [ $f == "hfst" ]; then - lookup_tool="@HFST_OPTIMIZED_LOOKUP@ -q" - suffix="hfstol" - else - Fail=1 - printf "ERROR: Unknown fst type! " - echo "$f - FAIL" - continue - fi - if [ -f "$generator_file.$suffix" ]; then - let "transducer_found += 1" - -###### Test non-comopunds: ####### - # generate verbs in infitive, extract the resulting generated lemma, - # store it: - sed 's/$/+V+Sg+Impv/' $lemmas \ - | $lookup_tool $generator_file.$suffix \ - | fgrep -v "+?" | grep -v "^$" | cut -f2 | sort -u \ - > $generated_lemmas.$f.txt - -###### Collect results, and generate debug info if FAIL: ####### - # Sort and compare original input with resulting output - the diff is - # used to generate lemmas which are opened in SEE: - sort -u -o $generated_lemmas.$f.txt $generated_lemmas.$f.txt - comm -23 $lemmas $generated_lemmas.$f.txt > $result_file.$f.txt - - # Open the diff file in SubEthaEdit (if there is a diff): - if [ -s $result_file.$f.txt ]; then - grep -v '^$' $result_file.$f.txt \ - | sed 's/$/+V+Sg+Impv/' \ - | $lookup_tool $generator_file.$suffix \ - > $gen_result_file.$f.txt - # If we have an analyser, analyse the missing lemmas as well: - if test -e $analyser_file.$suffix ; then - grep -v '^$' $result_file.$f.txt \ - | $lookup_tool $analyser_file.$suffix \ - > $ana_result_file.$f.txt - fi - # Only open the failed lemmas in see if @SEE@ is defined: - if [ "$EXTEDITOR" ]; then - $EXTEDITOR $result_file.$f.txt - $EXTEDITOR $gen_result_file.$f.txt - $EXTEDITOR $ana_result_file.$f.txt - else - echo "There were problem lemmas. Details in:" - echo "* $result_file.$f.txt " - echo "* $gen_result_file.$f.txt" - echo "* $ana_result_file.$f.txt" - fi - Fail=1 - echo "$f - FAIL" - continue - fi - echo "$f - PASS" - fi -done - -# At least one of the Xerox or HFST tests failed: -if [ "$Fail" = "1" ]; then - exit 1 -fi - -if [ $transducer_found -eq 0 ]; then - echo ERROR: No transducer found - exit 77 -fi - -# When done, remove the generated data file: -rm -f $lemmas diff --git a/src/fst/morphology/test/phonology/pair-test-hfst.sh.in b/src/fst/morphology/test/phonology/pair-test-hfst.sh.in index b06c25c4..99e7b90d 100644 --- a/src/fst/morphology/test/phonology/pair-test-hfst.sh.in +++ b/src/fst/morphology/test/phonology/pair-test-hfst.sh.in @@ -10,8 +10,8 @@ HTWOLC=@HFST_PAIR_TEST@ GTLANG=@GTLANG@ -SOURCEFILE=${srcdir}/../../../src/fst/phonology.twolc -HFSTFILE=../../../src/fst/phonology.compose.hfst +SOURCEFILE=${srcdir}/../../phonology.twolc +HFSTFILE=../../.generated/phonology.compose.hfst TESTRESULT=pair-test-out.hfst.txt EXTEDITOR=@SEE@ @@ -41,7 +41,7 @@ if test -f ${SOURCEFILE} ; then exit 77 fi else - echo The compiled rule file ${XFSTFILE} was not found + echo The compiled rule file ${HFSTFILE} was not found exit 77 fi else diff --git a/src/fst/orthography/Makefile.am b/src/fst/orthography/Makefile.am index ff46a78a..e69afb74 100644 --- a/src/fst/orthography/Makefile.am +++ b/src/fst/orthography/Makefile.am @@ -2,6 +2,9 @@ ## Copyright: Sámediggi/Divvun/UiT ## Licence: GPL v3+ +# build before test +SUBDIRS=. test + ####### Source file defs: ######## # Set these to names of available orthographic rules in regex and diff --git a/src/fst/orthography/test/run-initcaps-genyaml-testcases.sh b/src/fst/orthography/test/run-initcaps-genyaml-testcases.sh index 490e2257..356847b8 100755 --- a/src/fst/orthography/test/run-initcaps-genyaml-testcases.sh +++ b/src/fst/orthography/test/run-initcaps-genyaml-testcases.sh @@ -21,5 +21,5 @@ yaml_file_subdir=. ####### 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 +testrunner="../../../../test/run-yaml-testcases.sh" +source $testrunner $transducer $yaml_file_subdir ../../../../test/ $halftest diff --git a/src/fst/test/Makefile.am b/src/fst/test/Makefile.am index 2985e695..3deda859 100644 --- a/src/fst/test/Makefile.am +++ b/src/fst/test/Makefile.am @@ -2,8 +2,6 @@ ## Copyright: Sámediggi/Divvun/UiT ## Licence: GPL v3+ -SUBDIRS = phonology orthography morphology syntax - ######## Test targets: ########### # List here (space separated) all test scripts that should be run 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 220f77fd..5ecee130 100755 --- a/src/fst/test/run-dict-gt-desc-anayaml-testcases.sh +++ b/src/fst/test/run-dict-gt-desc-anayaml-testcases.sh @@ -20,5 +20,5 @@ 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="../run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir $halftest +testrunner="../../../test/run-yaml-testcases.sh" +source $testrunner $transducer $yaml_file_subdir ../../../test $halftest 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 9a18a5f1..eb23624a 100755 --- a/src/fst/test/run-dict-gt-norm-genyaml-testcases.sh +++ b/src/fst/test/run-dict-gt-norm-genyaml-testcases.sh @@ -20,5 +20,5 @@ 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="../run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir $halftest +testrunner="../../../test/run-yaml-testcases.sh" +source $testrunner $transducer $yaml_file_subdir ../../../test/ $halftest diff --git a/src/fst/test/run-gt-desc-anayaml-testcases.sh b/src/fst/test/run-gt-desc-anayaml-testcases.sh index 93fbed5b..c3a31c3e 100755 --- a/src/fst/test/run-gt-desc-anayaml-testcases.sh +++ b/src/fst/test/run-gt-desc-anayaml-testcases.sh @@ -20,5 +20,5 @@ 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="../run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir $halftest +testrunner="../../../test/run-yaml-testcases.sh" +source $testrunner $transducer $yaml_file_subdir ../../../test $halftest diff --git a/src/fst/test/run-gt-desc-genyaml-testcases.sh b/src/fst/test/run-gt-desc-genyaml-testcases.sh index 2453f408..799efb1a 100755 --- a/src/fst/test/run-gt-desc-genyaml-testcases.sh +++ b/src/fst/test/run-gt-desc-genyaml-testcases.sh @@ -20,5 +20,5 @@ 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="../run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir $halftest +testrunner="../../../test/run-yaml-testcases.sh" +source $testrunner $transducer $yaml_file_subdir ../../../test $halftest diff --git a/src/fst/test/run-gt-desc-yaml-testcases.sh b/src/fst/test/run-gt-desc-yaml-testcases.sh index 5a5412be..f2a9d9df 100755 --- a/src/fst/test/run-gt-desc-yaml-testcases.sh +++ b/src/fst/test/run-gt-desc-yaml-testcases.sh @@ -20,5 +20,5 @@ 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="../run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir $halftest +testrunner="../../../test/run-yaml-testcases.sh" +source $testrunner $transducer $yaml_file_subdir ../../../test $halftest diff --git a/src/fst/test/run-gt-norm-anayaml-testcases.sh b/src/fst/test/run-gt-norm-anayaml-testcases.sh index 5d860dcb..ffedb400 100755 --- a/src/fst/test/run-gt-norm-anayaml-testcases.sh +++ b/src/fst/test/run-gt-norm-anayaml-testcases.sh @@ -20,5 +20,5 @@ 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="../run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir $halftest +testrunner="../../../test/run-yaml-testcases.sh" +source $testrunner $transducer $yaml_file_subdir ../../../test $halftest diff --git a/src/fst/test/run-gt-norm-genyaml-testcases.sh b/src/fst/test/run-gt-norm-genyaml-testcases.sh index bf9ea31d..d44222e0 100755 --- a/src/fst/test/run-gt-norm-genyaml-testcases.sh +++ b/src/fst/test/run-gt-norm-genyaml-testcases.sh @@ -20,5 +20,5 @@ 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="../run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir $halftest +testrunner="../../../test/run-yaml-testcases.sh" +source $testrunner $transducer $yaml_file_subdir ../../../test $halftest diff --git a/src/fst/test/run-gt-norm-yaml-testcases.sh b/src/fst/test/run-gt-norm-yaml-testcases.sh index be7731f4..3bb20e8b 100755 --- a/src/fst/test/run-gt-norm-yaml-testcases.sh +++ b/src/fst/test/run-gt-norm-yaml-testcases.sh @@ -20,5 +20,5 @@ 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="../run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir $halftest +testrunner="../../../test/run-yaml-testcases.sh" +source $testrunner $transducer $yaml_file_subdir ../../../test $halftest diff --git a/src/fst/test/run-lexc-testcases.sh b/src/fst/test/run-lexc-testcases.sh index e4d7e74a..394c80bf 100755 --- a/src/fst/test/run-lexc-testcases.sh +++ b/src/fst/test/run-lexc-testcases.sh @@ -12,7 +12,7 @@ Skipped=no testtype=full concat_lexc_file="lexicon.lexc" -relpath=. +relpath=../../../test/ testrunner=run-morph-tester.sh while test ! -x $relpath/$testrunner ; do @@ -25,8 +25,8 @@ while test ! -x $relpath/$testrunner ; do done # Get list of source files: -source_files="$(find ${srcdir}/$relpath/../src/fst/morphology -name '*.lexc' \ - -not -name '$concat_lexc_file')" +source_files="$(find ${srcdir}/../ -name '*.lexc' \ + -not -name "$concat_lexc_file")" # One empty line in the beginning: echo "" @@ -70,7 +70,7 @@ for file in ${source_files}; do # Empty line before each new fst: echo leadtext=$(echo "LEXC test $i: ") - + # Check for possible one-sided tests (default is two-sided/full): if [[ "$fst" == *.gen ]]; then testtype="gen" @@ -79,10 +79,10 @@ for file in ${source_files}; do testtype="ana" fst=$(basename $fst .ana) fi - + # Run the actual tests for the given fst: source $relpath/run-morph-tester.sh \ - $fst $file $relpath $testtype all $leadtext + $fst $file $relpath $testtype ../../../test all $leadtext # echo "The $fst testing is done using $testtype testing." # debug # Reset testtype to default: diff --git a/test/Makefile.am b/test/Makefile.am index 7de569e7..aafe8739 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,4 +2,3 @@ ## Copyright: Sámediggi/Divvun/UiT ## Licence: GPL v3+ -SUBDIRS = src tools diff --git a/test/run-morph-tester.sh.in b/test/run-morph-tester.sh.in index aae0dfc5..39aeb9ab 100755 --- a/test/run-morph-tester.sh.in +++ b/test/run-morph-tester.sh.in @@ -62,13 +62,14 @@ abs_srcdir=$(cd $srcdir && pwd) # remaining intervening dirs equals the path to the fst dir as long as the # directory structure within $GTLANG/test/ mirrors the structure of the other # directories - this mirroring thus becomes imperative for the yaml testing: -fstdir=${abs_srcdir:${#roottestdir}:${#roottestdir}}/fst/ +#fstdir=${abs_srcdir:${#roottestdir}:${#roottestdir}}/fst/ +fstdir=${abs_srcdir%/test} # The analyser files are built $relpath relative to the test dir, one further # dir up, and then in the identified fst dir (see above): -analyserfile=./$relpath/../$fstdir/analyser-$transducer -generatorfile=./$relpath/../$fstdir/generator-$transducer -bare_fst_file=./$relpath/../$fstdir/$transducer +analyserfile=$fstdir/analyser-$transducer +generatorfile=$fstdir/generator-$transducer +bare_fst_file=$fstdir/$transducer pythonbin=@PYTHON@ runtests="$pythonbin @GTCORE@/scripts/morph-test.py" testtotalsfile=testtotals.tmp.txt @@ -210,6 +211,7 @@ for f in $fsttype; do # First check for analysis tests only: if test "$halftest" == "ana" ; then for suff in $fstsuffix; do + echo debug trying $analyserfile.$suff if test -f "$analyserfile.$suff"; then analyser=$analyserfile.$suff let "transducer_found += 1" @@ -229,6 +231,8 @@ for f in $fsttype; do elif test "$halftest" == "gen" ; then for suff in $fstsuffix; do # Regular word form generation tests: + echo debug trying $generatorfile.$suff + echo maybe $bare_fst_file.lookup.$suff if test -f "$generatorfile.$suff"; then generator=$generatorfile.$suff let "transducer_found += 1" @@ -255,6 +259,7 @@ for f in $fsttype; do # Then check for speller acceptor tests: elif test "$halftest" == "speller" ; then for suff in $fstsuffix; do + echo debug trying $bare_fst_file.$suff if test -f "$bare_fst_file.$suff"; then analyser=$bare_fst_file.$suff let "transducer_found += 1" @@ -271,6 +276,7 @@ for f in $fsttype; do # Finally check the full analysis + generation tests: elif test "$halftest" == "full" ; then for suff in $fstsuffix; do + echo debug trying $analyserfile.$suff and $generatorfile.$suff if test -f "$analyserfile.$suff" \ -a -f "$generatorfile.$suff"; then analyser=$analyserfile.$suff diff --git a/test/run-yaml-testcases.sh.in b/test/run-yaml-testcases.sh.in index 5eb4a456..4a480889 100755 --- a/test/run-yaml-testcases.sh.in +++ b/test/run-yaml-testcases.sh.in @@ -27,6 +27,7 @@ if ! test $# -ge 2 ; then echo " dir). This makes it possible to move all yaml files" echo " out of the test dir, making for a much cleaner" echo " directory." + echo " SCRIPTDIR directory of yaml runner stuff" echo " [HALFTEST] (optional) is one of the strings 'ana' or 'gen'," echo " indicating that the test runs should only run" echo " the analyser or generator tests respectively." @@ -37,7 +38,9 @@ fi ###### Variables: ####### transducer=$1 yaml_file_subdir=$2 -halftest=$3 +testerpath=$3 +halftest=$4 + Fail=0 testtotalsfile=testtotals.tmp.txt @@ -48,10 +51,11 @@ if test "x$yaml_file_subdir" = "x" ; then yaml_file_subdir=. fi -relpath=. +# relpath=$(cd -P "$(dirname "$0")" && pwd) testrunner=run-morph-tester.sh +relpath=. -while test ! -x $relpath/$testrunner ; do +while test ! -x $testerpath/$testrunner ; do relpath="$relpath/.." # echo relpath: $relpath # debug if test "$(cd $relpath && pwd)" = "/" ; then @@ -109,8 +113,8 @@ i=0 for file in $testfiles; do (( i += 1 )) leadtext=$(echo "YAML test $i: ") - source ./$relpath/run-morph-tester.sh \ - $transducer $file $relpath $halftest all $leadtext + source $testerpath/run-morph-tester.sh \ + $transducer $file $testerpath $halftest all $leadtext done # Machinery to be able to handle yaml tests for specific fst technologies: @@ -174,8 +178,8 @@ for file in ${filepattern[@]}; do fi (( i += 1 )) leadtext=$(echo "YAML test $i: ") - source ./$relpath/run-morph-tester.sh \ - $transducer $file $relpath $halftest specified $leadtext + source $testerpath/run-morph-tester.sh \ + $transducer $file $testerpath $halftest specified $leadtext done totalpasses=$( echo $( cat $testtotalsfile | tr ' ' '\n' | cut -d'/' -f1 \ @@ -204,4 +208,4 @@ printf "${green}PASSES: ${totalpasses}${reset} / " printf "${red}FAILS: ${totalfails}${reset} / " printf "${blue}TOTAL: ${totaltotals}${reset}\n" -source $srcdir/$relpath/error-handling-stubs.sh +source $testerpath/error-handling-stubs.sh diff --git a/tools/hyphenators/Makefile.am b/tools/hyphenators/Makefile.am index 2f7bf0a9..1d99a440 100644 --- a/tools/hyphenators/Makefile.am +++ b/tools/hyphenators/Makefile.am @@ -31,7 +31,7 @@ ########################################## # Subdirs: -SUBDIRS = filters . +SUBDIRS = filters . test #### Do NOT edit below here: #### diff --git a/tools/mt/apertium/Makefile.am b/tools/mt/apertium/Makefile.am index cb54f630..1e6156a4 100644 --- a/tools/mt/apertium/Makefile.am +++ b/tools/mt/apertium/Makefile.am @@ -31,7 +31,7 @@ ########################################## # Subdirs: -SUBDIRS = filters tagsets . +SUBDIRS = filters tagsets . test ########################################## # Variable declarations: 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 b01b613a..ccdc83a2 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 @@ -21,5 +21,5 @@ yaml_file_subdir=. ####### 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 +testrunner="../../../../test/run-yaml-testcases.sh" +source $testrunner $transducer $yaml_file_subdir ../../../../test $halftest diff --git a/tools/spellcheckers/Makefile.am b/tools/spellcheckers/Makefile.am index b4fd8c6b..9c3c726e 100644 --- a/tools/spellcheckers/Makefile.am +++ b/tools/spellcheckers/Makefile.am @@ -3,7 +3,7 @@ ## Licence: GPL v3+ # Subdirs in build order: -SUBDIRS = filters weights neural . +SUBDIRS = filters weights neural . test include $(srcdir)/Makefile.mod-spellcheckers.am include $(srcdir)/Makefile.mod-fstbased.am 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 f1903d57..d8dfa589 100755 --- a/tools/spellcheckers/test/run-spellers-gt-norm-yaml-testcases.sh +++ b/tools/spellcheckers/test/run-spellers-gt-norm-yaml-testcases.sh @@ -21,5 +21,5 @@ 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="../../run-yaml-testcases.sh" -source $testrunner $transducer $yaml_file_subdir $halftest +testrunner="../../../test/run-yaml-testcases.sh" +source $testrunner $transducer $yaml_file_subdir ../../../test $halftest