unit-tests: Initialize tests with a callback

This commit is contained in:
Tobias Brunner
2013-11-06 10:31:07 +01:00
committed by Martin Willi
parent 8d2450d8b8
commit 334f44cd29
3 changed files with 58 additions and 56 deletions
+17 -7
View File
@@ -19,6 +19,19 @@
typedef struct test_configuration_t test_configuration_t;
/**
* Callback called before and after each test case to de-/initialize the
* environment (e.g. to load plugins). It is also called before and after the
* test suites are loaded.
*
* It is called after libstrongswan has been initialized and likewise before it
* gets deinitialized.
*
* @param init TRUE during initialization
* @return FALSE if de-/init failed
*/
typedef bool (*test_runner_init_t)(bool init);
/**
* Test configuration, suite constructor with plugin dependency
*/
@@ -36,15 +49,12 @@ struct test_configuration_t {
};
/**
* Run test configuration, loading plugins from plugin base directory.
* Run test configuration.
*
* Both the configs and the plugindirs array must be terminated with a NULL
* element.
* The configs array must be terminated with a NULL element.
*
* @param configs test suite constructors with dependencies
* @param plugindirs base directories containing plugin directories to load
* @param plugins plugin names to load, space separated
* @param init_cb init/deinit callback
* @return test result, EXIT_SUCCESS if all tests passed
*/
int test_runner_run(test_configuration_t config[],
char *plugindirs[], char *plugins);
int test_runner_run(test_configuration_t config[], test_runner_init_t init_cb);