]> git.ipfire.org Git - thirdparty/strongswan.git/blame - src/libtls/tests/tls_tests.c
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libtls / tests / tls_tests.c
CommitLineData
c0efaaeb
MW
1/*
2 * Copyright (C) 2014 Martin Willi
19ef2aec
TB
3 *
4 * Copyright (C) secunet Security Networks AG
c0efaaeb
MW
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17#include <test_runner.h>
18
19/* declare test suite constructors */
20#define TEST_SUITE(x) test_suite_t* x();
21#define TEST_SUITE_DEPEND(x, ...) TEST_SUITE(x)
22#include "tls_tests.h"
23#undef TEST_SUITE
24#undef TEST_SUITE_DEPEND
25
26static test_configuration_t tests[] = {
27#define TEST_SUITE(x) \
28 { .suite = x, },
ee9f6919
MW
29#define TEST_SUITE_DEPEND(x, type, ...) \
30 { .suite = x, .feature = PLUGIN_DEPENDS(type, __VA_ARGS__) },
c0efaaeb
MW
31#include "tls_tests.h"
32 { .suite = NULL, }
33};
34
35static bool test_runner_init(bool init)
36{
37 if (init)
38 {
3d83d348
TB
39 char *plugins;
40
41 plugins = getenv("TESTS_PLUGINS") ?:
42 lib->settings->get_str(lib->settings,
43 "tests.load", PLUGINS);
44 plugin_loader_add_plugindirs(PLUGINDIR, plugins);
45 if (!lib->plugins->load(lib->plugins, plugins))
c0efaaeb
MW
46 {
47 return FALSE;
48 }
49 }
50 else
51 {
52 lib->credmgr->flush_cache(lib->credmgr, CERT_ANY);
53 lib->processor->set_threads(lib->processor, 0);
54 lib->processor->cancel(lib->processor);
55 lib->plugins->unload(lib->plugins);
56 }
57 return TRUE;
58}
59
60int main(int argc, char *argv[])
61{
62 return test_runner_run("libtls", tests, test_runner_init);
63}