diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2014-03-11 20:48:48 +0100 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2014-03-11 20:48:48 +0100 |
commit | 15fb7904f4431a6e7c305fd08732458f7f885e7e (patch) | |
tree | c93b60ee813af70509f00f34e29ebec311762427 /src/libstrongswan/tests/test_runner.h | |
parent | 5313d2d78ca150515f7f5eb39801c100690b6b29 (diff) | |
download | vyos-strongswan-15fb7904f4431a6e7c305fd08732458f7f885e7e.tar.gz vyos-strongswan-15fb7904f4431a6e7c305fd08732458f7f885e7e.zip |
Imported Upstream version 5.1.2
Diffstat (limited to 'src/libstrongswan/tests/test_runner.h')
-rw-r--r-- | src/libstrongswan/tests/test_runner.h | 84 |
1 files changed, 61 insertions, 23 deletions
diff --git a/src/libstrongswan/tests/test_runner.h b/src/libstrongswan/tests/test_runner.h index 6315abba7..643b622e5 100644 --- a/src/libstrongswan/tests/test_runner.h +++ b/src/libstrongswan/tests/test_runner.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2013 Tobias Brunner - * Hochschule fuer Technik Rapperswil + * Copyright (C) 2013 Martin Willi + * Copyright (C) 2013 revosec AG * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -13,27 +13,65 @@ * for more details. */ +/** + * @defgroup libtest libtest + * + * @defgroup test_utils test_utils + * @ingroup libtest + * + * @defgroup test_runner test_runner + * @{ @ingroup libtest + */ + #ifndef TEST_RUNNER_H_ #define TEST_RUNNER_H_ -#include <check.h> - -Suite *bio_reader_suite_create(); -Suite *bio_writer_suite_create(); -Suite *chunk_suite_create(); -Suite *enum_suite_create(); -Suite *enumerator_suite_create(); -Suite *linked_list_suite_create(); -Suite *linked_list_enumerator_suite_create(); -Suite *hashtable_suite_create(); -Suite *array_suite_create(); -Suite *identification_suite_create(); -Suite *threading_suite_create(); -Suite *utils_suite_create(); -Suite *vectors_suite_create(); -Suite *ecdsa_suite_create(); -Suite *rsa_suite_create(); -Suite *host_suite_create(); -Suite *printf_suite_create(); - -#endif /** TEST_RUNNER_H_ */ +#include "test_suite.h" + +#include <plugins/plugin_feature.h> + +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 + */ +struct test_configuration_t { + + /** + * Constructor function to create suite. + */ + test_suite_t *(*suite)(); + + /** + * Plugin feature this test suite depends on + */ + plugin_feature_t feature; +}; + +/** + * Run test configuration. + * + * The configs array must be terminated with a NULL element. + * + * @param name name of test runner + * @param config test suite constructors with dependencies + * @param init_cb init/deinit callback + * @return test result, EXIT_SUCCESS if all tests passed + */ +int test_runner_run(const char *name, test_configuration_t config[], + test_runner_init_t init_cb); + +#endif /** TEST_RUNNER_H_ @}*/ |