diff --git a/src/tests/mutter_dbusrunner.py b/src/tests/mutter_dbusrunner.py index 5f21bd2c5..7de4653bb 100644 --- a/src/tests/mutter_dbusrunner.py +++ b/src/tests/mutter_dbusrunner.py @@ -26,7 +26,7 @@ class MutterDBusRunner(DBusTestCase): return os.path.join(os.path.dirname(__file__), 'dbusmock-templates') @classmethod - def setUpClass(klass, enable_kvm): + def setUpClass(klass, enable_kvm, launch): klass.templates_dirs = [klass.__get_templates_dir()] klass.mocks = OrderedDict() @@ -36,6 +36,11 @@ class MutterDBusRunner(DBusTestCase): klass.start_session_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) (klass.mocks_manager, klass.mock_obj) = klass.start_from_local_template( 'meta-mocks-manager', {'templates-dir': klass.__get_templates_dir()}) @@ -61,6 +66,10 @@ class MutterDBusRunner(DBusTestCase): mock_server.terminate() mock_server.wait() + for process in klass.service_processes: + process.terminate() + process.wait() + DBusTestCase.tearDownClass() @classmethod @@ -189,13 +198,14 @@ def meta_run(klass): parser = argparse.ArgumentParser() parser.add_argument('--kvm', action='store_true', default=False) + parser.add_argument('--launch', action='append', default=[]) (args, rest) = parser.parse_known_args(sys.argv) rest.pop(0) if rest[0] == '--': rest.pop(0) - klass.setUpClass(args.kvm) + klass.setUpClass(args.kvm, args.launch) runner = klass() runner.assertGreater(len(rest), 0) result = 1