strongswan/src/libstrongswan/tests/test_runner.c

69 lines
2.1 KiB
C
Raw Normal View History

/*
* Copyright (C) 2013 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* 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.
*/
#include <unistd.h>
#include "test_runner.h"
#include <library.h>
#include <plugins/plugin_feature.h>
int main()
{
SRunner *sr;
int nf;
2013-06-04 14:25:22 +00:00
/* test cases are forked and there is no cleanup, so disable leak detective.
* if test_suite.h is included leak detective is enabled in test cases */
setenv("LEAK_DETECTIVE_DISABLE", "1", 1);
/* redirect all output to stderr (to redirect make's stdout to /dev/null) */
dup2(2, 1);
library_init(NULL);
if (!lib->plugins->load(lib->plugins, NULL, PLUGINS))
{
library_deinit();
return EXIT_FAILURE;
}
sr = srunner_create(NULL);
2013-06-04 14:25:22 +00:00
srunner_add_suite(sr, bio_reader_suite_create());
2013-06-04 16:29:06 +00:00
srunner_add_suite(sr, bio_writer_suite_create());
2013-03-26 15:39:44 +00:00
srunner_add_suite(sr, chunk_suite_create());
2013-06-03 16:58:14 +00:00
srunner_add_suite(sr, enum_suite_create());
2013-03-26 09:41:54 +00:00
srunner_add_suite(sr, enumerator_suite_create());
2013-03-26 11:18:44 +00:00
srunner_add_suite(sr, linked_list_suite_create());
srunner_add_suite(sr, linked_list_enumerator_suite_create());
srunner_add_suite(sr, hashtable_suite_create());
2013-03-26 13:52:33 +00:00
srunner_add_suite(sr, identification_suite_create());
2013-03-27 08:16:59 +00:00
srunner_add_suite(sr, threading_suite_create());
2013-03-27 15:35:28 +00:00
srunner_add_suite(sr, utils_suite_create());
srunner_add_suite(sr, vectors_suite_create());
if (lib->plugins->has_feature(lib->plugins,
PLUGIN_DEPENDS(PRIVKEY_GEN, KEY_ECDSA)))
{
srunner_add_suite(sr, ecdsa_suite_create());
}
srunner_run_all(sr, CK_NORMAL);
nf = srunner_ntests_failed(sr);
srunner_free(sr);
library_deinit();
return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}