Exemplo n.º 1
0
    def make_driver(self, worker_number=0, xorg_running=False, executive=None):
        port = Port(MockSystemHost(log_executive=True, executive=executive), 'xvfbdrivertestport', options=MockOptions(configuration='Release'))
        port._config.build_directory = lambda configuration: "/mock-build"
        port._server_process_constructor = MockServerProcess
        if xorg_running:
            port._executive._running_pids['Xorg'] = 108

        driver = XvfbDriver(port, worker_number=worker_number, pixel_tests=True)
        driver._startup_delay_secs = 0
        return driver
Exemplo n.º 2
0
    def make_driver(self, worker_number=0, xorg_running=False, executive=None):
        port = Port(MockSystemHost(log_executive=True, executive=executive), 'xvfbdrivertestport', options=MockOptions(configuration='Release'))
        port._config.build_directory = lambda configuration: "/mock-build"
        port._server_process_constructor = MockServerProcess
        if xorg_running:
            port._executive._running_pids['Xorg'] = 108

        driver = XvfbDriver(port, worker_number=worker_number, pixel_tests=True)
        driver._startup_delay_secs = 0
        driver._xvfb_screen_depth = lambda: '24'
        return driver
Exemplo n.º 3
0
    def test_stop(self):
        port = Port(MockSystemHost(log_executive=True), 'xvfbdrivertestport', options=MockOptions(configuration='Release'))
        port._executive.kill_process = lambda x: _log.info("MOCK kill_process pid: " + str(x))
        driver = XvfbDriver(port, worker_number=0, pixel_tests=True)

        class FakeXvfbProcess(object):
            pid = 1234

        driver._xvfb_process = FakeXvfbProcess()

        expected_logs = "MOCK kill_process pid: 1234\n"
        OutputCapture().assert_outputs(self, driver.stop, [], expected_logs=expected_logs)

        self.assertIsNone(driver._xvfb_process)
Exemplo n.º 4
0
    def test_stop(self):
        port = Port(MockSystemHost(log_executive=True), 'xvfbdrivertestport', options=MockOptions(configuration='Release'))
        port._executive.kill_process = lambda x: _log.info("MOCK kill_process pid: " + str(x))
        driver = XvfbDriver(port, worker_number=0, pixel_tests=True)

        class FakeXvfbProcess(object):
            pid = 1234

        driver._xvfb_process = FakeXvfbProcess()

        expected_logs = "MOCK kill_process pid: 1234\n"
        OutputCapture().assert_outputs(self, driver.stop, [], expected_logs=expected_logs)

        self.assertIsNone(driver._xvfb_process)
Exemplo n.º 5
0
    def test_stop(self):
        port = Port(MockSystemHost(log_executive=True), 'xvfbdrivertestport', options=MockOptions(configuration='Release'))
        port._executive.kill_process = lambda x: _log.info("MOCK kill_process pid: " + str(x))
        driver = XvfbDriver(port, worker_number=0, pixel_tests=True)

        class FakeXvfbProcess(object):
            pid = 1234

        driver._xvfb_process = FakeXvfbProcess()

        with OutputCapture(level=logging.INFO) as captured:
            driver.stop()
        self.assertEqual(captured.root.log.getvalue(), "MOCK kill_process pid: 1234\n")

        self.assertIsNone(driver._xvfb_process)
    def test_stop(self):
        filesystem = MockFileSystem(files={'/tmp/.X42-lock': '1234\n'})
        port = Port(MockSystemHost(log_executive=True, filesystem=filesystem), 'xvfbdrivertestport', options=MockOptions(configuration='Release'))
        port._executive.kill_process = lambda x: _log.info("MOCK kill_process pid: " + str(x))
        driver = XvfbDriver(port, worker_number=0, pixel_tests=True)

        class FakeXvfbProcess(object):
            pid = 1234

        driver._xvfb_process = FakeXvfbProcess()
        driver._lock_file = '/tmp/.X42-lock'

        expected_logs = "MOCK kill_process pid: 1234\n"
        OutputCapture().assert_outputs(self, driver.stop, [], expected_logs=expected_logs)

        self.assertIsNone(driver._xvfb_process)
        self.assertFalse(port._filesystem.exists(driver._lock_file))
