]> git.ipfire.org Git - people/ms/strongswan.git/blobdiff - src/libstrongswan/utils/test.h
unit-tests: Don't use priority for destructor that unregisters testable functions
[people/ms/strongswan.git] / src / libstrongswan / utils / test.h
index d3c6416748eb5ac5940c1458974409a892561c45..5b728924403250bcc09d578f2c72a5d575cf5b38 100644 (file)
@@ -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); \