diff options
author | Martin Willi <martin@revosec.ch> | 2013-06-25 17:09:07 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-10-11 15:12:16 +0200 |
commit | fc566632da206a413fc251138ed1db97649995dc (patch) | |
tree | 3158b9f849f5a329950a8eaca9a45710c8a40f20 /src | |
parent | 390d2b50b3ad0426d23d72f96682853141fb1a0a (diff) | |
download | strongswan-fc566632da206a413fc251138ed1db97649995dc.tar.bz2 strongswan-fc566632da206a413fc251138ed1db97649995dc.tar.xz |
unit-tests: support testing when leak-detective has not been enabled
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/tests/test_suite.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/libstrongswan/tests/test_suite.h b/src/libstrongswan/tests/test_suite.h index edf16f128..2a2861323 100644 --- a/src/libstrongswan/tests/test_suite.h +++ b/src/libstrongswan/tests/test_suite.h @@ -30,10 +30,13 @@ */ #define CHECK_FOR_LEAKS() do \ { \ - if (lib->leak_detective->leaks(lib->leak_detective)) { \ - lib->leak_detective->report(lib->leak_detective, TRUE); \ + if (lib->leak_detective) \ + { \ + if (lib->leak_detective->leaks(lib->leak_detective)) { \ + lib->leak_detective->report(lib->leak_detective, TRUE); \ + } \ + ck_assert_int_eq(lib->leak_detective->leaks(lib->leak_detective), 0); \ } \ - ck_assert_int_eq(lib->leak_detective->leaks(lib->leak_detective), 0); \ } \ while(0) @@ -55,7 +58,10 @@ static void name (int _i CK_ATTRIBUTE_UNUSED) \ { \ tcase_fn_start(""#name, __FILE__, __LINE__); \ dbg_default_set_level(LEVEL_SILENT); \ - lib->leak_detective->set_state(lib->leak_detective, TRUE); + if (lib->leak_detective) \ + { \ + lib->leak_detective->set_state(lib->leak_detective, TRUE); \ + } #undef END_TEST #define END_TEST \ @@ -73,7 +79,10 @@ static void name (int _i CK_ATTRIBUTE_UNUSED) \ static void name() \ { \ lib->set(lib, UNIT_TEST_FIXTURE_USED, (void*)TRUE); \ - lib->leak_detective->set_state(lib->leak_detective, TRUE); + if (lib->leak_detective) \ + { \ + lib->leak_detective->set_state(lib->leak_detective, TRUE); \ + } /** * End a setup function |