[libvirt] [dbus PATCH] tests: Explicitly spawn a session libvirt-dbus instance

Andrea Bolognani abologna at redhat.com
Wed Jul 18 09:50:33 UTC 2018


Tests are performed using the session D-Bus instance, so we
should launch libvirt-dbus in session mode as well.

This was working fine when running the tests as a regular
user, because in that case libvirt-dbus would default to
session mode, but fail when running them as root because
libvirt-dbus would run in system mode and consequently not
show up on the session bus.

Of course building and runnning the test suite as root is
a pretty bad idea in general, but a lot of distributions
run at least part of their package build steps with pretend
root privileges (eg. fakeroot), so we have to make sure it
works in that scenario too.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 tests/libvirttest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/libvirttest.py b/tests/libvirttest.py
index 3741abd..4653055 100644
--- a/tests/libvirttest.py
+++ b/tests/libvirttest.py
@@ -33,7 +33,7 @@ class BaseTestClass():
         """Start libvirt-dbus for each test function
         """
         os.environ['LIBVIRT_DEBUG'] = '3'
-        self.libvirt_dbus = subprocess.Popen([exe])
+        self.libvirt_dbus = subprocess.Popen([exe, '--session'])
         self.bus = dbus.SessionBus()
 
         for i in range(10):
-- 
2.17.1




More information about the libvir-list mailing list