File: outstanding-tests.sh

package info (click to toggle)
apertium-eo-ca 1%3A0.9.1~r60655-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,188 kB
  • sloc: sh: 125; makefile: 106; perl: 105; xml: 71
file content (79 lines) | stat: -rwxr-xr-x 1,896 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash

TESTNAME=Outstanding_tests

NODOWNLOAD=$1
#TEMPDIR=/tmp/testcache # `mktemp -d`;
TEMPDIR=testcache
DATADIR=`pwd`;

sudo cp *.mode modes/

#[ $NODOWNLOAD =="" ] || echo "Downloading test set $TESTNAME"
#[ $NODOWNLOAD =="" ] && echo "NOT Downloading test set $TESTNAME"

unset LC_ALL
mkdir -p $TEMPDIR
cd $TEMPDIR;

REGEN=1

if [ "$NODOWNLOAD" == "" ]; then
	REGEN=1
	LANG=ca wget -N http://wiki.apertium.org/wiki/Catalan_and_Esperanto/$TESTNAME 2>&1 | cat > wgetlog.txt
        grep "Saving to:" wgetlog.txt || REGEN=0 && echo $TESTNAME not changed on webserver
else
	echo "NOT Downloading test set $TESTNAME"
fi


DIRS=`grep '<li>' $TESTNAME | cut -f2 -d'(' | cut -f1 -d')' | uniq`

if [ "$REGEN" == "1" ]; then
	rm -f test_*
	echo "Preparing (shouldn't be necessary if $TESTNAME not changed on webserver)"

LIST=`grep '<li>' $TESTNAME | sed 's/<.*li>//g' | sed -r 's/\s+/_/g'`;

for LINE in $LIST; do
	dir=`echo $LINE | cut -f2 -d'(' | cut -f1 -d')'`;

	#echo $LINE;
	#echo $dir;

	SL=`echo $LINE | cut -f2 -d')' | sed 's/<i>//g' | sed 's/<\/i>//g' | sed 's/→/@/g' | cut -f1 -d'@' | sed 's/(note:/@/g' | sed 's/_/ /g'`;
	TL=`echo $LINE | sed 's/(\w\w)//g' | sed 's/<i>//g' | sed 's/<\/i>_→/@/g' | cut -f2 -d'@' | sed 's/_/ /g'`;

	echo $SL >> test_SL_$dir
	echo $TL >> test_TL_$dir
done
fi



for dir in $DIRS; do
	if [ $dir = "ca" ]; then
		mode="ca-eo";
	else 
		mode="eo-ca";
	fi

	echo "Translating using  apertium -d $DATADIR $mode"

 	cat test_SL_$dir | nl -s ' : ' > testtmp
#echo "test_SL_$dir, testtmp = $testtmp"
	cat testtmp | apertium -d $DATADIR $mode > testres
#cat testres
#exit 0;

	cat test_TL_$dir | nl -s ' : ' | diff -wi - testres | grep -r '[<>]' >> testtmp

	FAIL=`grep "^<" testtmp |  cut -c2-8`; 
#	if [[ "$FAIL"!="" ]]; then
#		echo "< correct      > actual"
#	else
#		echo "All tests passed."
#	fi
	for i in $FAIL; do grep " $i : " testtmp; done

done