Changeset 202619 in webkit


Ignore:
Timestamp:
Jun 29, 2016 3:31:40 AM (8 years ago)
Author:
clopez@igalia.com
Message:

[GTK][Wayland] Implement support for running the layout tests under a (virtualized) Wayland environment.
https://bugs.webkit.org/show_bug.cgi?id=156716

Reviewed by Carlos Garcia Campos and Michael Catanzaro.

Tools:

  • Scripts/webkitpy/layout_tests/run_webkit_tests.py: Allow to run the layout tests on Wayland by passing --wayland

(parse_args):

  • Scripts/webkitpy/port/gtk.py:

(GtkPort.init):
(GtkPort._driver_class):
(GtkPort.setup_environ_for_server): Set the softgl renderer (now with EGL support) for the wayland tests.
(GtkPort._search_paths): When running inside the wayland environment, use ${port}-wayland as an additional
platform directory for storing the wayland specific layout test results and expectations for ${port}.
For example, the file LayoutTests/platform/gtk-wayland/TestExpectations will be used as the most specific
test expectations file on the GTK port when running the tests with the --wayland command line switch.
Baseline search path: gtk-wayland -> gtk -> wk2 -> generic.

  • Scripts/webkitpy/port/westondriver.py: Run the weston display server inside Xvfb.

(WestonDriver.check_driver):
(WestonDriver.init):
(WestonDriver._start):

  • Scripts/webkitpy/port/westondriver_unittest.py: Fix unittests for the new Weston inside Xvfb driver.

(WestonXvfbDriverDisplayTest):
(WestonXvfbDriverDisplayTest.init):
(WestonXvfbDriverDisplayTest._xvfb_run):
(WestonDriverTest.make_driver):
(WestonDriverTest.test_start):

  • gtk/install-dependencies: Add the new dependencies that are required for either building weston,

or to satisfy the pkg-config check of the new added modules in JHBuild.

  • gtk/jhbuild.modules: For building weston new enough on Debian Jessie we also need to build wayland

and libinput. Declare a pkg-config entry on all this modules to avoid building them if the ones
provided by the system are already new enough.
Switch the Mesa software rasterizer from a Xlib based GLX renderer to a DRI based EGL/GLX one.
It was the only way to get the software EGL rasterizer working without depending on user drivers.
Due to this the Mesa build now depends on a modern enough libdrm, so we also use JHBuild pkg-config
feature to avoid building libdrm when the one provided by the system is new enough.

  • gtk/jhbuildrc:
  • gtk/patches/xserver-search-for-DRI-drivers-at-LIBGL_DRIVERS_PATH-environ.patch: Added.

Xorg had no support for searching the DRI drivers on a custom path at runtime.
This patch implements support for that reusing the same variable that we use with Mesa to set the
custom path for the DRI drivers path.

LayoutTests:

  • platform/gtk-wayland/TestExpectations: Added. Add initial Wayland specific test expectations.
