]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
buildsys: add "install-tests" target 5298/head
authorMartin Pitt <martin@piware.de>
Sun, 12 Feb 2017 22:53:53 +0000 (23:53 +0100)
committerMartin Pitt <martin@piware.de>
Mon, 13 Feb 2017 21:40:11 +0000 (22:40 +0100)
Add a new "install-tests" make target that installs our unit test-*
executables and their test data files into /usr/lib/systemd/tests/.
This is useful for packaging the tests to run them with root privileges
or in CI.

Fixes #5257

Makefile.am

index 489cf3c1b73114b199efaa63668df4a9b7117d10..c45755f36ec73bd7d76a6df687c0daf6092f94fe 100644 (file)
@@ -93,6 +93,7 @@ kernelinstalldir = $(prefix)/lib/kernel/install.d
 factory_etcdir = $(datadir)/factory/etc
 factory_pamdir = $(datadir)/factory/etc/pam.d
 bootlibdir = $(prefix)/lib/systemd/boot/efi
+testsdir = $(prefix)/lib/systemd/tests
 
 # And these are the special ones for /
 rootprefix=@rootprefix@
@@ -133,6 +134,7 @@ check_DATA =
 dist_rootlibexec_DATA =
 tests=
 manual_tests =
+TEST_DATA_FILES =
 TEST_EXTENSIONS = .py
 PY_LOG_COMPILER = $(PYTHON)
 DISABLE_HARD_ERRORS = yes
@@ -1606,7 +1608,7 @@ tests += \
        test-seccomp
 endif
 
-EXTRA_DIST += \
+TEST_DATA_FILES += \
        test/a.service \
        test/basic.target \
        test/b.service \
@@ -5649,7 +5651,7 @@ test_dns_packet_LDADD = \
        $(GCRYPT_LIBS) \
        -lm
 
-EXTRA_DIST += \
+TEST_DATA_FILES += \
        test/test-resolve/_openpgpkey.fedoraproject.org.pkts \
        test/test-resolve/fedoraproject.org.pkts \
        test/test-resolve/gandi.net.pkts \
@@ -5662,6 +5664,8 @@ EXTRA_DIST += \
        test/test-resolve/kyhwana.org.pkts \
        test/test-resolve/fake-caa.pkts
 
+EXTRA_DIST += $(TEST_DATA_FILES)
+
 test_dnssec_SOURCES = \
        src/resolve/test-dnssec.c \
        $(basic_dns_sources)
@@ -6694,6 +6698,20 @@ tests += \
        test-libsystemd-sym \
        test-libudev-sym
 
+.PHONY: install-tests
+install-tests: $(tests) $(TEST_DATA_FILES)
+       for f in $(tests); do \
+           if [ -x .libs/$$f ]; then \
+               install -D -m 755 .libs/$$f $(DESTDIR)/$(testsdir)/$$f; \
+           else \
+               install -D -m 755 $$f $(DESTDIR)/$(testsdir)/$$f; \
+           fi; \
+       done
+       for f in $(TEST_DATA_FILES); do \
+           install -D -m 644 $$f $(DESTDIR)/$(testsdir)/testdata/$${f#test/}; \
+       done
+
+
 .PHONY: cppcheck
 cppcheck:
        cppcheck --enable=all -q $(top_srcdir)