Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[GTK] The Xvfb display server may fail to start sometimes causing tes…
…ts to randomly crash https://bugs.webkit.org/show_bug.cgi?id=229758 Reviewed by Philippe Normand. Add a new function in XvfbDriver() to ensure that the display server at a given display_id is replying as expected. Ask it for the screen size at monitor 0 and compare the result with the one we expect to have inside Xvfb. For doing this check a external python program is called which does the query using GTK. Using a external program is more robust against possible failures calling into GTK and also will allow re-using this program also to check that the weston server is also replying as expected for the weston driver (on a future patch). If the Xvfb driver is not replying as expected then restart it and try again, up to 3 retries. Use this also on the weston driver to check that the Xvfb driver is ready. * Scripts/webkitpy/common/system/executive_mock.py: (MockProcess.__init__): (MockProcess.communicate): * Scripts/webkitpy/port/westondriver.py: (WestonDriver._setup_environ_for_test): * Scripts/webkitpy/port/westondriver_unittest.py: (WestonXvfbDriverDisplayTest._xvfb_check_if_ready): * Scripts/webkitpy/port/xvfbdriver.py: (XvfbDriver): (XvfbDriver.__init__): (XvfbDriver.check_driver): (XvfbDriver._xvfb_run): (XvfbDriver._xvfb_screen_size): (XvfbDriver._xvfb_stop): (XvfbDriver._xvfb_check_if_ready): (XvfbDriver._setup_environ_for_test): (XvfbDriver.has_crashed): (XvfbDriver.stop): * Scripts/webkitpy/port/xvfbdriver_unittest.py: (XvfbDriverTest.make_driver): (XvfbDriverTest.assertDriverStartSuccessful): (XvfbDriverTest.test_xvfb_start_and_ready): (XvfbDriverTest.test_xvfb_start_arbitrary_worker_number): (XvfbDriverTest.test_xvfb_not_replying): * gtk/print-screen-size: Added. Canonical link: https://commits.webkit.org/241200@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281870 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
236 additions
and 25 deletions.
- +48 −0 Tools/ChangeLog
- +6 −4 Tools/Scripts/webkitpy/common/system/executive_mock.py
- +12 −1 Tools/Scripts/webkitpy/port/westondriver.py
- +3 −0 Tools/Scripts/webkitpy/port/westondriver_unittest.py
- +87 −12 Tools/Scripts/webkitpy/port/xvfbdriver.py
- +26 −8 Tools/Scripts/webkitpy/port/xvfbdriver_unittest.py
- +54 −0 Tools/gtk/print-screen-size
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright (C) 2021 Igalia S.L. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# | ||
# 1. Redistributions of source code must retain the above copyright notice, this | ||
# list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright notice, | ||
# this list of conditions and the following disclaimer in the documentation | ||
# and/or other materials provided with the distribution. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
import argparse | ||
import sys | ||
import gi | ||
gi.require_version('Gtk', '3.0') | ||
gi.require_version('Gdk', '3.0') | ||
from gi.repository import Gtk, Gdk | ||
|
||
|
||
def print_screen_size(monitor_id): | ||
display = Gdk.Display.get_default() | ||
if not display: | ||
print('Unable to find a display') | ||
return 1 | ||
monitor = display.get_monitor(monitor_id) | ||
if not monitor: | ||
print('Unable to find a monitor') | ||
return 1 | ||
geometry = monitor.get_geometry() | ||
print('{}x{}'.format(geometry.width, geometry.height)) | ||
return 0 | ||
|
||
|
||
# This tool is used from the layout tests when running with the Xvfb driver, | ||
# in order to check that the Xvfb server is alive and configured as expected. | ||
# Please, don't modify this tool without checking first how it is used at webkitpy/port/xvfbdriver.py | ||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='Print the current display size (widthxheight) of a given monitor') | ||
parser.add_argument("-n", type=int, help='Number of the monitor the query', default=0) | ||
args = parser.parse_args() | ||
sys.exit(print_screen_size(args.n)) |