From 4e2bafafefe9c27f5b3fd30fb2afb40ee6680f82 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Tue, 1 May 2018 12:12:21 +0000 Subject: [PATCH] valgrind more unit tests. git-svn-id: file:///svn/unbound/trunk@4667 be551aaa-1e26-0410-a405-d3ace91eadb9 --- testcode/unitmain.c | 3 +++ testdata/03-testbound.tdir/03-testbound.test | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/testcode/unitmain.c b/testcode/unitmain.c index 57883d183..fecde80cc 100644 --- a/testcode/unitmain.c +++ b/testcode/unitmain.c @@ -905,6 +905,9 @@ main(int argc, char* argv[]) #ifdef CLIENT_SUBNET ecs_test(); #endif /* CLIENT_SUBNET */ + if(log_get_lock()) { + lock_quick_destroy((lock_quick_type*)log_get_lock()); + } checklock_stop(); printf("%d checks ok.\n", testcount); #ifdef HAVE_SSL diff --git a/testdata/03-testbound.tdir/03-testbound.test b/testdata/03-testbound.tdir/03-testbound.test index aefdc1855..00d362287 100644 --- a/testdata/03-testbound.tdir/03-testbound.test +++ b/testdata/03-testbound.tdir/03-testbound.test @@ -26,13 +26,15 @@ VALGRIND_FLAGS="--leak-check=full --show-leak-kinds=all" # self-test (unit test of testbound) if test $do_valgrind = "yes"; then + echo "valgrind yes" + echo if (valgrind $VALGRIND_FLAGS $PRE/testbound -s >tmpout 2>&1;); then echo "selftest OK " else echo "selftest FAILED" exit 1 fi - if grep "All heap blocks were freed -- no leaks are possible" tmpout >/dev/null 2>&1; then + if grep "All heap blocks were freed -- no leaks are possible" tmpout; then : # clean else cat tmpout @@ -40,7 +42,7 @@ if test $do_valgrind = "yes"; then grep "in use at exit" tmpout exit 1 fi - if grep "ERROR SUMMARY: 0 errors from 0 contexts" tmpout >/dev/null 2>&1; then + if grep "ERROR SUMMARY: 0 errors from 0 contexts" tmpout; then : # clean else cat tmpout @@ -102,13 +104,14 @@ for input in $PRE/testdata/*.rpl $PRE/testdata/*.crpl; do fi if test $do_valgrind = "yes"; then + echo if (valgrind $VALGRIND_FLAGS $PRE/testbound -p $input >tmpout 2>&1;); then echo " OK $cleaninput: $header" else echo "FAILED $cleaninput: $header" exitval=1 fi - if grep "All heap blocks were freed -- no leaks are possible" tmpout >/dev/null 2>&1; then + if grep "All heap blocks were freed -- no leaks are possible" tmpout; then : # clean else grep "^==" tmpout @@ -116,7 +119,7 @@ for input in $PRE/testdata/*.rpl $PRE/testdata/*.crpl; do grep "in use at exit" tmpout exitval=1 fi - if grep "ERROR SUMMARY: 0 errors from 0 contexts" tmpout >/dev/null 2>&1; then + if grep "ERROR SUMMARY: 0 errors from 0 contexts" tmpout; then : # clean else grep "^==" tmpout