aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2013-12-02 11:16:04 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2013-12-04 20:33:00 +0100
commitf1e12da7ef620de97cd9cd553465a271a883e5e6 (patch)
treefa1e4393c1bb5e814b88c7f0c7bfde68ed0b44e7 /src
parentd5a0abfa9201b73c2c2e42c852c60831aadf218a (diff)
downloadstrongswan-f1e12da7ef620de97cd9cd553465a271a883e5e6.tar.bz2
strongswan-f1e12da7ef620de97cd9cd553465a271a883e5e6.tar.xz
unit-tests: Don't use priority for destructor that unregisters testable functions
This fixes coverage reports, at least if leak detective is disabled. If it is enabled the plugins are not unloaded so the destructor is not executed until the process is destroyed, which seems not to be covered by gcov.
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/utils/test.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libstrongswan/utils/test.h b/src/libstrongswan/utils/test.h
index d3c641674..5b7289244 100644
--- a/src/libstrongswan/utils/test.h
+++ b/src/libstrongswan/utils/test.h
@@ -42,6 +42,11 @@ void testable_function_register(char *name, void *fn);
* Macro to automatically register/unregister a function that can be called
* from tests.
*
+ * @note The constructor has a priority set so that it runs after the
+ * constructor that creates the hashtable. The destructor, on the other hand,
+ * does not have a priority set, as test coverage would report that function as
+ * untested otherwise.
+ *
* @param ns namespace
* @param fn function to register
*/
@@ -51,7 +56,7 @@ static void testable_function_register_##fn() \
{ \
testable_function_register(#ns "/" #fn, fn); \
} \
-static void testable_function_unregister_##fn() __attribute__ ((destructor(2000))); \
+static void testable_function_unregister_##fn() __attribute__ ((destructor)); \
static void testable_function_unregister_##fn() \
{ \
testable_function_register(#ns "/" #fn, NULL); \