summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ENVIRONMENT.md5
-rw-r--r--Makefile.am2
-rw-r--r--src/shared/tests.c2
-rw-r--r--src/test/test-helper.h2
4 files changed, 8 insertions, 3 deletions
diff --git a/ENVIRONMENT.md b/ENVIRONMENT.md
index 1ad2addfee..e542d4ec6f 100644
--- a/ENVIRONMENT.md
+++ b/ENVIRONMENT.md
@@ -59,3 +59,8 @@ systemd-logind:
* `$SYSTEMD_BYPASS_HIBERNATION_MEMORY_CHECK=1` — if set, report that
hibernation is available even if the swap devices do not provide enough room
for it.
+
+installed systemd tests:
+
+* `$SYSTEMD_TEST_DATA` — override the location of test data. This is useful if
+ a test executable is moved to an arbitrary location.
diff --git a/Makefile.am b/Makefile.am
index c725d6d1ac..a0eda73cb4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -152,7 +152,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 SYSTEMD_TEST_DATA=$(abs_top_srcdir)/test; \
export PATH=$(abs_top_builddir):$$PATH;
if ENABLE_BASH_COMPLETION
diff --git a/src/shared/tests.c b/src/shared/tests.c
index 189aa36bc6..bae113bdc8 100644
--- a/src/shared/tests.c
+++ b/src/shared/tests.c
@@ -43,7 +43,7 @@ const char* get_exe_relative_testdata_dir(void) {
assert_se(readlink_and_make_absolute("/proc/self/exe", &exedir) >= 0);
assert_se(snprintf(testdir, sizeof(testdir), "%s/testdata", dirname(exedir)) > 0);
if (access(testdir, F_OK) < 0) {
- fprintf(stderr, "Test data directory '%s' does not exist, set $TEST_DIR\n", testdir);
+ fprintf(stderr, "Test data directory '%s' does not exist, set $SYSTEMD_TEST_DATA\n", testdir);
exit(1);
}
return testdir;
diff --git a/src/test/test-helper.h b/src/test/test-helper.h
index 4e633ae6d8..02608434be 100644
--- a/src/test/test-helper.h
+++ b/src/test/test-helper.h
@@ -43,4 +43,4 @@
)
#define TEST_DATA_DIR(subdir) \
- strjoina(getenv("TEST_DIR") ?: get_exe_relative_testdata_dir(), subdir)
+ strjoina(getenv("SYSTEMD_TEST_DATA") ?: get_exe_relative_testdata_dir(), subdir)