Exemplo n.º 7
0
    def test_stop(self):
        filesystem = MockFileSystem(files={'/tmp/.X42-lock': '1234\n'})
        port = Port(MockSystemHost(log_executive=True, filesystem=filesystem), 'xvfbdrivertestport', options=MockOptions(configuration='Release'))
        port._executive.kill_process = lambda x: _log.info("MOCK kill_process pid: " + str(x))
        driver = XvfbDriver(port, worker_number=0, pixel_tests=True)

        class FakeXvfbProcess(object):
            pid = 1234

        driver._xvfb_process = FakeXvfbProcess()
        driver._lock_file = '/tmp/.X42-lock'

        expected_logs = "MOCK kill_process pid: 1234\n"
        OutputCapture().assert_outputs(self, driver.stop, [], expected_logs=expected_logs)

        self.assertIsNone(driver._xvfb_process)
        self.assertFalse(port._filesystem.exists(driver._lock_file))
Exemplo n.º 8
0
class WestonDriver(Driver):
    @staticmethod
    def check_driver(port):
        weston_findcmd = ['which', 'weston']
        if port._should_use_jhbuild():
            weston_findcmd = port._jhbuild_wrapper + weston_findcmd
        weston_found = port.host.executive.run_command(weston_findcmd, return_exit_code=True) is 0
        if not weston_found:
            _log.error("No weston found. Cannot run layout tests.")
        return weston_found

    def __init__(self, *args, **kwargs):
        Driver.__init__(self, *args, **kwargs)
        self._startup_delay_secs = 1.0
        self._xvfbdriver = XvfbDriver(*args, **kwargs)

    def _setup_environ_for_test(self):
        driver_environment = self._port.setup_environ_for_server(self._server_name)
        driver_environment['DISPLAY'] = ":%d" % self._xvfbdriver._xvfb_run(driver_environment)
        weston_socket = 'WKTesting-weston-%032x' % random.getrandbits(128)
        weston_command = ['weston', '--socket=%s' % weston_socket, '--width=1024', '--height=768', '--use-pixman']
        if self._port._should_use_jhbuild():
            weston_command = self._port._jhbuild_wrapper + weston_command
        with open(os.devnull, 'w') as devnull:
            self._weston_process = self._port.host.executive.popen(weston_command, stderr=devnull, env=driver_environment)

        # Give Weston a bit of time to set itself up.
        time.sleep(self._startup_delay_secs)

        driver_environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir()
        if self._driver_tempdir is not None:
            # Currently on WebKit2, there is no API for setting the application cache directory.
            # Each worker should have its own and it should be cleaned afterwards, when the worker stops.
            driver_environment['XDG_CACHE_HOME'] = self._port.host.filesystem.join(str(self._driver_tempdir), 'appcache')
            driver_environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir)
        driver_environment['WAYLAND_DISPLAY'] = weston_socket
        driver_environment['GDK_BACKEND'] = 'wayland'
        if driver_environment.get('DISPLAY'):
            del driver_environment['DISPLAY']
        return driver_environment

    def _start(self, pixel_tests, per_test_args):
        self.stop()
        self._driver_tempdir = self._port._driver_tempdir(self._target_host)
        self._crashed_process_name = None
        self._crashed_pid = None
        self._server_process = self._port._server_process_constructor(self._port, self._server_name, self.cmd_line(pixel_tests, per_test_args), self._setup_environ_for_test())
        self._server_process.start()

    def stop(self):
        super(WestonDriver, self).stop()
        if getattr(self, '_weston_process', None):
            # The Weston process is terminated instead of killed, giving the Weston a chance to clean up after itself.
            self._weston_process.terminate()
            self._weston_process = None
