From 568f65cc56370c211454d041c6b13d0d593cadab Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Tue, 3 May 2022 19:43:23 -0700 Subject: [PATCH] Stop the unit tests from running twice Move the libtest code into a 'libtest' subdirectory and make it one of the SUBDIRS in the tests Makefile. having it at the top level required having "." as one of the subdirs, and that caused the unit tests to be executed twice. --- Makefile.tests | 4 ++-- configure.ac | 3 ++- tests/Makefile.am | 18 ++---------------- tests/libtest/Makefile.am | 28 ++++++++++++++++++++++++++++ tests/{ => libtest}/dns.c | 0 tests/{ => libtest}/isc.c | 0 tests/{ => libtest}/ns.c | 0 7 files changed, 34 insertions(+), 19 deletions(-) create mode 100644 tests/libtest/Makefile.am rename tests/{ => libtest}/dns.c (100%) rename tests/{ => libtest}/isc.c (100%) rename tests/{ => libtest}/ns.c (100%) diff --git a/Makefile.tests b/Makefile.tests index d7b2e948e0..e1b7e0e046 100644 --- a/Makefile.tests +++ b/Makefile.tests @@ -18,6 +18,6 @@ AM_CPPFLAGS += \ -DNAMED_PLUGINDIR=\"$(pkglibdir)\" \ -DTESTS_DIR=\"$(abs_srcdir)\" -LDADD += \ - $(top_builddir)/tests/libtest.la \ +LDADD += \ + $(top_builddir)/tests/libtest/libtest.la \ $(CMOCKA_LIBS) diff --git a/configure.ac b/configure.ac index b6b546e6c4..6d7f5feb54 100644 --- a/configure.ac +++ b/configure.ac @@ -1586,7 +1586,8 @@ AC_CONFIG_FILES([tests/Makefile tests/dns/Makefile tests/ns/Makefile tests/irs/Makefile - tests/isccfg/Makefile]) + tests/isccfg/Makefile + tests/libtest/Makefile]) AC_CONFIG_FILES([tests/unit-test-driver.sh], [chmod +x tests/unit-test-driver.sh]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 0a19bb1d1f..8b5dcbe842 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -12,19 +12,5 @@ LDADD += \ $(LIBDNS_LIBS) \ $(LIBNS_LIBS) -SUBDIRS = . isc dns ns isccfg irs - -check_LTLIBRARIES = libtest.la - -noinst_libtest_ladir = . -noinst_libtest_la_HEADERS = \ - include/tests/dns.h \ - include/tests/isc.h \ - include/tests/ns.h -libtest_la_SOURCES = \ - $(noinst_libtest_la_HEADERS) \ - dns.c \ - isc.c \ - ns.c - -include $(top_srcdir)/Makefile.tests +SUBDIRS = libtest isc dns ns isccfg irs +check_PROGRAMS = diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am new file mode 100644 index 0000000000..2699f4bfcf --- /dev/null +++ b/tests/libtest/Makefile.am @@ -0,0 +1,28 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBNS_CFLAGS) \ + $(LIBUV_CFLAGS) \ + -I$(top_srcdir)/lib/isc + +LDADD += \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBNS_LIBS) + +check_LTLIBRARIES = libtest.la + +noinst_libtest_ladir = .. +noinst_libtest_la_HEADERS = \ + ../include/tests/dns.h \ + ../include/tests/isc.h \ + ../include/tests/ns.h +libtest_la_SOURCES = \ + $(noinst_libtest_la_HEADERS) \ + dns.c \ + isc.c \ + ns.c + +include $(top_srcdir)/Makefile.tests diff --git a/tests/dns.c b/tests/libtest/dns.c similarity index 100% rename from tests/dns.c rename to tests/libtest/dns.c diff --git a/tests/isc.c b/tests/libtest/isc.c similarity index 100% rename from tests/isc.c rename to tests/libtest/isc.c diff --git a/tests/ns.c b/tests/libtest/ns.c similarity index 100% rename from tests/ns.c rename to tests/libtest/ns.c