summaryrefslogtreecommitdiff
path: root/src/libcharon/tests/libcharon_tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcharon/tests/libcharon_tests.c')
-rw-r--r--src/libcharon/tests/libcharon_tests.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/libcharon/tests/libcharon_tests.c b/src/libcharon/tests/libcharon_tests.c
index 1ed0f0c95..ec96de711 100644
--- a/src/libcharon/tests/libcharon_tests.c
+++ b/src/libcharon/tests/libcharon_tests.c
@@ -27,8 +27,8 @@
static test_configuration_t tests[] = {
#define TEST_SUITE(x) \
{ .suite = x, },
-#define TEST_SUITE_DEPEND(x, type, args) \
- { .suite = x, .feature = PLUGIN_DEPENDS(type, args) },
+#define TEST_SUITE_DEPEND(x, type, ...) \
+ { .suite = x, .feature = PLUGIN_DEPENDS(type, __VA_ARGS__) },
#include "libcharon_tests.h"
{ .suite = NULL, }
};
@@ -37,13 +37,27 @@ static bool test_runner_init(bool init)
{
if (init)
{
+ char *plugins, *plugindir;
+
libhydra_init();
libcharon_init();
+
+ plugins = getenv("TESTS_PLUGINS") ?:
+ lib->settings->get_str(lib->settings,
+ "tests.load", PLUGINS);
+ plugindir = lib->settings->get_str(lib->settings,
+ "tests.plugindir", PLUGINDIR);
+ plugin_loader_add_plugindirs(plugindir, plugins);
+ if (!lib->plugins->load(lib->plugins, plugins))
+ {
+ return FALSE;
+ }
}
else
{
lib->processor->set_threads(lib->processor, 0);
lib->processor->cancel(lib->processor);
+ lib->plugins->unload(lib->plugins);
libcharon_deinit();
libhydra_deinit();
}