Exemplo n.º 9
0
    def make_driver(self, worker_number=0, xorg_running=False, executive=None):
        port = Port(MockSystemHost(log_executive=True, executive=executive), 'xvfbdrivertestport', options=MockOptions(configuration='Release'))
        port._config.build_directory = lambda configuration: "/mock-build"
        port._test_runner_process_constructor = MockServerProcess
        if xorg_running:
            port._executive._running_pids['Xorg'] = 108

        driver = XvfbDriver(port, worker_number=worker_number, pixel_tests=True)
        driver._startup_delay_secs = 0
        driver._xvfb_screen_depth = lambda: '24'
        driver._xvfb_pipe = lambda: (3, 4)
        driver._xvfb_read_display_id = lambda x: 1
        driver._xvfb_close_pipe = lambda p: None
        driver._port_server_environment = port.setup_environ_for_server(port.driver_name())
        return driver
Exemplo n.º 10
0
class WestonDriver(Driver):
    @staticmethod
    def check_driver(port):
        weston_findcmd = ['which', 'weston']
        if port._should_use_jhbuild():
            weston_findcmd = port._jhbuild_wrapper + weston_findcmd
        weston_found = port.host.executive.run_command(
            weston_findcmd, return_exit_code=True) is 0
        if not weston_found:
            _log.error("No weston found. Cannot run layout tests.")
        return weston_found

    def __init__(self, *args, **kwargs):
        Driver.__init__(self, *args, **kwargs)
        self._startup_delay_secs = 1.0
        self._xvfbdriver = XvfbDriver(*args, **kwargs)

    def _setup_environ_for_test(self):
        driver_environment = super(WestonDriver,
                                   self)._setup_environ_for_test()
        driver_environment['DISPLAY'] = ":%d" % self._xvfbdriver._xvfb_run(
            driver_environment)
        weston_socket = 'WKTesting-weston-%032x' % random.getrandbits(128)
        weston_command = [
            'weston',
            '--socket=%s' % weston_socket, '--width=1024', '--height=768',
            '--use-pixman'
        ]
        if self._port._should_use_jhbuild():
            weston_command = self._port._jhbuild_wrapper + weston_command
        with open(os.devnull, 'w') as devnull:
            self._weston_process = self._port.host.executive.popen(
                weston_command, stderr=devnull, env=driver_environment)

        # Give Weston a bit of time to set itself up.
        time.sleep(self._startup_delay_secs)

        driver_environment['WAYLAND_DISPLAY'] = weston_socket
        driver_environment['GDK_BACKEND'] = 'wayland'
        if driver_environment.get('DISPLAY'):
            del driver_environment['DISPLAY']
        return driver_environment

    def stop(self):
        super(WestonDriver, self).stop()
        if getattr(self, '_weston_process', None):
            # The Weston process is terminated instead of killed, giving the Weston a chance to clean up after itself.
            self._weston_process.terminate()
            self._weston_process = None
Exemplo n.º 11
0
    def make_driver(self, worker_number=0, xorg_running=False, executive=None):
        port = Port(MockSystemHost(log_executive=True, executive=executive), 'xvfbdrivertestport', options=MockOptions(configuration='Release'))
        port._config.build_directory = lambda configuration: "/mock-build"
        port._server_process_constructor = MockServerProcess
        if xorg_running:
            port._executive._running_pids['Xorg'] = 108

        driver = XvfbDriver(port, worker_number=worker_number, pixel_tests=True)
        driver._startup_delay_secs = 0
        driver._xvfb_screen_depth = lambda: '24'
        driver._xvfb_pipe = lambda: (3, 4)
        driver._xvfb_read_display_id = lambda x: 1
        driver._xvfb_close_pipe = lambda p: None
        driver._environment = port.setup_environ_for_server(port.driver_name())
        return driver
Exemplo n.º 12
0
 def __init__(self, *args, **kwargs):
     Driver.__init__(self, *args, **kwargs)
     self._startup_delay_secs = 1.0
     self._xvfbdriver = XvfbDriver(*args, **kwargs)
