Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: third_party/hunspell_new/tests/test.sh

Issue 1135173004: Rename third_party/hunspell_new back to third_party/hunspell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/hunspell_new/tests/sugutf.wrong ('k') | third_party/hunspell_new/tests/utf8.aff » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2 export LC_ALL="C"
3
4 function check_valgrind_log () {
5 if [ "$VALGRIND" != "" ]; then
6 if [ -f $TEMPDIR/test.pid* ]; then
7 log=`ls $TEMPDIR/test.pid*`
8 if ! grep -q 'ERROR SUMMARY: 0 error' $log; then
9 echo "Fail in $NAME $1 checking detected by Valgrind"
10 echo "$log Valgrind log file moved to $TEMPDIR/badlogs"
11 mv $log $TEMPDIR/badlogs
12 exit 1
13 fi
14 if grep -q 'LEAK SUMMARY' $log; then
15 echo "Memory leak in $NAME $1 checking detected by Valgrind"
16 echo "$log Valgrind log file moved to $TEMPDIR/badlogs"
17 mv $log $TEMPDIR/badlogs
18 exit 1
19 fi
20 rm -f $log
21 fi
22 fi
23 }
24
25 TESTDIR=.
26 TEMPDIR=$TESTDIR/testSubDir
27 NAME="$1"
28 shift
29
30 if [ ! -d $TEMPDIR ]; then
31 mkdir $TEMPDIR
32 fi
33
34 shopt -s expand_aliases
35
36 alias hunspell='../libtool --mode=execute -dlopen ../src/hunspell/.libs/libhunsp ell*.la ../src/tools/hunspell'
37 alias analyze='../libtool --mode=execute -dlopen ../src/hunspell/.libs/libhunspe ll*.la ../src/tools/analyze'
38
39 if [ "$VALGRIND" != "" ]; then
40 rm -f $TEMPDIR/test.pid*
41 if [ ! -d $TEMPDIR/badlogs ]; then
42 mkdir $TEMPDIR/badlogs
43 fi
44
45 alias hunspell='../libtool --mode=execute -dlopen ../src/hunspell/.libs/libhun spell*.la valgrind --tool=$VALGRIND --leak-check=yes --show-reachable=yes --log- file=$TEMPDIR/test.pid ../src/tools/hunspell'
46 alias analyze='../libtool --mode=execute -dlopen ../src/hunspell/.libs/libhuns pell*.la valgrind --tool=$VALGRIND --leak-check=yes --show-reachable=yes --log-f ile=$TEMPDIR/test.pid ../src/tools/analyze'
47 fi
48
49 # Tests good words
50 if test -f $TESTDIR/$NAME.good; then
51 hunspell -l $* -d $TESTDIR/$NAME <$TESTDIR/$NAME.good >$TEMPDIR/$NAME.good
52 if test -s $TEMPDIR/$NAME.good; then
53 echo "============================================="
54 echo "Fail in $NAME.good. Good words recognised as wrong:"
55 cat $TEMPDIR/$NAME.good
56 rm -f $TEMPDIR/$NAME.good
57 exit 1
58 fi
59 rm -f $TEMPDIR/$NAME.good
60 fi
61
62 check_valgrind_log "good words"
63
64 # Tests bad words
65 if test -f $TESTDIR/$NAME.wrong; then
66 hunspell -l $* -d $TESTDIR/$NAME <$TESTDIR/$NAME.wrong >$TEMPDIR/$NAME.wrong
67 tr -d ' ' <$TESTDIR/$NAME.wrong >$TEMPDIR/$NAME.wrong.detab
68 if ! cmp $TEMPDIR/$NAME.wrong $TEMPDIR/$NAME.wrong.detab >/dev/null; then
69 echo "============================================="
70 echo "Fail in $NAME.wrong. Bad words recognised as good:"
71 tr -d ' ' <$TESTDIR/$NAME.wrong >$TEMPDIR/$NAME.wrong.detab
72 diff $TEMPDIR/$NAME.wrong.detab $TEMPDIR/$NAME.wrong | grep '^<' | sed ' s/^..//'
73 rm -f $TEMPDIR/$NAME.wrong $TEMPDIR/$NAME.wrong.detab
74 exit 1
75 fi
76 rm -f $TEMPDIR/$NAME.wrong $TEMPDIR/$NAME.wrong.detab
77 fi
78
79 check_valgrind_log "bad words"
80
81 # Tests morphological analysis
82 if test -f $TESTDIR/$NAME.morph; then
83 sed 's/ $//' $TESTDIR/$NAME.good >$TEMPDIR/$NAME.good
84 analyze $TESTDIR/$NAME.aff $TESTDIR/$NAME.dic $TEMPDIR/$NAME.good >$TEMPDIR/ $NAME.morph
85 if ! cmp $TEMPDIR/$NAME.morph $TESTDIR/$NAME.morph >/dev/null; then
86 echo "============================================="
87 echo "Fail in $NAME.morph. Bad analysis?"
88 diff $TESTDIR/$NAME.morph $TEMPDIR/$NAME.morph | grep '^<' | sed 's/^../ /'
89 rm -f $TEMPDIR/$NAME.morph
90 exit 1
91 fi
92 rm -f $TEMPDIR/$NAME.{morph,good}
93 fi
94
95 check_valgrind_log "morphological analysis"
96
97 # Tests suggestions
98 if test -f $TESTDIR/$NAME.sug; then
99 hunspell $* -a -d $TESTDIR/$NAME <$TESTDIR/$NAME.wrong | grep '^&' | \
100 sed 's/^[^:]*: //' >$TEMPDIR/$NAME.sug
101 if ! cmp $TEMPDIR/$NAME.sug $TESTDIR/$NAME.sug >/dev/null; then
102 echo "============================================="
103 echo "Fail in $NAME.sug. Bad suggestion?"
104 diff $TESTDIR/$NAME.sug $TEMPDIR/$NAME.sug
105 rm -f $TEMPDIR/$NAME.sug
106 exit 1
107 fi
108 rm -f $TEMPDIR/$NAME.sug
109 fi
110
111 check_valgrind_log "suggestion"
OLDNEW
« no previous file with comments | « third_party/hunspell_new/tests/sugutf.wrong ('k') | third_party/hunspell_new/tests/utf8.aff » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698