summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorMartin Pitt <martin@piware.de>2017-02-12 23:14:43 +0100
committerMartin Pitt <martin@piware.de>2017-02-13 22:31:13 +0100
commitf853c6efb509589c8e3a82caa3af2ac5a370ae97 (patch)
tree4b5e46c4dfc6a9dfd701db8c29975d546b0b9ece /Makefile.am
parentee3c7ff7c303cdbc8fea18d3a6f3c4c6e7c450d8 (diff)
test: make unit tests relocatable
It is useful to package test-* binaries and run them as root under autopkgtest or manually on particular machines. They currently have a built-in hardcoded absolute path to their test data, which does not work when running the test programs from any other path than the original build directory. By default, make the tests look for their data in <test_exe_directory>/testdata/ so that they can be called from any directory (provided that the corresponding test data is installed correctly). As we don't have a fixed static path in the build tree (as build and source tree are independent), set $TEST_DIR with "make check" to point to <srcdir>/test/, as we previously did with an automake variable.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am5
1 files changed, 3 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 3c20c9d4bf..489cf3c1b7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -150,6 +150,7 @@ endif
AM_TESTS_ENVIRONMENT = \
export SYSTEMD_KBD_MODEL_MAP=$(abs_top_srcdir)/src/locale/kbd-model-map; \
export SYSTEMD_LANGUAGE_FALLBACK_MAP=$(abs_top_srcdir)/src/locale/language-fallback-map; \
+ export TEST_DIR=$(abs_top_srcdir)/test; \
export PATH=$(abs_top_builddir):$$PATH;
if ENABLE_BASH_COMPLETION
@@ -218,7 +219,6 @@ AM_CPPFLAGS = \
-DLIBDIR=\"$(libdir)\" \
-DROOTLIBDIR=\"$(rootlibdir)\" \
-DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
- -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
-I $(top_srcdir)/src \
-I $(top_builddir)/src/basic \
-I $(top_srcdir)/src/basic \
@@ -5637,7 +5637,8 @@ test_dns_packet_SOURCES = \
$(basic_dns_sources)
test_dns_packet_CPPFLAGS = \
- $(AM_CPPFLAGS)
+ $(AM_CPPFLAGS) \
+ -I $(top_srcdir)/src/test
test_dns_packet_CFLAGS = \
$(AM_CFLAGS) \