diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-12-06 21:51:59 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-03-19 16:23:27 +0100 |
commit | 7b4329534688612dce829afb5088298e734f5086 (patch) | |
tree | 8fd27ebeb7ded7a6f5a4b679f2e7db817a3448ff /src/shared/tests.c | |
parent | cc46b9d91399aed39eb64fa07283e40eb8262078 (diff) | |
download | systemd-7b4329534688612dce829afb5088298e734f5086.tar.gz |
tests: move unit files to units/ subdirectory
We have a bazillion of those unit files, and keeping them all directly in tests/
has become rather unwieldy.
Diffstat (limited to 'src/shared/tests.c')
-rw-r--r-- | src/shared/tests.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/shared/tests.c b/src/shared/tests.c index 96b5b805a9..764e4656bb 100644 --- a/src/shared/tests.c +++ b/src/shared/tests.c @@ -58,21 +58,25 @@ static void load_testdata_env(void) { setenv(*k, *v, 0); } -const char* get_testdata_dir(void) { - const char *env; +int get_testdata_dir(const char *suffix, char **ret) { + const char *dir; + char *p; load_testdata_env(); /* if the env var is set, use that */ - env = getenv("SYSTEMD_TEST_DATA"); - if (!env) - env = SYSTEMD_TEST_DATA; - if (access(env, F_OK) < 0) { - fprintf(stderr, "ERROR: $SYSTEMD_TEST_DATA directory [%s] does not exist\n", env); - exit(EXIT_FAILURE); - } + dir = getenv("SYSTEMD_TEST_DATA"); + if (!dir) + dir = SYSTEMD_TEST_DATA; + if (access(dir, F_OK) < 0) + return log_error_errno(errno, "ERROR: $SYSTEMD_TEST_DATA directory [%s] not accesible: %m", dir); - return env; + p = path_join(dir, suffix); + if (!p) + return log_oom(); + + *ret = p; + return 0; } const char* get_catalog_dir(void) { |