mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04: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
1 changed files with 3 additions and 5 deletions
|
|
@ -521,8 +521,6 @@ static int remove_file(const char *fpath, const struct stat *sb, int typeflag, s
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/* Safety check: bail out if somehow we left TMPDIR */
|
/* Safety check: bail out if somehow we left TMPDIR */
|
||||||
if (!tmpdir)
|
|
||||||
tmpdir = "/tmp";
|
|
||||||
spa_assert(spa_strneq(fpath, tmpdir, strlen(tmpdir)));
|
spa_assert(spa_strneq(fpath, tmpdir, strlen(tmpdir)));
|
||||||
|
|
||||||
r = remove(fpath);
|
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
|
/* Safety checks, we really don't want to recursively remove a
|
||||||
* random directory due to a bug */
|
* random directory due to a bug */
|
||||||
if (!tmpdir)
|
|
||||||
tmpdir = "/tmp";
|
|
||||||
|
|
||||||
spa_assert(spa_strneq(xdg_dir, tmpdir, strlen(tmpdir)));
|
spa_assert(spa_strneq(xdg_dir, tmpdir, strlen(tmpdir)));
|
||||||
r = spa_scnprintf(path, sizeof(path), "%s/pwtest.dir", xdg_dir);
|
r = spa_scnprintf(path, sizeof(path), "%s/pwtest.dir", xdg_dir);
|
||||||
spa_assert((size_t)r == strlen(xdg_dir) + 11);
|
spa_assert((size_t)r == strlen(xdg_dir) + 11);
|
||||||
|
|
@ -1264,6 +1259,9 @@ int main(int argc, char **argv)
|
||||||
find_suites(ctx, suite_filter);
|
find_suites(ctx, suite_filter);
|
||||||
add_tests(ctx);
|
add_tests(ctx);
|
||||||
|
|
||||||
|
if (getenv("TMPDIR") == NULL)
|
||||||
|
setenv("TMPDIR", "/tmp", 1);
|
||||||
|
|
||||||
ctx->xdg_dir = make_xdg_runtime_dir();
|
ctx->xdg_dir = make_xdg_runtime_dir();
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue