comparison libtests/run-tests.sh @ 497:9d8aee621afb api-inversion

More libtests fixups. Include audiodb_close() calls everywhere (whoops). Add the facility to run tests under valgrind. Unfortunately the error-exitcode flag doesn't actually cause an error exit if the only thing wrong is memory leaks, but it will if there are actual memory errors, which is a start.
author mas01cr
date Sat, 10 Jan 2009 16:07:43 +0000
parents 4cb6c611f812
children
comparison
equal deleted inserted replaced
496:8fb85fbcaba6 497:9d8aee621afb
1 #! /bin/bash 1 #! /bin/bash
2 2
3 # FIXME: work out how to do proper getopt in bash
3 if [ "$1" = "--full" ]; then 4 if [ "$1" = "--full" ]; then
4 pattern="[0-9][0-9][0-9][0-9]*" 5 pattern="[0-9][0-9][0-9][0-9]*"
5 else 6 else
6 pattern="[0-8][0-9][0-9][0-9]*" 7 pattern="[0-8][0-9][0-9][0-9]*"
7 fi 8 fi
11 if [ /bin/true ]; then 12 if [ /bin/true ]; then
12 echo -n Running test ${file} 13 echo -n Running test ${file}
13 if [ -f ${file}/short-description ]; then 14 if [ -f ${file}/short-description ]; then
14 awk '{ printf(" (%s)",$0) }' < ${file}/short-description 15 awk '{ printf(" (%s)",$0) }' < ${file}/short-description
15 fi 16 fi
17 if [ "$1" = "--valgrind" ]; then
18 echo -n \ under valgrind
19 fi
16 echo -n : 20 echo -n :
17 (cd ${file} && make -f ../libtest.mk >/dev/null 2>&1 && ./test1 > test.out 2> test.err && exit 104) 21 if [ "$1" = "--valgrind" ]; then
22 (cd ${file} && make -f ../libtest.mk >/dev/null 2>&1 && valgrind --leak-check=full --show-reachable=yes --error-exitcode=1 --tool=memcheck ./test1 > test.out 2> test.err)
23 else
24 (cd ${file} && make -f ../libtest.mk >/dev/null 2>&1 && ./test1 > test.out 2> test.err)
25 fi
18 EXIT_STATUS=$? 26 EXIT_STATUS=$?
19 if [ ${EXIT_STATUS} -eq 14 ]; then 27 if [ ${EXIT_STATUS} -eq 14 ]; then
20 echo " n/a." 28 echo " n/a."
21 elif [ ${EXIT_STATUS} -ne 104 ]; then 29 elif [ ${EXIT_STATUS} -ne 104 ]; then
22 echo " failed (exit status ${EXIT_STATUS})." 30 echo " failed (exit status ${EXIT_STATUS})."