78 lines
2.0 KiB
C
78 lines
2.0 KiB
C
/*
|
|
* 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
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
* 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 "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_ @}*/
|