OLD | NEW |
| (Empty) |
1 #!/bin/bash | |
2 | |
3 # Libhnj is dual licensed under LGPL and MPL. Boilerplate for both | |
4 # licenses follows. | |
5 | |
6 # LibHnj - a library for high quality hyphenation and justification | |
7 # Copyright (C) 1998 Raph Levien, | |
8 # (C) 2001 ALTLinux, Moscow (http://www.alt-linux.org), | |
9 # (C) 2001 Peter Novodvorsky (nidd@cs.msu.su) | |
10 # (C) 2006, 2007, 2008, 2010 László Németh (nemeth at OOo) | |
11 # | |
12 # This library is free software; you can redistribute it and/or | |
13 # modify it under the terms of the GNU Library General Public | |
14 # License as published by the Free Software Foundation; either | |
15 # version 2 of the License, or (at your option) any later version. | |
16 # | |
17 # This library is distributed in the hope that it will be useful, | |
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 # Library General Public License for more details. | |
21 # | |
22 # You should have received a copy of the GNU Library General Public | |
23 # License along with this library; if not, write to the | |
24 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 # Boston, MA 02111-1307 USA. | |
26 | |
27 # The contents of this file are subject to the Mozilla Public License | |
28 # Version 1.0 (the "MPL"); you may not use this file except in | |
29 # compliance with the MPL. You may obtain a copy of the MPL at | |
30 # http://www.mozilla.org/MPL/ | |
31 # | |
32 # Software distributed under the MPL is distributed on an "AS IS" basis, | |
33 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL | |
34 # for the specific language governing rights and limitations under the | |
35 # MPL. | |
36 | |
37 function check_valgrind_log () { | |
38 if [ "$VALGRIND" != "" ]; then | |
39 if [ -f $TEMPDIR/test.pid* ]; then | |
40 log=`ls $TEMPDIR/test.pid*` | |
41 if ! grep -q 'ERROR SUMMARY: 0 error' $log; then | |
42 echo "Fail in $NAME $1 checking detected by Valgrind" | |
43 echo "$log Valgrind log file moved to $TEMPDIR/badlogs" | |
44 mv $log $TEMPDIR/badlogs | |
45 exit 1 | |
46 fi | |
47 if grep -q 'LEAK SUMMARY' $log; then | |
48 echo "Memory leak in $NAME $1 checking detected by Valgrind" | |
49 echo "$log Valgrind log file moved to $TEMPDIR/badlogs" | |
50 mv $log $TEMPDIR/badlogs | |
51 exit 1 | |
52 fi | |
53 rm -f $log | |
54 fi | |
55 fi | |
56 } | |
57 | |
58 if [ -d ../../_build/../tests ]; then | |
59 TESTDIR="../../tests" | |
60 else | |
61 TESTDIR="." | |
62 fi | |
63 | |
64 TEMPDIR="./testSubDir" | |
65 NAME="$1" | |
66 | |
67 if [ ! -d $TEMPDIR ]; then | |
68 mkdir $TEMPDIR | |
69 fi | |
70 | |
71 shopt -s expand_aliases | |
72 | |
73 alias example='../libtool --mode=execute -dlopen ../.libs/libhyphen*.la ../examp
le' | |
74 | |
75 if [ "$VALGRIND" != "" ]; then | |
76 rm -f $TEMPDIR/test.pid* | |
77 if [ ! -d $TEMPDIR/badlogs ]; then | |
78 mkdir $TEMPDIR/badlogs | |
79 fi | |
80 if [ ! -f ../.libs/lt-example ]; then | |
81 echo "Use make check before Valgrind tests" | |
82 else | |
83 alias example='../libtool --mode=execute -dlopen ../.libs/libhyphen*.la valgri
nd --tool=$VALGRIND --leak-check=yes --show-reachable=yes --log-file=$TEMPDIR/te
st.pid ../example' | |
84 fi | |
85 fi | |
86 | |
87 example $TESTDIR/$1 $TESTDIR/$2 >$TEMPDIR/test.out$$ | |
88 diff $TEMPDIR/test.out$$ $TESTDIR/$3 || exit 1 | |
89 #diff $TEMPDIR/test.out$$ $TESTDIR/$3 && rm -f $TEMPDIR/*$$ || exit 1 | |
90 | |
91 check_valgrind_log "VALGRIND LOG" | |
OLD | NEW |