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.
This commit is contained in:
Lennart Poettering
2016-04-12 13:43:33 +02:00
parent 815b09d39b
commit d2120590ff
9 changed files with 94 additions and 3 deletions
+9
View File
@@ -30,3 +30,12 @@ typedef enum RemoveFlags {
int rm_rf_children(int fd, RemoveFlags flags, struct stat *root_dev);
int rm_rf(const char *path, RemoveFlags flags);
/* Useful for usage with _cleanup_(), destroys a directory and frees the pointer */
static inline void rm_rf_and_free(char *p) {
if (!p)
return;
(void) rm_rf(p, REMOVE_ROOT);
free(p);
}
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, rm_rf_and_free);