Location:
trunk
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202617 r202619  
     12016-06-29  Carlos Alberto Lopez Perez  <clopez@igalia.com>
     2
     3        [GTK][Wayland] Implement support for running the layout tests under a (virtualized) Wayland environment.
     4        https://bugs.webkit.org/show_bug.cgi?id=156716
     5
     6        Reviewed by Carlos Garcia Campos and Michael Catanzaro.
     7
     8        * platform/gtk-wayland/TestExpectations: Added. Add initial Wayland specific test expectations.
     9
    1102016-06-29  David Kilzer  <ddkilzer@apple.com>
    211
  • trunk/Tools/ChangeLog

    r202618 r202619  
     12016-06-29  Carlos Alberto Lopez Perez  <clopez@igalia.com>
     2
     3        [GTK][Wayland] Implement support for running the layout tests under a (virtualized) Wayland environment.
     4        https://bugs.webkit.org/show_bug.cgi?id=156716
     5
     6        Reviewed by Carlos Garcia Campos and Michael Catanzaro.
     7
     8        * Scripts/webkitpy/layout_tests/run_webkit_tests.py: Allow to run the layout tests on Wayland by passing --wayland
     9        (parse_args):
     10        * Scripts/webkitpy/port/gtk.py:
     11        (GtkPort.__init__):
     12        (GtkPort._driver_class):
     13        (GtkPort.setup_environ_for_server): Set the softgl renderer (now with EGL support) for the wayland tests.
     14        (GtkPort._search_paths): When running inside the wayland environment, use ${port}-wayland as an additional
     15        platform directory for storing the wayland specific layout test results and expectations for ${port}.
     16        For example, the file LayoutTests/platform/gtk-wayland/TestExpectations will be used as the most specific
     17        test expectations file on the GTK port when running the tests with the --wayland command line switch.
     18        Baseline search path: gtk-wayland -> gtk -> wk2 -> generic.
     19        * Scripts/webkitpy/port/westondriver.py: Run the weston display server inside Xvfb.
     20        (WestonDriver.check_driver):
     21        (WestonDriver.__init__):
     22        (WestonDriver._start):
     23        * Scripts/webkitpy/port/westondriver_unittest.py: Fix unittests for the new Weston inside Xvfb driver.
     24        (WestonXvfbDriverDisplayTest):
     25        (WestonXvfbDriverDisplayTest.__init__):
     26        (WestonXvfbDriverDisplayTest._xvfb_run):
     27        (WestonDriverTest.make_driver):
     28        (WestonDriverTest.test_start):
     29        * gtk/install-dependencies: Add the new dependencies that are required for either building weston,
     30        or to satisfy the pkg-config check of the new added modules in JHBuild.
     31        * gtk/jhbuild.modules: For building weston new enough on Debian Jessie we also need to build wayland
     32        and libinput. Declare a pkg-config entry on all this modules to avoid building them if the ones
     33        provided by the system are already new enough.
     34        Switch the Mesa software rasterizer from a Xlib based GLX renderer to a DRI based EGL/GLX one.
     35        It was the only way to get the software EGL rasterizer working without depending on user drivers.
     36        Due to this the Mesa build now depends on a modern enough libdrm, so we also use JHBuild pkg-config
     37        feature to avoid building libdrm when the one provided by the system is new enough.
     38        * gtk/jhbuildrc:
     39        * gtk/patches/xserver-search-for-DRI-drivers-at-LIBGL_DRIVERS_PATH-environ.patch: Added.
     40        Xorg had no support for searching the DRI drivers on a custom path at runtime.
     41        This patch implements support for that reusing the same variable that we use with Mesa to set the
     42        custom path for the DRI drivers path.
     43
    1442016-06-29  Alejandro G. Castro  <alex@igalia.com>
    245
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py

    r184382 r202619  
    283283            help="Output per-test profile information, using the specified profiler."),
    284284        optparse.make_option("--no-timeout", action="store_true", default=False, help="Disable test timeouts"),
     285        optparse.make_option("--wayland",  action="store_true", default=False,
     286            help="Run the layout tests inside a (virtualized) weston compositor (GTK only)."),
    285287    ]))
    286288
  • trunk/Tools/Scripts/webkitpy/port/gtk.py

    r202362 r202619  
    5353        super(GtkPort, self).__init__(*args, **kwargs)
    5454        self._pulseaudio_sanitizer = PulseAudioSanitizer()
     55        self._wayland = self.get_option("wayland")
    5556
    5657        if self.get_option("leaks"):
     
    7778    @memoized
    7879    def _driver_class(self):
    79         if os.environ.get("WAYLAND_DISPLAY"):
     80        if self._wayland:
    8081            return WestonDriver
    8182        if os.environ.get("USE_NATIVE_XDISPLAY"):
     
    119120        environment['OWR_USE_TEST_SOURCES'] = '1'
    120121        self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR')
    121         if self._driver_class() == XvfbDriver and self._should_use_jhbuild():
     122        # Configure the software libgl renderer if jhbuild ready and we test inside a virtualized window system
     123        if self._driver_class() in [XvfbDriver, WestonDriver] and self._should_use_jhbuild():
    122124            llvmpipe_libgl_path = self.host.executive.run_command(self._jhbuild_wrapper + ['printenv', 'LLVMPIPE_LIBGL_PATH'],
    123125                                                                  error_handler=self.host.executive.ignore_error).strip()
    124             if os.path.exists(os.path.join(llvmpipe_libgl_path, "libGL.so")):
     126            dri_libgl_path = os.path.join(llvmpipe_libgl_path, "dri")
     127            if os.path.exists(os.path.join(llvmpipe_libgl_path, "libGL.so")) and os.path.exists(os.path.join(dri_libgl_path, "swrast_dri.so")):
    125128                    # Force the Gallium llvmpipe software rasterizer
     129                    environment['LIBGL_ALWAYS_SOFTWARE'] = "1"
     130                    environment['LIBGL_DRIVERS_PATH'] = dri_libgl_path
    126131                    environment['LD_LIBRARY_PATH'] = llvmpipe_libgl_path
    127132                    if os.environ.get('LD_LIBRARY_PATH'):
     
    181186    def _search_paths(self):
    182187        search_paths = []
     188        if self._wayland:
     189            search_paths.append(self.port_name + "-wayland")
    183190        search_paths.append(self.port_name)
    184191        search_paths.append('wk2')
  • trunk/Tools/Scripts/webkitpy/port/westondriver.py

    r153439 r202619  
    3434from webkitpy.port.server_process import ServerProcess
    3535from webkitpy.port.driver import Driver
     36from webkitpy.port.xvfbdriver import XvfbDriver
    3637
    3738_log = logging.getLogger(__name__)
     
    4142    @staticmethod
    4243    def check_driver(port):
    43         weston_found = port.host.executive.run_command(['which', 'weston'], return_exit_code=True) is 0
     44        weston_findcmd = ['which', 'weston']
     45        if port._should_use_jhbuild():
     46            weston_findcmd = port._jhbuild_wrapper + weston_findcmd
     47        weston_found = port.host.executive.run_command(weston_findcmd, return_exit_code=True) is 0
    4448        if not weston_found:
    4549            _log.error("No weston found. Cannot run layout tests.")
     
    4953        Driver.__init__(self, *args, **kwargs)
    5054        self._startup_delay_secs = 1.0
     55        self._xvfbdriver = XvfbDriver(*args, **kwargs)
    5156
    5257    def _start(self, pixel_tests, per_test_args):
     
    5459
    5560        driver_name = self._port.driver_name()
     61
    5662        self._driver_directory = self._port.host.filesystem.mkdtemp(prefix='%s-' % driver_name)
    5763
     64        driver_environment = self._port.setup_environ_for_server(driver_name)
     65        driver_environment['DISPLAY'] = ":%d" % self._xvfbdriver._xvfb_run(driver_environment)
     66
    5867        weston_socket = 'WKTesting-weston-%032x' % random.getrandbits(128)
    59         weston_command = ['weston', '--socket=%s' % weston_socket, '--width=800', '--height=600']
     68        weston_command = ['weston', '--socket=%s' % weston_socket, '--width=1024', '--height=768', '--use-pixman']
     69        if self._port._should_use_jhbuild():
     70            weston_command = self._port._jhbuild_wrapper + weston_command
    6071        with open(os.devnull, 'w') as devnull:
    61             self._weston_process = self._port.host.executive.popen(weston_command, stderr=devnull)
     72            self._weston_process = self._port.host.executive.popen(weston_command, stderr=devnull, env=driver_environment)
    6273
    6374        # Give Weston a bit of time to set itself up.
    6475        time.sleep(self._startup_delay_secs)
    6576
    66         driver_environment = self._port.setup_environ_for_server(driver_name)
    6777        driver_environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir()
    6878
  • trunk/Tools/Scripts/webkitpy/port/westondriver_unittest.py

    r174136 r202619  
    4242
    4343
     44class WestonXvfbDriverDisplayTest():
     45    def __init__(self, expected_xvfbdisplay):
     46        self._expected_xvfbdisplay = expected_xvfbdisplay
     47
     48    def _xvfb_run(self, environment):
     49        return self._expected_xvfbdisplay
     50
     51
    4452class WestonDriverTest(unittest.TestCase):
    4553    def make_driver(self, filesystem=None):
     
    5058        driver = WestonDriver(port, worker_number=0, pixel_tests=True)
    5159        driver._startup_delay_secs = 0
     60        driver._expected_xvfbdisplay = 23
     61        driver._xvfbdriver = WestonXvfbDriverDisplayTest(driver._expected_xvfbdisplay)
     62        driver._environment = port.setup_environ_for_server(port.driver_name())
    5263        return driver
    5364
     
    6071        _, _, logs = output_capture.restore_output()
    6172
    62         self.assertTrue(re.match(r"MOCK popen: \['weston', '--socket=WKTesting-weston-[0-9a-f]{32}', '--width=800', '--height=600'\]\n", logs), None)
     73        self.assertTrue(re.match(r"MOCK popen: \['weston', '--socket=WKTesting-weston-[0-9a-f]{32}', '--width=1024', '--height=768', '--use-pixman'\], env=.*\n", logs), None)
    6374        self.assertTrue(re.match(r"WKTesting-weston-[0-9a-f]{32}", driver._server_process.env['WAYLAND_DISPLAY']))
     75        self.assertFalse('DISPLAY' in driver._server_process.env)
     76        self.assertTrue("'DISPLAY': ':%s'" % driver._expected_xvfbdisplay in logs)
    6477        self.assertEqual(driver._server_process.env['GDK_BACKEND'], 'wayland')
    6578        self.assertTrue(driver._server_process.started)
  • trunk/Tools/gtk/install-dependencies

    r202392 r202619  
    144144        ruby-json \
    145145        ruby-highline \
     146        weston \
    146147        xvfb"
    147148
     
    152153        icon-naming-utils \
    153154        libcroco3-dev \
     155        libdrm-dev \
    154156        libegl1-mesa-dev \
    155157        libepoxy-dev \
     158        libevdev-dev \
     159        libexpat1-dev \
     160        libgbm-dev \
    156161        libgcrypt11-dev \
    157162        libgpg-error-dev \
    158163        libjson-glib-dev \
     164        libinput-dev \
     165        libmtdev-dev \
    159166        liborc-0.4-dev \
    160167        libp11-kit-dev \
     
    163170        libtiff5-dev \
    164171        libv4l-dev \
     172        libxcb-composite0-dev \
    165173        libxcb-xfixes0-dev \
    166174        libxfont-dev \
    167175        libxkbfile-dev \
    168176        libtool-bin \
     177        libudev-dev \
    169178        llvm \
    170179        llvm-dev \
     
    279288        ruby \
    280289        ruby-highline \
     290        weston \
    281291        xorg-server-xvfb"
    282292
     
    284294    # Note: Could not find libegl-mesa
    285295    packages="$packages \
     296        expat \
    286297        git \
    287298        gobject-introspection \
    288299        icon-naming-utils \
    289300        libcroco \
     301        libdrm \
    290302        libepoxy \
     303        libevdev \
    291304        libgcrypt \
    292305        libgpg-error \
     306        libinput \
    293307        p11-kit \
    294308        libpciaccess \
     
    296310        libxfixes \
    297311        libxfont \
     312        libxcb \
    298313        libxkbfile \
    299314        llvm \
     315        mtdev \
    300316        python2 \
    301317        python2-lxml \
     
    397413        rubygem-json \
    398414        rubygem-highline \
     415        weston-devel \
    399416        xorg-x11-server-Xvfb"
    400417
    401418    # These are dependencies necessary for building the jhbuild.
    402419    packages="$packages \
     420        expat-devel \
    403421        docbook-utils \
    404422        docbook-utils-pdf \
     
    409427        libXfont-devel \
    410428        libcroco-devel \
     429        libdrm-devel \
    411430        libepoxy-devel \
     431        libevdev-devel
    412432        libgcrypt-devel \
    413433        libgpg-error-devel \
     434        libinput-devel \
    414435        libp11-devel \
    415436        libpciaccess-devel \
    416437        libtiff-devel \
     438        libxcb-devel \
    417439        libxkbfile-devel \
    418440        mesa-libEGL-devel \
     441        mtdev-devel \
    419442        ragel \
     443        systemd-devel \
    420444        xorg-x11-font-utils \
    421445        xorg-x11-proto-devel \
  • trunk/Tools/gtk/jhbuild.modules

    r202618 r202619  
    3838          <dep package="at-spi2-core"/>
    3939          <dep package="at-spi2-atk"/>
     40          <dep package="weston"/>
    4041      </if>
    4142      <if condition-set="macos">
     
    6869  <repository type="git" name="freedesktop-git"
    6970      href="http://anongit.freedesktop.org/git"/>
     71 <repository type="tarball" name="dri.freedesktop.org"
     72      href="http://dri.freedesktop.org"/>
    7073  <repository type="tarball" name="people.freedesktop.org"
    7174      href="http://people.freedesktop.org"/>
     75  <repository type="tarball" name="wayland.freedesktop.org"
     76      href="http://wayland.freedesktop.org"/>
    7277  <repository type="tarball" name="llvm.org"
    7378      href="http://llvm.org"/>
     
    183188      <if condition-set="linux">
    184189        <dep package="at-spi2-atk"/>
     190        <dep package="wayland"/>
    185191      </if>
    186192      <dep package="gdk-pixbuf"/>
     
    415421            md5sum="80d140f631d862b76dc67ae983151c77">
    416422      <patch file="xserver-remove-bogus-dependencies.patch" strip="1"/>
     423      <patch file="xserver-search-for-DRI-drivers-at-LIBGL_DRIVERS_PATH-environ.patch" strip="1"/>
     424    </branch>
     425  </autotools>
     426
     427  <autotools id="wayland" autogenargs="--disable-documentation">
     428    <pkg-config>wayland-server.pc</pkg-config>
     429    <dependencies>
     430      <dep package="libffi"/>
     431    </dependencies>
     432    <branch module="releases/wayland-1.8.1.tar.xz"
     433            version="1.8.1"
     434            repo="wayland.freedesktop.org"
     435            hash="sha256:f17c938d1c24fd0a10f650a623a2775d329db3168b5732e498b08388ec776fc8"
     436            md5sum="6e877877c3e04cfb865cfcd0733c9ab1">
     437    </branch>
     438  </autotools>
     439
     440  <autotools id="weston" autogenargs="--enable-x11-compositor --disable-rpi-compositor --disable-fbdev-compositor --disable-setuid-install --disable-ivi-shell --disable-weston-launch --with-cairo=gl">
     441    <pkg-config>weston.pc</pkg-config>
     442    <dependencies>
     443      <dep package="wayland"/>
     444      <dep package="libdrm"/>
     445      <dep package="xserver"/>
     446      <dep package="cairo"/>
     447      <dep package="libinput"/>
     448    </dependencies>
     449    <branch module="releases/weston-1.8.0.tar.xz"
     450            version="1.8.0"
     451            repo="wayland.freedesktop.org"
     452            hash="sha256:8963e69f328e815cec42c58046c4af721476c7541bb7d9edc71740fada5ad312"
     453            md5sum="24cb8a7ed0535b4fc3642643988dab36">
    417454    </branch>
    418455  </autotools>
     
    430467  </autotools>
    431468
    432   <autotools id="mesa" autogenargs="--enable-xlib-glx --disable-dri --disable-egl --with-gallium-drivers=swrast" skip-install="true">
     469  <autotools id="libdrm" autogen-sh="configure">
     470    <pkg-config>libdrm.pc</pkg-config>
     471    <branch module="/libdrm/libdrm-2.4.65.tar.bz2" version="2.4.65"
     472            repo="dri.freedesktop.org"
     473            hash="sha256:71960ac8bde7d710992b1bc8879935e8300a870c36bd06f22412d0447e3d96c4"/>
     474  </autotools>
     475
     476  <autotools id="mesa"
     477    autogen-template="%(srcdir)s/%(autogen-sh)s --prefix %(prefix)s/softGL %(autogenargs)s"
     478    autogenargs="--disable-dri3 --enable-dri --enable-glx --enable-egl --with-egl-platforms=x11,wayland --with-dri-drivers=swrast --with-gallium-drivers=swrast">
    433479    <!--- WARNING: At jhbuildrc, when we define the path to the Gallium llvmpipe software rasterizer (needed by XvfbDriver),
    434480          we assume that the directory is named "Mesa". So, don't change the checkoutdir name even if you update the version.  -->
     
    440486    <dependencies>
    441487      <dep package="llvm"/>
     488      <dep package="libdrm"/>
     489      <dep package="wayland"/>
    442490    </dependencies>
    443491  </autotools>
     
    526574  </autotools>
    527575
     576  <!-- libinput is only included because the version of libinput shipped with Debian Jessie
     577    os too old for building Weston 1.8. This may be removed after Debian Strech is released -->
     578  <autotools id="libinput" autogen-sh="configure"  autogenargs="--disable-libwacom --disable-tests --disable-documentation">
     579    <pkg-config>libinput.pc</pkg-config>
     580    <branch module="software/libinput/libinput-1.2.4.tar.xz"
     581            version="1.2.4"
     582            repo="freedesktop.org"
     583            hash="sha256:aee3650ad2a864ab9a10e7e63df543cc2b475f6bf3974751037a2df325dabbb1"
     584            md5sum="1cbaa34f04a336f2703906d564e0a37a">
     585    </branch>
     586  </autotools>
     587
    528588</moduleset>
  • trunk/Tools/gtk/jhbuildrc

    r197713 r202619  
    3535buildroot = os.path.join(os.path.dirname(checkoutroot), "Build")
    3636
    37 os.environ['LLVMPIPE_LIBGL_PATH'] = os.path.abspath(os.path.join(buildroot, 'Mesa', 'lib', 'gallium'))
     37# For the layout tests: path where llvmpipe/software-only mesa libraries are installed.
     38os.environ['LLVMPIPE_LIBGL_PATH'] = os.path.abspath(os.path.join(prefix, 'softGL', 'lib'))
    3839
    3940os.environ['CFLAGS'] = '-Wno-error'
Note: See TracChangeset for help on using the changeset viewer.