diff 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
line wrap: on
line diff
--- a/libtests/run-tests.sh	Sat Jan 10 15:33:25 2009 +0000
+++ b/libtests/run-tests.sh	Sat Jan 10 16:07:43 2009 +0000
@@ -1,5 +1,6 @@
 #! /bin/bash
 
+# FIXME: work out how to do proper getopt in bash
 if [ "$1" = "--full" ]; then
   pattern="[0-9][0-9][0-9][0-9]*"
 else
@@ -13,8 +14,15 @@
       if [ -f ${file}/short-description ]; then
         awk '{ printf(" (%s)",$0) }' < ${file}/short-description
       fi
+      if [ "$1" = "--valgrind" ]; then
+        echo -n \ under valgrind
+      fi
       echo -n :
-      (cd ${file} && make -f ../libtest.mk >/dev/null 2>&1 && ./test1 > test.out 2> test.err && exit 104)
+      if [ "$1" = "--valgrind" ]; then
+        (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)
+      else
+        (cd ${file} && make -f ../libtest.mk >/dev/null 2>&1 && ./test1 > test.out 2> test.err)
+      fi
       EXIT_STATUS=$?
       if [ ${EXIT_STATUS} -eq 14 ]; then
         echo " n/a."