Annotation of embedaddon/strongswan/src/libcharon/tests/exchange_tests.c, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2016 Tobias Brunner
        !             3:  * HSR Hochschule fuer Technik Rapperswil
        !             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: #include <test_runner.h>
        !            17: #include <daemon.h>
        !            18: 
        !            19: #include "utils/exchange_test_helper.h"
        !            20: 
        !            21: /* declare test suite constructors */
        !            22: #define TEST_SUITE(x) test_suite_t* x();
        !            23: #define TEST_SUITE_DEPEND(x, ...) TEST_SUITE(x)
        !            24: #include "exchange_tests.h"
        !            25: #undef TEST_SUITE
        !            26: #undef TEST_SUITE_DEPEND
        !            27: 
        !            28: static test_configuration_t tests[] = {
        !            29: #define TEST_SUITE(x) \
        !            30:        { .suite = x, },
        !            31: #define TEST_SUITE_DEPEND(x, type, ...) \
        !            32:        { .suite = x, .feature = PLUGIN_DEPENDS(type, __VA_ARGS__) },
        !            33: #include "exchange_tests.h"
        !            34:        { .suite = NULL, }
        !            35: };
        !            36: 
        !            37: static bool test_runner_init(bool init)
        !            38: {
        !            39:        if (init)
        !            40:        {
        !            41:                char *plugins, *plugindir;
        !            42: 
        !            43:                libcharon_init();
        !            44: 
        !            45:                plugins = getenv("TESTS_PLUGINS") ?:
        !            46:                                        lib->settings->get_str(lib->settings,
        !            47:                                                                                "tests.load", PLUGINS);
        !            48:                plugindir = lib->settings->get_str(lib->settings,
        !            49:                                                                                "tests.plugindir", PLUGINDIR);
        !            50:                plugin_loader_add_plugindirs(plugindir, plugins);
        !            51:                exchange_test_helper_init(plugins);
        !            52:        }
        !            53:        else
        !            54:        {
        !            55:                exchange_test_helper_deinit();
        !            56:                libcharon_deinit();
        !            57:        }
        !            58:        return TRUE;
        !            59: }
        !            60: 
        !            61: int main(int argc, char *argv[])
        !            62: {
        !            63:        return test_runner_run("exchanges", tests, test_runner_init);
        !            64: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>