From d9793f4e33a6db3cf459ab667bdc8735a301989e Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Thu, 16 Aug 2018 15:24:31 +0200 Subject: [PATCH] Update: Separate integration and unit tests - Unit tests are now in `src/tests` - Integration tests are in `tests` --- .gitignore | 12 +++++++ configure.ac | 2 +- src/Makefile.am | 2 ++ src/tests/Makefile.am | 40 ++++++++++++++++++++++ {tests => src/tests}/ctest_lib.c | 0 {tests => src/tests}/ctest_lib.h | 0 {tests => src/tests}/ctest_refobject.c | 2 +- {tests => src/tests}/ctest_resourcematch.c | 2 +- {tests => src/tests}/ctest_suite.c | 0 tests/Makefile.am | 35 +++---------------- 10 files changed, 61 insertions(+), 34 deletions(-) create mode 100644 src/tests/Makefile.am rename {tests => src/tests}/ctest_lib.c (100%) rename {tests => src/tests}/ctest_lib.h (100%) rename {tests => src/tests}/ctest_refobject.c (99%) rename {tests => src/tests}/ctest_resourcematch.c (99%) rename {tests => src/tests}/ctest_suite.c (100%) diff --git a/.gitignore b/.gitignore index 3ec2dccf..74b754c0 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,18 @@ config.h.in~ /tests/.libs/ /tests/ctest_*.test +# Ignore test output files +/src/ctest_*.log +/src/ctest_*.trs +/src/test-suite.log + +# Ignore test build artifacts +/src/tests/*.lo +/src/libice_ctest.la +/src/ctest_*.test +/src/tests/.deps/ +/src/tests/.dirstamp + # Ignore auxiliary files /tap-driver.sh diff --git a/configure.ac b/configure.ac index 7ea95f45..53929284 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,7 @@ AS_CASE("${host_os}", [SYS="${host_os}"] ) -AM_INIT_AUTOMAKE([tar-ustar foreign dist-zip]) +AM_INIT_AUTOMAKE([tar-ustar foreign dist-zip subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AM_MAINTAINER_MODE([enable]) diff --git a/src/Makefile.am b/src/Makefile.am index 18758c0f..b329c5f5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -140,3 +140,5 @@ icecast_DEPENDENCIES = \ icecast_LDADD = $(icecast_DEPENDENCIES) icecast_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/common + +include $(srcdir)/tests/Makefile.am diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am new file mode 100644 index 00000000..e21c161f --- /dev/null +++ b/src/tests/Makefile.am @@ -0,0 +1,40 @@ +## Process this file with automake to produce Makefile.in + +###################### +# Icecast unit tests # +###################### + +TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +check_PROGRAMS = + +# +# Helper library for TAP tests +# + +libice_ctest_la_SOURCES = %reldir%/ctest_lib.c %reldir%/ctest_lib.h +noinst_LTLIBRARIES = libice_ctest.la + +# +# Test programs +# + +ctest_suite_test_SOURCES = %reldir%/ctest_suite.c +ctest_suite_test_LDADD = libice_ctest.la +check_PROGRAMS += ctest_suite.test + +ctest_resourcematch_test_SOURCES = %reldir%/ctest_resourcematch.c +ctest_resourcematch_test_LDADD = libice_ctest.la icecast-resourcematch.o +check_PROGRAMS += ctest_resourcematch.test + +ctest_refobject_test_SOURCES = %reldir%/ctest_refobject.c +ctest_refobject_test_LDADD = libice_ctest.la \ + common/thread/libicethread.la \ + common/avl/libiceavl.la \ + icecast-refobject.o +check_PROGRAMS += ctest_refobject.test + + +# Add all programs to TESTS +TESTS = $(check_PROGRAMS) diff --git a/tests/ctest_lib.c b/src/tests/ctest_lib.c similarity index 100% rename from tests/ctest_lib.c rename to src/tests/ctest_lib.c diff --git a/tests/ctest_lib.h b/src/tests/ctest_lib.h similarity index 100% rename from tests/ctest_lib.h rename to src/tests/ctest_lib.h diff --git a/tests/ctest_refobject.c b/src/tests/ctest_refobject.c similarity index 99% rename from tests/ctest_refobject.c rename to src/tests/ctest_refobject.c index b43836b7..1f553f6f 100644 --- a/tests/ctest_refobject.c +++ b/src/tests/ctest_refobject.c @@ -14,7 +14,7 @@ #include "ctest_lib.h" -#include "../src/refobject.h" +#include "../refobject.h" static void test_ptr(void) { diff --git a/tests/ctest_resourcematch.c b/src/tests/ctest_resourcematch.c similarity index 99% rename from tests/ctest_resourcematch.c rename to src/tests/ctest_resourcematch.c index d0d0668d..e3094269 100644 --- a/tests/ctest_resourcematch.c +++ b/src/tests/ctest_resourcematch.c @@ -15,7 +15,7 @@ #include "ctest_lib.h" -#include "../src/resourcematch.h" +#include "../resourcematch.h" struct test { const char *pattern; diff --git a/tests/ctest_suite.c b/src/tests/ctest_suite.c similarity index 100% rename from tests/ctest_suite.c rename to src/tests/ctest_suite.c diff --git a/tests/Makefile.am b/tests/Makefile.am index d74916c3..399c7370 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,17 +1,12 @@ ## Process this file with automake to produce Makefile.in +############################# +# Icecast integration tests # +############################# + TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ $(top_srcdir)/tap-driver.sh -check_PROGRAMS = - -# -# Helper library for TAP tests -# - -libice_ctest_la_SOURCES = ctest_lib.c ctest_lib.h -noinst_LTLIBRARIES = libice_ctest.la - # # Script-based tests @@ -22,26 +17,6 @@ TESTS = \ admin.test -# -# Test programs -# - -ctest_suite_test_SOURCES = ctest_suite.c -ctest_suite_test_LDADD = libice_ctest.la -check_PROGRAMS += ctest_suite.test - -ctest_resourcematch_test_SOURCES = ctest_resourcematch.c -ctest_resourcematch_test_LDADD = libice_ctest.la ../src/icecast-resourcematch.o -check_PROGRAMS += ctest_resourcematch.test - -ctest_refobject_test_SOURCES = ctest_refobject.c -ctest_refobject_test_LDADD = libice_ctest.la \ - ../src/common/thread/libicethread.la \ - ../src/common/avl/libiceavl.la \ - ../src/icecast-refobject.o -check_PROGRAMS += ctest_refobject.test - - # # Extra files needed by tests # @@ -49,5 +24,3 @@ check_PROGRAMS += ctest_refobject.test EXTRA_DIST = $(TESTS) \ icecast.xml \ on-connect.sh - -TESTS += $(check_PROGRAMS)