mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
test: set PIPEWIRE_REMOTE to a garbage value if we didn't start a test daemon
Don't let tests connect to the system daemon which would happen if we don't have PIPEWIRE_REMOTE set at all.
This commit is contained in:
parent
e01faf42a1
commit
2073269f47
2 changed files with 8 additions and 1 deletions
|
|
@ -145,7 +145,10 @@ static void replace_env(struct pwtest_test *t, const char *prop, const char *val
|
||||||
const char *oldval = getenv(prop);
|
const char *oldval = getenv(prop);
|
||||||
|
|
||||||
pw_properties_set(t->env, prop, oldval ? oldval : "pwtest-null");
|
pw_properties_set(t->env, prop, oldval ? oldval : "pwtest-null");
|
||||||
|
if (value)
|
||||||
setenv(prop, value, 1);
|
setenv(prop, value, 1);
|
||||||
|
else
|
||||||
|
unsetenv(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void restore_env(struct pwtest_test *t)
|
static void restore_env(struct pwtest_test *t)
|
||||||
|
|
@ -780,6 +783,8 @@ static void run_test(struct pwtest_context *ctx, struct pwtest_suite *c, struct
|
||||||
errno = -pw_daemon;
|
errno = -pw_daemon;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
replace_env(t, "PIPEWIRE_REMOTE", "test-has-no-daemon");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->no_fork) {
|
if (ctx->no_fork) {
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,8 @@ PWTEST(default_env_test)
|
||||||
{
|
{
|
||||||
/* This one is set automatically */
|
/* This one is set automatically */
|
||||||
pwtest_str_eq(getenv("PWTEST"), "1");
|
pwtest_str_eq(getenv("PWTEST"), "1");
|
||||||
|
/* Default value */
|
||||||
|
pwtest_str_eq(getenv("PIPEWIRE_REMOTE"), "test-has-no-daemon");
|
||||||
|
|
||||||
return PWTEST_PASS;
|
return PWTEST_PASS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue