| Differences between
and this patch
- a/Tools/ChangeLog +17 lines
Lines 1-3 a/Tools/ChangeLog_sec1
1
2012-04-25  Kristóf Kosztyó  <kkristof@inf.u-szeged.hu>
2
3
        [Qt][NRWT] Run each DRT in it's own xvfb
4
        https://bugs.webkit.org/show_bug.cgi?id=77335
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * Scripts/webkitpy/layout_tests/port/gtk.py:
9
        (GtkPort._driver_class):
10
        * Scripts/webkitpy/layout_tests/port/qt.py:
11
        (QtPort._driver_class):
12
        * Scripts/webkitpy/layout_tests/port/xvfbdriver.py: Added.
13
        (XvfbDriver):
14
        (XvfbDriver._start):
15
        (XvfbDriver._start.x_filter):
16
        (XvfbDriver.stop):
17
1
2012-04-18  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
18
2012-04-18  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
2
19
3
        [Qt] Make the web view's url property follow the active url
20
        [Qt] Make the web view's url property follow the active url
- a/Tools/Scripts/webkitpy/layout_tests/port/gtk.py -40 / +3 lines
Lines 32-80 import signal a/Tools/Scripts/webkitpy/layout_tests/port/gtk.py_sec1
32
import subprocess
32
import subprocess
33
33
34
from webkitpy.layout_tests.models.test_configuration import TestConfiguration
34
from webkitpy.layout_tests.models.test_configuration import TestConfiguration
35
from webkitpy.layout_tests.port.server_process import ServerProcess
35
from webkitpy.layout_tests.port.webkit import WebKitPort
36
from webkitpy.layout_tests.port.webkit import WebKitDriver, WebKitPort
36
from webkitpy.layout_tests.port.xvfbdriver import XvfbDriver
37
from webkitpy.common.system.executive import Executive
38
37
39
_log = logging.getLogger(__name__)
38
_log = logging.getLogger(__name__)
40
39
41
40
42
class GtkDriver(WebKitDriver):
43
    def _start(self, pixel_tests, per_test_args):
44
45
        # Collect the number of X servers running already and make
46
        # sure our Xvfb process doesn't clash with any of them.
47
        def x_filter(process_name):
48
            return process_name.find("Xorg") > -1
49
50
        running_displays = len(Executive().running_pids(x_filter))
51
52
        # Use even displays for pixel tests and odd ones otherwise. When pixel tests are disabled,
53
        # DriverProxy creates two drivers, one for normal and the other for ref tests. Both have
54
        # the same worker number, so this prevents them from using the same Xvfb instance.
55
        display_id = self._worker_number * 2 + running_displays
56
        if self._port.get_option('pixel_tests'):
57
            display_id += 1
58
        run_xvfb = ["Xvfb", ":%d" % (display_id), "-screen",  "0", "800x600x24", "-nolisten", "tcp"]
59
        with open(os.devnull, 'w') as devnull:
60
            self._xvfb_process = subprocess.Popen(run_xvfb, stderr=devnull)
61
        server_name = self._port.driver_name()
62
        environment = self._port.setup_environ_for_server(server_name)
63
        # We must do this here because the DISPLAY number depends on _worker_number
64
        environment['DISPLAY'] = ":%d" % (display_id)
65
        self._crashed_process_name = None
66
        self._crashed_pid = None
67
        self._server_process = ServerProcess(self._port, server_name, self.cmd_line(pixel_tests, per_test_args), environment)
68
69
    def stop(self):
70
        WebKitDriver.stop(self)
71
        if getattr(self, '_xvfb_process', None):
72
            # FIXME: This should use Executive.kill_process
73
            os.kill(self._xvfb_process.pid, signal.SIGTERM)
74
            self._xvfb_process.wait()
75
            self._xvfb_process = None
76
77
78
class GtkPort(WebKitPort):
41
class GtkPort(WebKitPort):
79
    port_name = "gtk"
42
    port_name = "gtk"
80
43
Lines 82-88 class GtkPort(WebKitPort): a/Tools/Scripts/webkitpy/layout_tests/port/gtk.py_sec2
82
        return "--gtk"
45
        return "--gtk"
83
46
84
    def _driver_class(self):
47
    def _driver_class(self):
85
        return GtkDriver
48
        return XvfbDriver
86
49
87
    def _unload_pulseaudio_module(self):
50
    def _unload_pulseaudio_module(self):
