Mercurial > hg > audiodb
changeset 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 | 8fb85fbcaba6 |
children | |
files | libtests/0006/prog1.c libtests/0007/prog1.c libtests/0008/prog1.c libtests/0009/prog1.c libtests/0010/prog1.c libtests/0011/prog1.c libtests/0012/prog1.c libtests/0024/prog1.c libtests/0025/prog1.c libtests/0026/prog1.c libtests/0029/prog1.c libtests/0030/prog1.c libtests/0031/prog1.c libtests/0032/prog1.c libtests/0033/prog1.c libtests/0034/prog1.c libtests/0035/prog1.c libtests/9000/prog1.c libtests/run-tests.sh |
diffstat | 19 files changed, 46 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/libtests/0006/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0006/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -56,5 +56,5 @@ audiodb_close(adb); - return(104); + return 104; }
--- a/libtests/0007/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0007/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -58,5 +58,7 @@ if(!results || results->nresults != 2) return 1; audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0008/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0008/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -60,5 +60,7 @@ result_present_or_fail(results, "testfeature10", 0, 0, 0); audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0009/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0009/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -59,5 +59,7 @@ result_present_or_fail(results, "testfeature10", 0.5, 0, 0); audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0010/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0010/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -65,5 +65,7 @@ result_present_or_fail(results, "testfeature10", 0, 0, 0); audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0011/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0011/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -55,5 +55,7 @@ result_present_or_fail(results, "testfeature", 0, 0, 1); audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0012/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0012/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -55,5 +55,7 @@ result_present_or_fail(results, "testfeature", 0, 0, 1); audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0024/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0024/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -49,5 +49,7 @@ result_present_or_fail(results, "testfeature10", 0, 1, 0); audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0025/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0025/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -56,5 +56,7 @@ result_present_or_fail(results, "testfeature", 0, 0, 1); audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0026/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0026/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -13,5 +13,7 @@ if(audiodb_power(adb)) return 1; + audiodb_close(adb); + return 104; }
--- a/libtests/0029/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0029/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -127,5 +127,7 @@ result_present_or_fail(results, "testfeature", 1, 0, 2); audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0030/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0030/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -131,5 +131,7 @@ if(!results || results->nresults != 0) return 1; audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0031/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0031/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -79,5 +79,7 @@ result_present_or_fail(results, "testfeature10", 2, 0, 0); audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0032/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0032/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -86,5 +86,7 @@ result_present_or_fail(results, "testfeature10", 0, 0, 0); audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0033/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0033/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -86,5 +86,7 @@ if(!results || results->nresults != 0) return 1; audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/0034/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0034/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -45,6 +45,8 @@ if(audiodb_status(adb, &status) || status.numFiles != 3) return 1; + audiodb_close(adb); + clean_remove_db(TESTDB); if(!(adb = audiodb_create(TESTDB, 0, 0, 0))) return 1; @@ -58,5 +60,7 @@ if(audiodb_status(adb, &status) || status.numFiles != 3) return 1; + audiodb_close(adb); + return 104; }
--- a/libtests/0035/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/0035/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -38,5 +38,7 @@ result_present_or_fail(results, "testfeature3", 0, 0, 1); audiodb_query_free_results(adb, &spec, results); + audiodb_close(adb); + return 104; }
--- a/libtests/9000/prog1.c Sat Jan 10 15:33:25 2009 +0000 +++ b/libtests/9000/prog1.c Sat Jan 10 16:07:43 2009 +0000 @@ -1,31 +1,7 @@ #include "audioDB_API.h" #include "test_utils_lib.h" - -int main(int argc, char **argv){ - - int returnval=0; - adb_ptr mydbp={0}; - int ivals[10]; - double dvals[10]; - adb_insert_t myinsert={0}; - unsigned int myerr=0; - char * databasename="testdb"; - adb_query_t myadbquery={0}; - adb_queryresult_t myadbqueryresult={0}; - adb_query_t myadbquery2={0}; - adb_queryresult_t myadbqueryresult2={0}; - int size=0; - - - - - - - - - returnval=-1; - - return(returnval); +int main(int argc, char **argv) { + return 14; }
--- 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."