[libdmapsharing] Adjust how building tests works
- From: W. Michael Petullo <wmpetullo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdmapsharing] Adjust how building tests works
- Date: Tue, 30 Jun 2020 12:40:24 +0000 (UTC)
commit 856bf619ed33559473ef588024929cf116889e1e
Author: W. Michael Petullo <mike flyn org>
Date: Tue Jun 30 07:35:13 2020 -0500
Adjust how building tests works
Previously, the presence of the check library led to libdmapsharing
building its unit tests and supporting facilities, despite the separate
configure flag --disable-tests. This led to confusion as to whether some
test facilities should be present in the compiled libdmapsharing. Now,
--disable-tests disables all tests, whether unit tests or sample programs,
and it ensure not test facilities exist in libdmapsharing.
config.h.in | 6 +++---
configure.ac | 26 ++++++++++++--------------
libdmapsharing/Makefile.am | 7 ++-----
tests/Makefile.am | 4 ++--
4 files changed, 19 insertions(+), 24 deletions(-)
---
diff --git a/config.h.in b/config.h.in
index 5413c06..8a2924d 100644
--- a/config.h.in
+++ b/config.h.in
@@ -93,6 +93,9 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
+/* Defined when tests are to be built */
+#undef TESTS_ENABLED
+
/* Version number of package */
#undef VERSION
@@ -104,6 +107,3 @@
/* Define if mDNS/DNS-SD implementation uses Howl */
#undef WITH_HOWL
-
-/* Defined when tests are to be built */
-#undef WITH_TESTS
diff --git a/configure.ac b/configure.ac
index a533c01..47bc7af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,10 +69,19 @@ AC_CONFIG_MACRO_DIR(m4)
dnl Test if --disable-tests given
AC_ARG_ENABLE(tests, [AC_HELP_STRING([--disable-tests],[do not build tests])], tests=$enableval, tests=yes)
if test x$tests = xyes; then
- AC_DEFINE(WITH_TESTS,1,[Defined when tests are to be built])
- AM_CONDITIONAL(WITH_TESTS, true)
+ PKG_CHECK_MODULES([CHECK], [check >= 0.9.4],have_check=yes,have_check=no)
+ AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
+ if test "x$have_check" = "xyes"; then
+ AC_DEFINE(HAVE_CHECK, 1, [Define if check support is enabled])
+ else
+ AC_MSG_ERROR([Must have check library present when tests enabled])
+ fi
+
+ AC_DEFINE(TESTS_ENABLED,1,[Defined when tests are to be built])
+ AM_CONDITIONAL(TESTS_ENABLED, true)
else
- AM_CONDITIONAL(WITH_TESTS, false)
+ AM_CONDITIONAL(TESTS_ENABLED, false)
+ AM_CONDITIONAL(HAVE_CHECK, false)
fi
dnl Now check required packages
@@ -363,17 +372,6 @@ if test -n "$BUILD_DPAPVIEW" ; then
AC_WARN([will not build dpapview])
fi
-AC_ARG_ENABLE(check, [ --disable-check do not build check support], enable_check=$enableval,
enable_check=yes)
-if test x$enable_check = xyes; then
- PKG_CHECK_MODULES([CHECK], [check >= 0.9.4],have_check=yes,have_check=no)
- AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
- if test "x$have_check" = "xyes"; then
- AC_DEFINE(HAVE_CHECK, 1, [Define if check support is enabled])
- fi
-else
- AM_CONDITIONAL(HAVE_CHECK, false)
-fi
-
AC_CHECK_LIB(z, uncompress)
dnl common/m4/dmap-arch.m4
diff --git a/libdmapsharing/Makefile.am b/libdmapsharing/Makefile.am
index e2dc51e..239465b 100644
--- a/libdmapsharing/Makefile.am
+++ b/libdmapsharing/Makefile.am
@@ -26,11 +26,7 @@ libdmapsharing_4_0_la_SOURCES = \
dmap-image-record.c \
dmap-image-share.c
-# These used to be guarded by HAVE_CHECK. However, test-dmap-client.c
-# and test-dmap-server.c require them. Thus we now build them into
-# libdmapsharing unconditionally. Perhaps the name should involve
-# "reference" rather than "test," and perhaps these could be made
-# a little more useful in the general case.
+if TESTS_ENABLED
libdmapsharing_4_0_la_SOURCES += \
test-dmap-av-record.c \
test-dmap-av-record-factory.c \
@@ -39,6 +35,7 @@ libdmapsharing_4_0_la_SOURCES += \
test-dmap-db.c \
test-dmap-image-record.c \
test-dmap-image-record-factory.c
+endif
if USE_HOWL
libdmapsharing_4_0_la_SOURCES += \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7f881b2..0e19ec2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,4 @@
-if WITH_TESTS
+if TESTS_ENABLED
noinst_PROGRAMS = test-dmap-client test-dmap-server
if HAVE_GEE
@@ -41,7 +41,7 @@ test_dmap_server_LDADD = \
$(MDNS_LIBS)
if HAVE_VALAC
-if WITH_TESTS
+if TESTS_ENABLED
BUILT_SOURCES = dacplisten.stamp dpapview.stamp dmapcopy.stamp dmapserve.stamp
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]