Skip to content

Commit f846555

Browse files
committed
[Template merge] move tag_test.sh to core
1 parent 9ddc1e2 commit f846555

File tree

2 files changed

+19
-40
lines changed

2 files changed

+19
-40
lines changed

m4/giella-macros.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ AC_MSG_RESULT([$GIELLA_CORE])
8888
###############################################################
8989
### This is the version of the Giella Core that we require. ###
9090
### UPDATE AS NEEDED.
91-
_giella_core_min_version=1.0.2
91+
_giella_core_min_version=1.0.4
9292
9393
# GIELLA_CORE/GTCORE env. variable, required by the infrastructure to find scripts:
9494
AC_ARG_VAR([GIELLA_CORE], [directory for the Giella infra core scripts and other required resources])

src/fst/morphology/test/tag_test.sh

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,23 @@
11
#!/bin/bash
22

3-
# Check if there are tags which are not declared in root.lexc or if
4-
# tags are misspelled.
5-
#
6-
# Exit with 0 if and only if all tests pass.
7-
#
8-
# Run with -v to be a bit more verbose.
9-
10-
lexctags=$(mktemp -t giella-tag_test.XXXXXXXXXXX)
11-
roottags=$(mktemp -t giella-tag_test.XXXXXXXXXXX)
12-
trap 'rm -f "${lexctags}" "${roottags}"' EXIT
13-
14-
# Get giella-core from the test environment:
15-
giella_core=$GIELLA_CORE
16-
17-
# If verbose:
18-
if [[ $1 == "-v" ]]; then
19-
echo "$0: Are there tags not declared in root.lexc or misspelled?"
3+
# ensure that we are ran from make or setup properly
4+
if test -z "$srcdir" ; then
5+
echo "srcdir= not set, this must be run from make or set srcdir=."
6+
exit 2
207
fi
21-
22-
# Extract USED tags:
23-
sed -e '1,/LEXICON Root/d' < \
24-
../lexicon.lexc | # Extract all lines after LEXICON Root
25-
${giella_core}/scripts/extract-used-tags.sh | # Extract tags, local mods after this line:
26-
LC_ALL=no_NO.UTF8 sort -u \
27-
> "${lexctags}"
28-
29-
# Extract DEFINED tags:
30-
sed -n '/LEXICON Root/q;p' \
31-
../lexicon.lexc | # Extract all lines before LEXICON Root
32-
${giella_core}/scripts/extract-defined-tags.sh | # Extract tags, local mods after this line:
33-
LC_ALL=no_NO.UTF8 sort -u \
34-
> "${roottags}"
35-
36-
# Compare the two sets of tags, report and fail if there is a diff:
37-
check=$(LC_ALL=no_NO.UTF8 comm -23 "${lexctags}" "${roottags}")
38-
if [[ -n "${check}" ]]; then
39-
echo "$0: Have a look at these:"
40-
echo "${check}"
8+
if test -z "$GIELLA_CORE" ; then
9+
echo "GIELLA_CORE= must point to giella-core"
10+
exit 2
11+
fi
12+
relpath="$GIELLA_CORE/scripts/"
13+
testrunner="$relpath/tag_test.sh"
14+
if ! test -x "$testrunner" ; then
15+
echo "missing test runner in $testrunner"
16+
exit 77
17+
fi
18+
lexc=$srcdir/../lexicon.lexc
19+
if ! test -f $lexc ; then
20+
echo combined $lexc missing or disappeared
4121
exit 1
42-
elif [[ $1 == "-v" ]]; then
43-
echo "$0: No errors found."
4422
fi
23+
$testrunner $lexc

0 commit comments

Comments
 (0)