blob: 89a688bf016fb154d95a040fa3e675fc2c8faf24 (
plain)
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
|
#!/bin/bash
function check_valgrind_log () {
if [ "$VALGRIND" != "" ]; then
if [ -f $TEMPDIR/test.pid* ]; then
log=`ls $TEMPDIR/test.pid*`
if ! grep -q 'ERROR SUMMARY: 0 error' $log; then
echo "Fail in $NAME $1 checking detected by Valgrind"
echo "$log Valgrind log file moved to $TEMPDIR/badlogs"
mv $log $TEMPDIR/badlogs
exit 1
fi
if grep -q 'LEAK SUMMARY' $log; then
echo "Memory leak in $NAME $1 checking detected by Valgrind"
echo "$log Valgrind log file moved to $TEMPDIR/badlogs"
mv $log $TEMPDIR/badlogs
exit 1
fi
rm -f $log
fi
fi
}
if [ -d ../../_build/../tests ]; then
TESTDIR="../../tests"
else
TESTDIR="."
fi
TEMPDIR="./testSubDir"
NAME="$1"
if [ ! -d $TEMPDIR ]; then
mkdir $TEMPDIR
fi
shopt -s expand_aliases
alias example='../libtool --mode=execute -dlopen ../.libs/libhyphen*.la ../example'
if [ "$VALGRIND" != "" ]; then
rm -f $TEMPDIR/test.pid*
if [ ! -d $TEMPDIR/badlogs ]; then
mkdir $TEMPDIR/badlogs
fi
if [ ! -f ../.libs/lt-example ]; then
echo "Use make check before Valgrind tests"
else
alias example='../libtool --mode=execute -dlopen ../.libs/libhyphen*.la valgrind --tool=$VALGRIND --leak-check=yes --show-reachable=yes --log-file=$TEMPDIR/test.pid ../example'
fi
fi
example $TESTDIR/$1 $TESTDIR/$2 >$TEMPDIR/test.out$$
diff $TEMPDIR/test.out$$ $TESTDIR/$3 || exit 1
#diff $TEMPDIR/test.out$$ $TESTDIR/$3 && rm -f $TEMPDIR/*$$ || exit 1
check_valgrind_log "VALGRIND LOG"
|