ci: start the dbus mock server in GN CI

This commit is contained in:
Jeremy Apthorp 2018-07-31 12:20:53 -07:00
parent a4f02724bf
commit 00b2d94785
3 changed files with 18 additions and 9 deletions

View file

@ -208,7 +208,7 @@ gn-build-steps: &gn-build-steps
ninja -C out/Default electron/build/node:headers
export npm_config_nodedir="$PWD/out/Default/gen/node_headers"
(cd electron/spec && npm install)
./out/Default/electron electron/spec --ci --enable-logging
python electron/script/lib/dbus_mock.py ./out/Default/electron electron/spec --ci --enable-logging
- store_test_results:
path: src/junit
- store_artifacts:

View file

@ -6,13 +6,11 @@ import os
import sys
def cleanup():
def stop():
DBusTestCase.stop_dbus(DBusTestCase.system_bus_pid)
DBusTestCase.stop_dbus(DBusTestCase.session_bus_pid)
atexit.register(cleanup)
def start():
dbusmock_log = sys.stdout if is_verbose_mode() else open(os.devnull, 'w')
DBusTestCase.start_system_bus()
@ -20,3 +18,11 @@ DBusTestCase.spawn_server_template('logind', None, dbusmock_log)
DBusTestCase.start_session_bus()
DBusTestCase.spawn_server_template('notification_daemon', None, dbusmock_log)
if __name__ == '__main__':
import subprocess
start()
try:
subprocess.check_call(sys.argv[1:])
finally:
stop()

View file

@ -18,6 +18,9 @@ if sys.platform == 'linux2':
# will be picked up by electron.
try:
import lib.dbus_mock
import atexit
lib.dbus_mock.start()
atexit.register(lib.dbus_mock.stop)
except ImportError:
# If not available, the powerMonitor tests will be skipped since
# DBUS_SYSTEM_BUS_ADDRESS will not be set