Add test runner for unit tests in libstrongswan
This commit is contained in:
parent
62516a7465
commit
156dcbc12e
|
@ -1320,6 +1320,7 @@ AC_CONFIG_FILES([
|
|||
src/libstrongswan/plugins/gcm/Makefile
|
||||
src/libstrongswan/plugins/af_alg/Makefile
|
||||
src/libstrongswan/plugins/test_vectors/Makefile
|
||||
src/libstrongswan/tests/Makefile
|
||||
src/libhydra/Makefile
|
||||
src/libhydra/plugins/attr/Makefile
|
||||
src/libhydra/plugins/attr_sql/Makefile
|
||||
|
|
|
@ -455,3 +455,10 @@ if MONOLITHIC
|
|||
libstrongswan_la_LIBADD += plugins/test_vectors/libstrongswan-test-vectors.la
|
||||
endif
|
||||
endif
|
||||
|
||||
if UNITTESTS
|
||||
if MONOLITHIC
|
||||
SUBDIRS += .
|
||||
endif
|
||||
SUBDIRS += tests
|
||||
endif
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
test_runner
|
|
@ -0,0 +1,15 @@
|
|||
TESTS = test_runner
|
||||
|
||||
check_PROGRAMS = $(TESTS)
|
||||
|
||||
test_runner_SOURCES = \
|
||||
test_runner.c test_runner.h
|
||||
|
||||
|
||||
test_runner_CFLAGS = \
|
||||
-I$(top_srcdir)/src/libstrongswan \
|
||||
@CHECK_CFLAGS@
|
||||
|
||||
test_runner_LDADD = \
|
||||
$(top_builddir)/src/libstrongswan/libstrongswan.la \
|
||||
@CHECK_LIBS@
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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 "test_runner.h"
|
||||
|
||||
#include <library.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
SRunner *sr;
|
||||
int nf;
|
||||
|
||||
/* if a test fails there is no cleanup, so disable leak detective */
|
||||
setenv("LEAK_DETECTIVE_DISABLE", "1", 1);
|
||||
|
||||
library_init(NULL);
|
||||
|
||||
sr = srunner_create(NULL);
|
||||
|
||||
srunner_run_all(sr, CK_NORMAL);
|
||||
nf = srunner_ntests_failed(sr);
|
||||
|
||||
srunner_free(sr);
|
||||
library_deinit();
|
||||
|
||||
return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TEST_RUNNER_H_
|
||||
#define TEST_RUNNER_H_
|
||||
|
||||
#include <check.h>
|
||||
|
||||
#endif /** TEST_RUNNER_H_ */
|
Loading…
Reference in New Issue