buildsys: Add --disable-tests to avoid building tests

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.
This commit is contained in:
Henrik Grindal Bakken 2013-04-18 14:40:24 +02:00 committed by Lennart Poettering
parent 4826f0b7b5
commit cee22bd3cb
2 changed files with 23 additions and 12 deletions

View File

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

View File

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