Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py |
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py |
| index 28c22b47facd8e800034a402d621384a9ea3ad75..9cc30e69d77998279ff7b03f96ea89b4980c5042 100644 |
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py |
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/linux.py |
| @@ -65,6 +65,7 @@ class LinuxPort(base.Port): |
| if not self.get_option('disable_breakpad'): |
| self._dump_reader = DumpReaderLinux(host, self._build_path()) |
| self._original_home = None |
| + self._xvfb_process = None |
| def additional_driver_flag(self): |
| flags = super(LinuxPort, self).additional_driver_flag() |
| @@ -104,10 +105,12 @@ class LinuxPort(base.Port): |
| def setup_test_run(self): |
| super(LinuxPort, self).setup_test_run() |
| + self._start_xvfb() |
| self._setup_dummy_home_dir() |
| def clean_up_test_run(self): |
| super(LinuxPort, self).clean_up_test_run() |
| + self._stop_xvfb() |
| self._clean_up_dummy_home_dir() |
| # |
| @@ -142,6 +145,32 @@ class LinuxPort(base.Port): |
| self._filesystem.rmtree(dummy_home) |
| self.host.environ['HOME'] = self._original_home |
| + def _start_xvfb(self): |
| + if self._has_x_server(): |
| + return |
| + display = self.host.environ.get('DISPLAY') or ':20' |
|
qyearsley
2017/04/14 18:25:40
This choice of :20 is arbitrary.
Dirk Pranke
2017/04/14 21:44:08
Don't use the existing DISPLAY value, that'll just
qyearsley
2017/04/18 01:02:39
There's one complication here: a collection of new
Dirk Pranke
2017/04/18 02:16:18
OK, good point.
I guess go w/ setting the exsting
qyearsley
2017/04/18 17:58:35
Alright, will do this for now. Added comment about
|
| + self.host.environ['DISPLAY'] = display |
| + _log.debug('Starting Xvfb with display location "%s".', display) |
| + self._xvfb_process = self.host.executive.popen( |
| + ['Xvfb', display, '-screen', '0', '1280x800x24', '-ac', '-dpi', '96'], |
|
qyearsley
2017/04/14 18:25:40
Not sure if all of these options are necessary.
Dirk Pranke
2017/04/18 02:16:18
You need -screen, because you don't want to confli
qyearsley
2017/04/18 17:58:35
Alright, will keep these arguments, later we could
|
| + stderr=self.host.executive.PIPE) |
| + |
| + def _has_x_server(self): |
| + display = self.host.environ.get('DISPLAY') |
| + print display |
| + _log.debug('Checking for X server on display location "%s".', display) |
| + if not display: |
| + return False |
| + exit_code = self.host.executive.run_command( |
| + ['xdpyinfo', '-display', display], return_exit_code=True) |
| + return exit_code == 0 |
| + |
| + def _stop_xvfb(self): |
| + if not self._xvfb_process: |
| + return |
| + _log.debug('Killing Xvfb process pid %d.', self._xvfb_process.pid) |
| + self._xvfb_process.kill() |
|
qyearsley
2017/04/14 18:25:40
Not sure whether it would be prudent to do anythin
Dirk Pranke
2017/04/18 02:16:18
I'd probably call self._xvfb_process.wait() just t
qyearsley
2017/04/18 17:58:35
Done.
|
| + |
| def _path_to_driver(self, target=None): |
| binary_name = self.driver_name() |
| return self._build_path_with_target(target, binary_name) |