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.
---
 Makefile.am  |   13 +++++++++++++
 configure.ac |    5 +++++
 2 files changed, 18 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 7b4b2d8..1b51967 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1063,6 +1063,7 @@ CLEANFILES += \
        src/core/org.freedesktop.systemd1.policy.in
 
 # 
------------------------------------------------------------------------------
+if ENABLE_TESTS
 noinst_PROGRAMS += \
        test-engine \
        test-ns \
@@ -1331,6 +1332,8 @@ test_sched_prio_LDADD = \
        libsystemd-core.la \
        libsystemd-daemon.la
 
+endif # ENABLE_TESTS
+
 # 
------------------------------------------------------------------------------
 systemd_initctl_SOURCES = \
        src/initctl/initctl.c
@@ -1726,6 +1729,7 @@ libsystemd_bus_la_LIBADD =  \
 noinst_LTLIBRARIES += \
        libsystemd-bus.la
 
+if ENABLE_TESTS
 noinst_tests += \
        test-bus-marshal \
        test-bus-signature \
@@ -1733,6 +1737,7 @@ noinst_tests += \
        test-bus-server \
        test-bus-match \
        test-bus-kernel
+endif
 
 noinst_PROGRAMS += \
        busctl
@@ -2070,6 +2075,7 @@ hwdb-remove-hook:
        -test -n "$(DESTDIR)" || rm -f /etc/udev/hwdb.bin
 
 # 
------------------------------------------------------------------------------
+if ENABLE_TESTS
 TESTS += \
        test/udev-test.pl \
        test/rules-test.sh
@@ -2077,6 +2083,7 @@ TESTS += \
 noinst_PROGRAMS += \
        test-libudev \
        test-udev
+endif
 
 test_libudev_SOURCES = \
        src/test/test-libudev.c
@@ -2527,8 +2534,10 @@ test_id128_LDADD = \
        libsystemd-shared.la \
        libsystemd-id128-internal.la
 
+if ENABLE_TESTS
 noinst_tests += \
        test-id128
+endif
 
 pkginclude_HEADERS += \
        src/systemd/sd-id128.h
@@ -2835,6 +2844,7 @@ catalog-remove-hook:
 UNINSTALL_DATA_HOOKS += \
        catalog-remove-hook
 
+if ENABLE_TESTS
 noinst_PROGRAMS += \
        test-journal-enum
 
@@ -2847,6 +2857,7 @@ noinst_tests += \
        test-journal-verify \
        test-mmap-cache \
        test-catalog
+endif
 
 pkginclude_HEADERS += \
        src/systemd/sd-journal.h \
@@ -3536,9 +3547,11 @@ test_inhibit_CFLAGS = \
        $(AM_CFLAGS) \
        $(DBUS_CFLAGS)
 
+if ENABLE_TESTS
 noinst_PROGRAMS += \
        test-login \
        test-inhibit
+endif
 
 libsystemd_login_la_SOURCES = \
        src/login/sd-login.c
diff --git a/configure.ac b/configure.ac
index 519f1a9..fbc07c2 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], [build 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

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to