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.

(cherry picked from commit 568f65cc56)
This commit is contained in:
Evan Hunt
2022-05-03 19:43:23 -07:00
committed by Ondřej Surý
parent f128a9bcf2
commit a67ba6e0b9
7 changed files with 34 additions and 19 deletions

View File

@@ -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)

View File

@@ -1581,7 +1581,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])

View File

@@ -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 =

28
tests/libtest/Makefile.am Normal file
View File

@@ -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