tests/dbus-runner: Add way to launch custom services
This will be used by CI to launch wireplumber inside the D-Bus session started by meta-dbus-runner.py. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2678>
This commit is contained in:
parent
562024f746
commit
ec18a1d7ae
@ -26,7 +26,7 @@ class MutterDBusRunner(DBusTestCase):
|
|||||||
return os.path.join(os.path.dirname(__file__), 'dbusmock-templates')
|
return os.path.join(os.path.dirname(__file__), 'dbusmock-templates')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(klass, enable_kvm):
|
def setUpClass(klass, enable_kvm, launch):
|
||||||
klass.templates_dirs = [klass.__get_templates_dir()]
|
klass.templates_dirs = [klass.__get_templates_dir()]
|
||||||
|
|
||||||
klass.mocks = OrderedDict()
|
klass.mocks = OrderedDict()
|
||||||
@ -36,6 +36,11 @@ class MutterDBusRunner(DBusTestCase):
|
|||||||
klass.start_session_bus()
|
klass.start_session_bus()
|
||||||
klass.start_system_bus()
|
klass.start_system_bus()
|
||||||
|
|
||||||
|
print('Launching required services...', file=sys.stderr)
|
||||||
|
klass.service_processes = []
|
||||||
|
for service in launch:
|
||||||
|
klass.service_processes += [subprocess.Popen(service)]
|
||||||
|
|
||||||
print('Starting mocked services...', file=sys.stderr)
|
print('Starting mocked services...', file=sys.stderr)
|
||||||
(klass.mocks_manager, klass.mock_obj) = klass.start_from_local_template(
|
(klass.mocks_manager, klass.mock_obj) = klass.start_from_local_template(
|
||||||
'meta-mocks-manager', {'templates-dir': klass.__get_templates_dir()})
|
'meta-mocks-manager', {'templates-dir': klass.__get_templates_dir()})
|
||||||
@ -61,6 +66,10 @@ class MutterDBusRunner(DBusTestCase):
|
|||||||
mock_server.terminate()
|
mock_server.terminate()
|
||||||
mock_server.wait()
|
mock_server.wait()
|
||||||
|
|
||||||
|
for process in klass.service_processes:
|
||||||
|
process.terminate()
|
||||||
|
process.wait()
|
||||||
|
|
||||||
DBusTestCase.tearDownClass()
|
DBusTestCase.tearDownClass()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -189,13 +198,14 @@ def meta_run(klass):
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--kvm', action='store_true', default=False)
|
parser.add_argument('--kvm', action='store_true', default=False)
|
||||||
|
parser.add_argument('--launch', action='append', default=[])
|
||||||
(args, rest) = parser.parse_known_args(sys.argv)
|
(args, rest) = parser.parse_known_args(sys.argv)
|
||||||
|
|
||||||
rest.pop(0)
|
rest.pop(0)
|
||||||
if rest[0] == '--':
|
if rest[0] == '--':
|
||||||
rest.pop(0)
|
rest.pop(0)
|
||||||
|
|
||||||
klass.setUpClass(args.kvm)
|
klass.setUpClass(args.kvm, args.launch)
|
||||||
runner = klass()
|
runner = klass()
|
||||||
runner.assertGreater(len(rest), 0)
|
runner.assertGreater(len(rest), 0)
|
||||||
result = 1
|
result = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user