From 4f8425b8d5a3fb2e5ec24b77f1a7a95db55f532c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 12 Feb 2017 23:53:53 +0100 Subject: [PATCH] buildsys: add "install-tests" target 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 | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 489cf3c1b73..c45755f36ec 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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) -- 2.47.3