diff --git a/m4/giella-macros.m4 b/m4/giella-macros.m4 index db8ea708..a439cec9 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=1.0.2 +_giella_core_min_version=1.0.4 # 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]) diff --git a/src/fst/morphology/test/tag_test.sh b/src/fst/morphology/test/tag_test.sh index b1c41930..69126b9c 100755 --- a/src/fst/morphology/test/tag_test.sh +++ b/src/fst/morphology/test/tag_test.sh @@ -1,45 +1,25 @@ #!/bin/bash -# Check if there are tags which are not declared in root.lexc or if -# tags are misspelled. -# -# Exit with 0 if and only if all tests pass. -# -# Run with -v to be a bit more verbose. +# FIXME: exclude grep -v -E '(\+Enter|\+F[1-9])' | # Remove tag like entries found only in EST -lexctags=$(mktemp -t giella-tag_test.XXXXXXXXXXX) -roottags=$(mktemp -t giella-tag_test.XXXXXXXXXXX) -trap 'rm -f "${lexctags}" "${roottags}"' EXIT - -# Get giella-core from the test environment: -giella_core=$GIELLA_CORE - -# If verbose: -if [[ $1 == "-v" ]]; then - echo "$0: Are there tags not declared in root.lexc or misspelled?" +# 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 - -# Extract USED tags: -sed -e '1,/LEXICON Root/d' < \ - ../lexicon.lexc | # Extract all lines after LEXICON Root - ${giella_core}/scripts/extract-used-tags.sh | # Extract tags, local mods after this line: - grep -v -E '(\+Enter|\+F[1-9])' | # Remove tag like entries found only in EST - LC_ALL=no_NO.UTF8 sort -u \ - > "${lexctags}" - -# Extract DEFINED tags: -sed -n '/LEXICON Root/q;p' \ - ../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}" - -# Compare the two sets of tags, report and fail if there is a diff: -check=$(LC_ALL=no_NO.UTF8 comm -23 "${lexctags}" "${roottags}") -if [[ -n "${check}" ]]; then - echo "$0: Have a look at these:" - echo "${check}" +if test -z "$GIELLA_CORE" ; then + echo "GIELLA_CORE= must point to giella-core" + exit 2 +fi +relpath="$GIELLA_CORE/scripts/" +testrunner="$relpath/tag_test.sh" +if ! test -x "$testrunner" ; then + echo "missing test runner in $testrunner" + exit 77 +fi +lexc=$srcdir/../lexicon.lexc +if ! test -f $lexc ; then + echo combined $lexc missing or disappeared exit 1 -elif [[ $1 == "-v" ]]; then - echo "$0: No errors found." fi +$testrunner $lexc diff --git a/src/fst/morphology/test/tag_test.sh.orig b/src/fst/morphology/test/tag_test.sh.orig new file mode 100755 index 00000000..b1c41930 --- /dev/null +++ b/src/fst/morphology/test/tag_test.sh.orig @@ -0,0 +1,45 @@ +#!/bin/bash + +# Check if there are tags which are not declared in root.lexc or if +# tags are misspelled. +# +# Exit with 0 if and only if all tests pass. +# +# Run with -v to be a bit more verbose. + +lexctags=$(mktemp -t giella-tag_test.XXXXXXXXXXX) +roottags=$(mktemp -t giella-tag_test.XXXXXXXXXXX) +trap 'rm -f "${lexctags}" "${roottags}"' EXIT + +# Get giella-core from the test environment: +giella_core=$GIELLA_CORE + +# If verbose: +if [[ $1 == "-v" ]]; then + echo "$0: Are there tags not declared in root.lexc or misspelled?" +fi + +# Extract USED tags: +sed -e '1,/LEXICON Root/d' < \ + ../lexicon.lexc | # Extract all lines after LEXICON Root + ${giella_core}/scripts/extract-used-tags.sh | # Extract tags, local mods after this line: + grep -v -E '(\+Enter|\+F[1-9])' | # Remove tag like entries found only in EST + LC_ALL=no_NO.UTF8 sort -u \ + > "${lexctags}" + +# Extract DEFINED tags: +sed -n '/LEXICON Root/q;p' \ + ../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}" + +# Compare the two sets of tags, report and fail if there is a diff: +check=$(LC_ALL=no_NO.UTF8 comm -23 "${lexctags}" "${roottags}") +if [[ -n "${check}" ]]; then + echo "$0: Have a look at these:" + echo "${check}" + exit 1 +elif [[ $1 == "-v" ]]; then + echo "$0: No errors found." +fi diff --git a/src/fst/morphology/test/tag_test.sh.rej b/src/fst/morphology/test/tag_test.sh.rej new file mode 100644 index 00000000..965a0208 --- /dev/null +++ b/src/fst/morphology/test/tag_test.sh.rej @@ -0,0 +1,65 @@ +--- src/fst/morphology/test/tag_test.sh ++++ src/fst/morphology/test/tag_test.sh +@@ -1,44 +1,23 @@ + #!/bin/bash + +-# Check if there are tags which are not declared in root.lexc or if +-# tags are misspelled. +-# +-# Exit with 0 if and only if all tests pass. +-# +-# Run with -v to be a bit more verbose. +- +-lexctags=$(mktemp -t giella-tag_test.XXXXXXXXXXX) +-roottags=$(mktemp -t giella-tag_test.XXXXXXXXXXX) +-trap 'rm -f "${lexctags}" "${roottags}"' EXIT +- +-# Get giella-core from the test environment: +-giella_core=$GIELLA_CORE +- +-# If verbose: +-if [[ $1 == "-v" ]]; then +- echo "$0: Are there tags not declared in root.lexc or misspelled?" ++# 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 +- +-# Extract USED tags: +-sed -e '1,/LEXICON Root/d' < \ +- ../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' \ +- ../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}" +- +-# Compare the two sets of tags, report and fail if there is a diff: +-check=$(LC_ALL=no_NO.UTF8 comm -23 "${lexctags}" "${roottags}") +-if [[ -n "${check}" ]]; then +- echo "$0: Have a look at these:" +- echo "${check}" ++if test -z "$GIELLA_CORE" ; then ++ echo "GIELLA_CORE= must point to giella-core" ++ exit 2 ++fi ++relpath="$GIELLA_CORE/scripts/" ++testrunner="$relpath/tag_test.sh" ++if ! test -x "$testrunner" ; then ++ echo "missing test runner in $testrunner" ++ exit 77 ++fi ++lexc=$srcdir/../lexicon.lexc ++if ! test -f $lexc ; then ++ echo combined $lexc missing or disappeared + exit 1 +-elif [[ $1 == "-v" ]]; then +- echo "$0: No errors found." + fi ++$testrunner $lexc