88
        # Unload pulseaudio's module-stream-restore, since it remembers
51
        # Unload pulseaudio's module-stream-restore, since it remembers
- a/Tools/Scripts/webkitpy/layout_tests/port/qt.py -1 / +4 lines
Lines 38-44 import webkit a/Tools/Scripts/webkitpy/layout_tests/port/qt.py_sec1
38
from webkitpy.common.memoized import memoized
38
from webkitpy.common.memoized import memoized
39
from webkitpy.layout_tests.models.test_configuration import TestConfiguration
39
from webkitpy.layout_tests.models.test_configuration import TestConfiguration
40
from webkitpy.layout_tests.port.webkit import WebKitPort
40
from webkitpy.layout_tests.port.webkit import WebKitPort
41
41
from webkitpy.layout_tests.port.xvfbdriver import XvfbDriver
42
42
43
_log = logging.getLogger(__name__)
43
_log = logging.getLogger(__name__)
44
44
Lines 81-86 class QtPort(WebKitPort): a/Tools/Scripts/webkitpy/layout_tests/port/qt.py_sec2
81
        # The Qt port builds DRT as part of the main build step
81
        # The Qt port builds DRT as part of the main build step
82
        return True
82
        return True
83
83
84
    def _driver_class(self):
85
        return XvfbDriver
86
84
    def _path_to_driver(self):
87
    def _path_to_driver(self):
85
        return self._build_path('bin/%s' % self.driver_name())
88
        return self._build_path('bin/%s' % self.driver_name())
86
89
- a/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver.py +73 lines
Line 0 a/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver.py_sec1
1
# Copyright (C) 2010 Google Inc. All rights reserved.
2
#
3
# Redistribution and use in source and binary forms, with or without
4
# modification, are permitted provided that the following conditions are
5
# met:
6
#
7
#     * Redistributions of source code must retain the above copyright
8
# notice, this list of conditions and the following disclaimer.
9
#     * Redistributions in binary form must reproduce the above
10
# copyright notice, this list of conditions and the following disclaimer
11
# in the documentation and/or other materials provided with the
12
# distribution.
13
#     * Neither the Google name nor the names of its
14
# contributors may be used to endorse or promote products derived from
15
# this software without specific prior written permission.
16
#
17
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29
import logging
30
import os
31
import signal
32
import subprocess
33
34
from webkitpy.layout_tests.port.server_process import ServerProcess
35
from webkitpy.layout_tests.port.webkit import WebKitDriver
36
from webkitpy.common.system.executive import Executive
37
38
_log = logging.getLogger(__name__)
39
40
41
class XvfbDriver(WebKitDriver):
42
    def _start(self, pixel_tests, per_test_args):
43
44
        # Collect the number of X servers running already and make
45
        # sure our Xvfb process doesn't clash with any of them.
46
        def x_filter(process_name):
47
            return process_name.find("Xorg") > -1
48
49
        running_displays = len(Executive().running_pids(x_filter))
50
51
        # Use even displays for pixel tests and odd ones otherwise. When pixel tests are disabled,
52
        # DriverProxy creates two drivers, one for normal and the other for ref tests. Both have
53
        # the same worker number, so this prevents them from using the same Xvfb instance.
54
        display_id = self._worker_number * 2 + running_displays
55
        if self._port.get_option('pixel_tests'):
56
            display_id += 1
57
        run_xvfb = ["Xvfb", ":%d" % (display_id), "-screen",  "0", "800x600x24", "-nolisten", "tcp"]
58
        with open(os.devnull, 'w') as devnull:
59
            self._xvfb_process = subprocess.Popen(run_xvfb, stderr=devnull)
60
        server_name = self._port.driver_name()
61
        environment = self._port.setup_environ_for_server(server_name)
62
        # We must do this here because the DISPLAY number depends on _worker_number
63
        environment['DISPLAY'] = ":%d" % (display_id)
64
        self._crashed_process_name = None
65
        self._crashed_pid = None
66
        self._server_process = ServerProcess(self._port, server_name, self.cmd_line(pixel_tests, per_test_args), environment)
67
68
    def stop(self):
69
        WebKitDriver.stop(self)
70
        if getattr(self, '_xvfb_process', None):
71
            Executive().kill_process(self._xvfb_process.pid)
72
            self._xvfb_process.wait()
73
            self._xvfb_process = None

Return to Bug 77335