Annotation of embedaddon/strongswan/src/libstrongswan/tests/test_runner.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2013 Martin Willi
! 3: * Copyright (C) 2013 revosec AG
! 4: *
! 5: * This program is free software; you can redistribute it and/or modify it
! 6: * under the terms of the GNU General Public License as published by the
! 7: * Free Software Foundation; either version 2 of the License, or (at your
! 8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
! 9: *
! 10: * This program is distributed in the hope that it will be useful, but
! 11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
! 12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
! 13: * for more details.
! 14: */
! 15:
! 16: /**
! 17: * @defgroup libtest libtest
! 18: *
! 19: * @defgroup test_utils test_utils
! 20: * @ingroup libtest
! 21: *
! 22: * @defgroup test_runner test_runner
! 23: * @{ @ingroup libtest
! 24: */
! 25:
! 26: #ifndef TEST_RUNNER_H_
! 27: #define TEST_RUNNER_H_
! 28:
! 29: #include "test_suite.h"
! 30:
! 31: #include <plugins/plugin_feature.h>
! 32:
! 33: typedef struct test_configuration_t test_configuration_t;
! 34:
! 35: /**
! 36: * Callback called before and after each test case to de-/initialize the
! 37: * environment (e.g. to load plugins). It is also called before and after the
! 38: * test suites are loaded.
! 39: *
! 40: * It is called after libstrongswan has been initialized and likewise before it
! 41: * gets deinitialized.
! 42: *
! 43: * @param init TRUE during initialization
! 44: * @return FALSE if de-/init failed
! 45: */
! 46: typedef bool (*test_runner_init_t)(bool init);
! 47:
! 48: /**
! 49: * Test configuration, suite constructor with plugin dependency
! 50: */
! 51: struct test_configuration_t {
! 52:
! 53: /**
! 54: * Constructor function to create suite.
! 55: */
! 56: test_suite_t *(*suite)();
! 57:
! 58: /**
! 59: * Plugin feature this test suite depends on
! 60: */
! 61: plugin_feature_t feature;
! 62: };
! 63:
! 64: /**
! 65: * Run test configuration.
! 66: *
! 67: * The configs array must be terminated with a NULL element. The following
! 68: * environment variables are currently supported:
! 69: *
! 70: * - TESTS_VERBOSITY: Numerical loglevel for debug log
! 71: * - TESTS_STRONGSWAN_CONF: Specify a path to a custom strongswan.conf
! 72: * - TESTS_PLUGINS: Specify an explicit list of plugins to load
! 73: * - TESTS_RUNNERS: Run specific test runners only
! 74: * - TESTS_SUITES: Run specific test suites only
! 75: * - TESTS_SUITES_EXCLUDE: Don't run specific test suites
! 76: * - TESTS_REDUCED_KEYLENGTHS: Test minimal keylengths for public key tests only
! 77: *
! 78: * Please note that TESTS_PLUGINS actually must be implemented by the init
! 79: * callback function, as plugin loading is delegated.
! 80: *
! 81: * EXIT_SUCCESS is returned right away if TESTS_RUNNERS is defined but the name
! 82: * passed to this function is not contained in it.
! 83: *
! 84: * @param name name of test runner
! 85: * @param config test suite constructors with dependencies
! 86: * @param init_cb init/deinit callback
! 87: * @return test result, EXIT_SUCCESS if all tests passed
! 88: */
! 89: int test_runner_run(const char *name, test_configuration_t config[],
! 90: test_runner_init_t init_cb);
! 91:
! 92: #endif /** TEST_RUNNER_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>