mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
tests: poison $HOME and $XDG_RUNTIME_DIR env variables
To attempt to catch unit tests which accidentally create files in $HOME, or $XDG_RUNTIME_DIR, poison these env vars by pointing them to directories which don't exist. This should give easier to debug test failures. For example: $ VIR_TEST_DEBUG=1 ./qemuhotplugtest Could not initialize HostdevManager - operation failed: Failed to create state dir '/bad-test-used-env-xdg-runtime-dir/libvirt/hostdevmgr' Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
e26bfd9620
commit
f28fbb05d3
@ -767,6 +767,9 @@ int virTestMain(int argc,
|
|||||||
preloads[npreloads] = NULL;
|
preloads[npreloads] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_setenv("HOME", "/bad-test-used-env-home", TRUE);
|
||||||
|
g_setenv("XDG_RUNTIME_DIR", "/bad-test-used-env-xdg-runtime-dir", TRUE);
|
||||||
|
|
||||||
va_start(ap, func);
|
va_start(ap, func);
|
||||||
while ((lib = va_arg(ap, const char *))) {
|
while ((lib = va_arg(ap, const char *))) {
|
||||||
if (!virFileIsExecutable(lib)) {
|
if (!virFileIsExecutable(lib)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user