mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-08 12:28:00 +02:00
linux: Allow running upowerd under valgrind in tests
This commit is contained in:
parent
caf53bd982
commit
c5d1660b5c
1 changed files with 10 additions and 1 deletions
|
|
@ -66,6 +66,7 @@ class Tests(unittest.TestCase):
|
|||
if os.access(os.path.join(builddir, 'src', 'upowerd'), os.X_OK):
|
||||
cls.daemon_path = os.path.join(builddir, 'src', 'upowerd')
|
||||
print('Testing binaries from local build tree')
|
||||
cls.local_daemon = True
|
||||
else:
|
||||
print('Testing installed system binaries')
|
||||
cls.daemon_path = None
|
||||
|
|
@ -75,6 +76,7 @@ class Tests(unittest.TestCase):
|
|||
cls.daemon_path = line.split('=', 1)[1].strip()
|
||||
break
|
||||
assert cls.daemon_path, 'could not determine daemon path from D-BUS .service file'
|
||||
cls.local_daemon = False
|
||||
|
||||
# fail on CRITICALs on client side
|
||||
GLib.log_set_always_fatal(GLib.LogLevelFlags.LEVEL_WARNING |
|
||||
|
|
@ -138,7 +140,14 @@ class Tests(unittest.TestCase):
|
|||
# have to do that ourselves
|
||||
env['UMOCKDEV_DIR'] = self.testbed.get_root_dir()
|
||||
self.log = tempfile.NamedTemporaryFile()
|
||||
self.daemon = subprocess.Popen([self.daemon_path, '-v'],
|
||||
if os.getenv('VALGRIND') != None:
|
||||
if self.local_daemon:
|
||||
daemon_path = ['libtool', '--mode=execute', 'valgrind', self.daemon_path, '-v']
|
||||
else:
|
||||
daemon_path = ['valgrind', self.daemon_path, '-v']
|
||||
else:
|
||||
daemon_path = [self.daemon_path, '-v']
|
||||
self.daemon = subprocess.Popen(daemon_path,
|
||||
env=env, stdout=self.log,
|
||||
stderr=subprocess.STDOUT)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue