]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/test/test-path.c
tests: override XDG_RUNTIME_DIR where we use the user runtime dir
[thirdparty/systemd.git] / src / test / test-path.c
index e0c8db50ae866a78eb7658571055a6d588a97a4b..435cafd83afc5b13ad3bc8ba451fbdc91eff8af0 100644 (file)
@@ -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++) {