aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/tests/test_runner.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/tests/test_runner.c')
-rw-r--r--src/libstrongswan/tests/test_runner.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libstrongswan/tests/test_runner.c b/src/libstrongswan/tests/test_runner.c
index 0bb1ab309..bf18f16fb 100644
--- a/src/libstrongswan/tests/test_runner.c
+++ b/src/libstrongswan/tests/test_runner.c
@@ -20,6 +20,7 @@
#include <library.h>
#include <plugins/plugin_feature.h>
#include <collections/array.h>
+#include <utils/test.h>
#include <dirent.h>
#include <unistd.h>
@@ -31,6 +32,30 @@
#define TTY(color) tty_escape_get(2, TTY_FG_##color)
/**
+ * Initialize the lookup table for testable functions (defined in libstrongswan)
+ */
+static void testable_functions_create() __attribute__ ((constructor(1000)));
+static void testable_functions_create()
+{
+ testable_functions = hashtable_create(hashtable_hash_str,
+ hashtable_equals_str, 8);
+}
+
+/**
+ * Destroy the lookup table for testable functions
+ */
+static void testable_functions_destroy() __attribute__ ((destructor(1000)));
+static void testable_functions_destroy()
+{
+ testable_functions->destroy(testable_functions);
+ /* if leak detective is enabled plugins are not actually unloaded, which
+ * means their destructor is called AFTER this one when the process
+ * terminates, even though the priority says differently, make sure this
+ * does not crash */
+ testable_functions = NULL;
+}
+
+/**
* Load all available test suites
*/
static array_t *load_suites(test_configuration_t configs[],