-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add coverage test which compares current version of tat-morph to eith…
…er HEAD (if apertium-tat was changed locally) or HEAD~1 (ifotherwise (read: on travis))
- Loading branch information
1 parent
604aa33
commit 6dbcb19
Showing
4 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
http://www.corpus.tatar/stat/tatcorpus3.words_frequency_case-sensitive.bz2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
|
||
## Test current coverage of tat-morph on frequency list and compare it | ||
## to coverage of last version of tat-morph. Return success if the | ||
## coverage hasn't decreased, fail otherwise. | ||
## | ||
## By `last version' we mean: | ||
## - HEAD if apertium-tat.git repo has local changes | ||
## - HEAD~1 if it doesn't (when testing via `make check' is done on travis) | ||
## | ||
## Frequency list is a tsv file, first two fields of which are: | ||
## - frequency | ||
## - wordform | ||
## | ||
## Frequency list is not tracked in the repository. It is fetched from a URL | ||
## given in the frequency_list.url.txt file. | ||
|
||
if [ ! -f frequency_list.tsv ]; then | ||
wget -i frequency_list.url.txt -O frequency_list.tsv.bz2 | ||
bzip2 -dk frequency_list.tsv.bz2 | ||
fi | ||
|
||
FREQ_LIST=$(realpath frequency_list.tsv) | ||
|
||
LAST=$(mktemp -d /tmp/XXXXX) | ||
|
||
cp -r ../../ ${LAST} | ||
|
||
pushd ${LAST} | ||
|
||
git diff-index --quiet HEAD -- | ||
if [ $? -eq 0 ]; then | ||
git reset --hard HEAD~1 | ||
else | ||
git reset --hard HEAD | ||
fi | ||
|
||
popd | ||
|
||
unrecognized () { | ||
## monolingpackagedir textfile -> number | ||
pushd $1 > /tmp/log 2>&1 | ||
./autogen.sh >> /tmp/log 2>&1 | ||
make clean >> /tmp/log 2>&1 | ||
make >> /tmp/log 2>&1 | ||
cat $2 | apertium -d . tat-morph | grep -c "*" | ||
popd >> /tmp/log 2>&1 | ||
} | ||
|
||
if [ $(unrecognized ../../ ${FREQ_LIST}) -le $(unrecognized ${LAST} ${FREQ_LIST}) ]; then | ||
printf "Success!\n" | ||
exit 0 | ||
else | ||
printf "Fail!\n" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
alltestspass=true | ||
|
||
cd morphophonology/; python3 test.py tat | ||
if [ $? -ne 0 ] ; then | ||
alltestspass=false | ||
fi | ||
|
||
cd ../coverage/; bash test.bash | ||
if [ $? -ne 0 ] ; then | ||
alltestspass=false | ||
fi | ||
|
||
if [ $alltestspass = "true" ] ; then | ||
exit 0 | ||
else | ||
exit 1 | ||
fi |