mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-06 16:09:43 +00:00
test: force TMPDIR to /tmp if it is unset
This way we can rely on it everywhere without having multiple checks for it.
This commit is contained in:
parent
00bc5f0e3b
commit
3c798ea413
|
@ -521,8 +521,6 @@ static int remove_file(const char *fpath, const struct stat *sb, int typeflag, s
|
|||
int r;
|
||||
|
||||
/* Safety check: bail out if somehow we left TMPDIR */
|
||||
if (!tmpdir)
|
||||
tmpdir = "/tmp";
|
||||
spa_assert(spa_strneq(fpath, tmpdir, strlen(tmpdir)));
|
||||
|
||||
r = remove(fpath);
|
||||
|
@ -543,9 +541,6 @@ static void remove_xdg_runtime_dir(const char *xdg_dir)
|
|||
|
||||
/* Safety checks, we really don't want to recursively remove a
|
||||
* random directory due to a bug */
|
||||
if (!tmpdir)
|
||||
tmpdir = "/tmp";
|
||||
|
||||
spa_assert(spa_strneq(xdg_dir, tmpdir, strlen(tmpdir)));
|
||||
r = spa_scnprintf(path, sizeof(path), "%s/pwtest.dir", xdg_dir);
|
||||
spa_assert((size_t)r == strlen(xdg_dir) + 11);
|
||||
|
@ -1264,6 +1259,9 @@ int main(int argc, char **argv)
|
|||
find_suites(ctx, suite_filter);
|
||||
add_tests(ctx);
|
||||
|
||||
if (getenv("TMPDIR") == NULL)
|
||||
setenv("TMPDIR", "/tmp", 1);
|
||||
|
||||
ctx->xdg_dir = make_xdg_runtime_dir();
|
||||
|
||||
switch (mode) {
|
||||
|
|
Loading…
Reference in a new issue