mirror of
https://github.com/brl/mutter.git
synced 2024-12-29 06:12:14 +00:00
tests/dbus-runner: Detect nested invocations to skip mocking
The test and dist CI jobs run wrap the meson calls in dbus-runner to avoid setting up dbus servers and mocking services for every test but the dbus-runner invocation from meson test didn't actually skip all the setup. This nested mocking also doesn't work because the system bus is assumed to be the host system bus and not a mocked one. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2618>
This commit is contained in:
parent
e848f86514
commit
e21f839776
@ -258,14 +258,15 @@ ret = logind_helpers.open_file_direct(major, minor)
|
|||||||
return template_path
|
return template_path
|
||||||
raise FileNotFoundError(f'Couldnt find a {template_name} template')
|
raise FileNotFoundError(f'Couldnt find a {template_name} template')
|
||||||
|
|
||||||
def wrap_call(self, args):
|
|
||||||
|
def wrap_call(args, wrapper):
|
||||||
env = {}
|
env = {}
|
||||||
env.update(os.environ)
|
env.update(os.environ)
|
||||||
env['NO_AT_BRIDGE'] = '1'
|
env['NO_AT_BRIDGE'] = '1'
|
||||||
env['GTK_A11Y'] = 'none'
|
env['GTK_A11Y'] = 'none'
|
||||||
env['GSETTINGS_BACKEND'] = 'memory'
|
env['GSETTINGS_BACKEND'] = 'memory'
|
||||||
|
env['META_DBUS_RUNNER_ACTIVE'] = '1'
|
||||||
|
|
||||||
wrapper = env.get('META_DBUS_RUNNER_WRAPPER')
|
|
||||||
if wrapper == 'gdb':
|
if wrapper == 'gdb':
|
||||||
args = ['gdb', '-ex', 'r', '-ex', 'bt full', '--args'] + args
|
args = ['gdb', '-ex', 'r', '-ex', 'bt full', '--args'] + args
|
||||||
elif wrapper:
|
elif wrapper:
|
||||||
@ -287,14 +288,27 @@ def meta_run(klass):
|
|||||||
if rest[0] == '--':
|
if rest[0] == '--':
|
||||||
rest.pop(0)
|
rest.pop(0)
|
||||||
|
|
||||||
|
result = 1
|
||||||
|
|
||||||
|
if os.getenv('META_DBUS_RUNNER_ACTIVE') == None:
|
||||||
klass.setUpClass(args.kvm, args.launch)
|
klass.setUpClass(args.kvm, args.launch)
|
||||||
runner = klass()
|
runner = klass()
|
||||||
runner.assertGreater(len(rest), 0)
|
runner.assertGreater(len(rest), 0)
|
||||||
result = 1
|
wrapper = os.getenv('META_DBUS_RUNNER_WRAPPER')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print('Running test case...', file=sys.stderr)
|
print('Running test case...', file=sys.stderr)
|
||||||
result = runner.wrap_call(rest)
|
result = wrap_call(rest, wrapper)
|
||||||
finally:
|
finally:
|
||||||
MutterDBusRunner.tearDownClass()
|
MutterDBusRunner.tearDownClass()
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
print(('Inside a nested meta-dbus-runner: '
|
||||||
|
'Not re-creating mocked environment.'),
|
||||||
|
file=sys.stderr)
|
||||||
|
print('Running test case...', file=sys.stderr)
|
||||||
|
result = wrap_call(rest, None)
|
||||||
|
finally:
|
||||||
|
pass
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user