unit-tests: Separate test runner to a library, reusable by other tests

Other users may make use of the noinst libtest.la helper library to implement
unit tests. For libstrongswan, tests.[ch] provide the configuration for test
runner to perform unit tests in a simple manner.
This commit is contained in:
Martin Willi
2013-11-06 10:31:07 +01:00
parent 5a3230a250
commit 09d0c9030a
5 changed files with 168 additions and 68 deletions
+23 -7
View File
@@ -1,9 +1,24 @@
TESTS = test_runner
check_LTLIBRARIES = libtest.la
libtest_la_SOURCES = \
test_suite.c test_suite.h \
test_runner.c test_runner.h
libtest_la_CFLAGS = \
-I$(top_srcdir)/src/libstrongswan \
@COVERAGE_CFLAGS@
libtest_la_LDFLAGS = @COVERAGE_LDFLAGS@
libtest_la_LIBADD = \
$(top_builddir)/src/libstrongswan/libstrongswan.la \
$(PTHREADLIB)
TESTS = tests
check_PROGRAMS = $(TESTS)
test_runner_SOURCES = \
test_runner.c test_runner.h test_suite.c test_suite.h \
tests_SOURCES = tests.h tests.c \
suites/test_linked_list.c \
suites/test_enumerator.c \
suites/test_linked_list_enumerator.c \
@@ -26,13 +41,14 @@ test_runner_SOURCES = \
suites/test_asn1.c \
suites/test_printf.c
test_runner_CFLAGS = \
tests_CFLAGS = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libstrongswan/tests \
-DPLUGINDIR=\""$(top_builddir)/src/libstrongswan/plugins\"" \
-DPLUGINS=\""${s_plugins}\"" \
@COVERAGE_CFLAGS@
test_runner_LDFLAGS = @COVERAGE_LDFLAGS@
test_runner_LDADD = \
tests_LDFLAGS = @COVERAGE_LDFLAGS@
tests_LDADD = \
$(top_builddir)/src/libstrongswan/libstrongswan.la \
$(PTHREADLIB)
libtest.la