[systemd-devel] [PATCH v4] buildsys: Add --disable-tests to avoid building tests

Henrik Grindal Bakken hgb at ifi.uio.no
Thu Apr 18 05:40:24 PDT 2013


This patch adds --disable-tests to configure.  It is based on a patch
posted by Thierry Reding in 2010.  The motivation for adding it is that
some tests fail link-time when cross-compiling.

The patch adds a new Makefile variable -- manual_tests -- and uses
that instead of noinst_PROGRAMS.  However, if ENABLE_TESTS is true,
the former is added to the latter.  It also renames noinst_tests to
simply tests.
---
 Makefile.am  |   30 ++++++++++++++++++------------
 configure.ac |    5 +++++
 2 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 7b4b2d8..80d0f1f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -124,9 +124,15 @@ dbusinterface_DATA =
 dist_dbussystemservice_DATA =
 check_PROGRAMS =
 check_DATA =
-noinst_tests=
-noinst_PROGRAMS = $(noinst_tests)
-TESTS = $(noinst_tests)
+tests=
+manual_tests =
+if ENABLE_TESTS
+noinst_PROGRAMS = $(manual_tests) $(tests)
+TESTS = $(tests)
+else
+noinst_PROGRAMS =
+TESTS =
+endif
 udevlibexec_PROGRAMS =
 
 AM_CPPFLAGS = \
@@ -1063,7 +1069,7 @@ CLEANFILES += \
 	src/core/org.freedesktop.systemd1.policy.in
 
 # ------------------------------------------------------------------------------
-noinst_PROGRAMS += \
+manual_tests += \
 	test-engine \
 	test-ns \
 	test-loopback \
@@ -1074,7 +1080,7 @@ noinst_PROGRAMS += \
 	test-watchdog \
 	test-log
 
-noinst_tests += \
+tests += \
 	test-job-type \
 	test-env-replace \
 	test-strbuf \
@@ -1145,7 +1151,7 @@ test_hostname_LDADD = \
 	libsystemd-core.la
 
 if ENABLE_EFI
-noinst_PROGRAMS += \
+manual_tests += \
 	test-efivars
 
 test_efivars_SOURCES = \
@@ -1726,7 +1732,7 @@ libsystemd_bus_la_LIBADD =  \
 noinst_LTLIBRARIES += \
 	libsystemd-bus.la
 
-noinst_tests += \
+tests += \
 	test-bus-marshal \
 	test-bus-signature \
 	test-bus-chat \
@@ -2074,7 +2080,7 @@ TESTS += \
 	test/udev-test.pl \
 	test/rules-test.sh
 
-noinst_PROGRAMS += \
+manual_tests += \
 	test-libudev \
 	test-udev
 
@@ -2527,7 +2533,7 @@ test_id128_LDADD = \
 	libsystemd-shared.la \
 	libsystemd-id128-internal.la
 
-noinst_tests += \
+tests += \
 	test-id128
 
 pkginclude_HEADERS += \
@@ -2835,10 +2841,10 @@ catalog-remove-hook:
 UNINSTALL_DATA_HOOKS += \
 	catalog-remove-hook
 
-noinst_PROGRAMS += \
+manual_tests += \
 	test-journal-enum
 
-noinst_tests += \
+tests += \
 	test-journal \
 	test-journal-send \
 	test-journal-syslog \
@@ -3536,7 +3542,7 @@ test_inhibit_CFLAGS = \
 	$(AM_CFLAGS) \
 	$(DBUS_CFLAGS)
 
-noinst_PROGRAMS += \
+manual_tests += \
 	test-login \
 	test-inhibit
 
diff --git a/configure.ac b/configure.ac
index 519f1a9..aec85ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -880,6 +880,11 @@ AS_IF([test "x$0" != "x./configure"], [
         AC_SUBST([INTLTOOL_UPDATE], [/bin/true])
 ])
 
+AC_ARG_ENABLE(tests,
+       [AC_HELP_STRING([--disable-tests], [disable tests])],
+       enable_tests=$enableval, enable_tests=yes)
+AM_CONDITIONAL(ENABLE_TESTS, [test x$enable_tests = xyes])
+
 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
-- 
1.7.10.1



More information about the systemd-devel mailing list