Rename $TEST_DIR to $SYSTEMD_TEST_DATA, document it

TEST_DIR is rather generic, and we prefix all variables used by installed
executables with "SYSTEMD_".
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-02-14 19:17:38 -05:00 committed by Martin Pitt
parent 3e29e810ae
commit 94fa1497ba
4 changed files with 8 additions and 3 deletions

View File

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

View File

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

View File

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

View File

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