summaryrefslogtreecommitdiffstats
path: root/src/test/test-path.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-08 18:54:05 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-12 13:43:33 +0200
commitd2120590ffdcc041f098667355ca3db5161d25d9 (patch)
tree9e5b921b5023e7eb40f7812161f285c49da45039 /src/test/test-path.c
parentcore: optimize unit_write_drop_in a bit (diff)
downloadsystemd-d2120590ffdcc041f098667355ca3db5161d25d9.tar.xz
systemd-d2120590ffdcc041f098667355ca3db5161d25d9.zip
tests: override XDG_RUNTIME_DIR where we use the user runtime dir
We don#t really support systems where XDG_RUNTIME_DIR is not supported for systemd --user. Hence, let's always set our own XDG_RUNTIME_DIR for tests that involve systemd --user, so that we know it is set, and that it doesn't polute the user's actual runtime dir.
Diffstat (limited to 'src/test/test-path.c')
-rw-r--r--src/test/test-path.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/test-path.c b/src/test/test-path.c
index e0c8db50ae..435cafd83a 100644
--- a/src/test/test-path.c
+++ b/src/test/test-path.c
@@ -30,6 +30,7 @@
#include "string-util.h"
#include "strv.h"
#include "test-helper.h"
+#include "tests.h"
#include "unit.h"
#include "util.h"
@@ -243,7 +244,7 @@ static void test_path_makedirectory_directorymode(Manager *m) {
}
int main(int argc, char *argv[]) {
- test_function_t tests[] = {
+ static const test_function_t tests[] = {
test_path_exists,
test_path_existsglob,
test_path_changed,
@@ -253,12 +254,15 @@ int main(int argc, char *argv[]) {
test_path_makedirectory_directorymode,
NULL,
};
- test_function_t *test = NULL;
+
+ _cleanup_(rm_rf_and_freep) char *runtime_dir = NULL;
+ const test_function_t *test = NULL;
Manager *m = NULL;
log_parse_environment();
log_open();
+ assert_se(runtime_dir = setup_fake_runtime_dir());
assert_se(set_unit_path(TEST_DIR "/test-path/") >= 0);
for (test = tests; test && *test; test++) {