Exemplo n.º 13
0
Arquivo: gtk.py Projeto: GhostQ/GitSB
 def check_sys_deps(self, needs_http):
     return super(
         GtkPort,
         self).check_sys_deps(needs_http) and XvfbDriver.check_xvfb(self)
Exemplo n.º 14
0
 def __init__(self, *args, **kwargs):
     Driver.__init__(self, *args, **kwargs)
     self._startup_delay_secs = 1.0
     self._xvfbdriver = XvfbDriver(*args, **kwargs)
Exemplo n.º 15
0
class WestonDriver(Driver):
    @staticmethod
    def check_driver(port):
        weston_findcmd = ['which', 'weston']
        if port._should_use_jhbuild():
            weston_findcmd = port._jhbuild_wrapper + weston_findcmd
        weston_found = port.host.executive.run_command(weston_findcmd, return_exit_code=True) is 0
        if not weston_found:
            _log.error("No weston found. Cannot run layout tests.")
        return weston_found

    def __init__(self, *args, **kwargs):
        Driver.__init__(self, *args, **kwargs)
        self._startup_delay_secs = 1.0
        self._xvfbdriver = XvfbDriver(*args, **kwargs)

    def _setup_environ_for_test(self):
        self._driver_directory = self._port.host.filesystem.mkdtemp(prefix='%s-' % self._server_name)
        driver_environment = self._port.setup_environ_for_server(self._server_name)
        driver_environment['DISPLAY'] = ":%d" % self._xvfbdriver._xvfb_run(driver_environment)
        weston_socket = 'WKTesting-weston-%032x' % random.getrandbits(128)
        weston_command = ['weston', '--socket=%s' % weston_socket, '--width=1024', '--height=768', '--use-pixman']
        if self._port._should_use_jhbuild():
            weston_command = self._port._jhbuild_wrapper + weston_command
        with open(os.devnull, 'w') as devnull:
            self._weston_process = self._port.host.executive.popen(weston_command, stderr=devnull, env=driver_environment)

        # Give Weston a bit of time to set itself up.
        time.sleep(self._startup_delay_secs)

        driver_environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir()
        # Currently on WebKit2, there is no API for setting the application cache directory.
        # Each worker should have its own and it should be cleaned afterwards, when the worker stops.
        driver_environment['XDG_CACHE_HOME'] = self._ensure_driver_tmpdir_subdirectory('appcache')
        driver_environment['DUMPRENDERTREE_TEMP'] = self._ensure_driver_tmpdir_subdirectory('drt-temp')
        driver_environment['WAYLAND_DISPLAY'] = weston_socket
        driver_environment['GDK_BACKEND'] = 'wayland'
        if driver_environment.get('DISPLAY'):
            del driver_environment['DISPLAY']
        return driver_environment

    def _start(self, pixel_tests, per_test_args):
        self.stop()
        self._crashed_process_name = None
        self._crashed_pid = None
        self._server_process = self._port._server_process_constructor(self._port, self._server_name, self.cmd_line(pixel_tests, per_test_args), self._setup_environ_for_test())
        self._server_process.start()

    def stop(self):
        super(WestonDriver, self).stop()
        if getattr(self, '_weston_process', None):
            # The Weston process is terminated instead of killed, giving the Weston a chance to clean up after itself.
            self._weston_process.terminate()
            self._weston_process = None
        if getattr(self, '_driver_directory', None):
            self._port.host.filesystem.rmtree(str(self._driver_directory))

    def _ensure_driver_tmpdir_subdirectory(self, subdirectory):
        assert getattr(self, '_driver_directory', None)
        directory_path = self._port.host.filesystem.join(str(self._driver_directory), subdirectory)
        self._port.host.filesystem.maybe_make_directory(directory_path)
        return directory_path
Exemplo n.º 16
0
 def check_sys_deps(self, needs_http):
     return super(EflPort, self).check_sys_deps(needs_http) and XvfbDriver.check_xvfb(self)