[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.20-204-g221d8e8
dpranke at chromium.org
dpranke at chromium.org
Wed Feb 10 22:17:28 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 2d33621c3d0b02f3c93b302c614776ba7b45f550
Author: dpranke at chromium.org <dpranke at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Feb 6 00:41:31 2010 +0000
2010-02-03 Dirk Pranke <dpranke at chromium.org>
Reviewed by Eric Seidel.
Add a simple test implementation and the WebKit Mac implementation
for the layout_tests/port package. Also add a simple test driver of
that interface.
https://bugs.webkit.org/show_bug.cgi?id=34511
* Scripts/webkitpy/layout_tests/driver_test.py: Added.
* Scripts/webkitpy/layout_tests/port/__init__.py:
* Scripts/webkitpy/layout_tests/port/mac.py: Added.
* Scripts/webkitpy/layout_tests/port/test.py: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54452 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 59cff32..c21032a 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,20 @@
2010-02-03 Dirk Pranke <dpranke at chromium.org>
+ Reviewed by Eric Seidel.
+
+ Add a simple test implementation and the WebKit Mac implementation
+ for the layout_tests/port package. Also add a simple test driver of
+ that interface.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34511
+
+ * Scripts/webkitpy/layout_tests/driver_test.py: Added.
+ * Scripts/webkitpy/layout_tests/port/__init__.py:
+ * Scripts/webkitpy/layout_tests/port/mac.py: Added.
+ * Scripts/webkitpy/layout_tests/port/test.py: Added.
+
+2010-02-03 Dirk Pranke <dpranke at chromium.org>
+
Reviewed by Eric Siedel.
Refactor the port package into an object-oriented style and merge
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/driver_test.py b/WebKitTools/Scripts/webkitpy/layout_tests/driver_test.py
new file mode 100644
index 0000000..66aeee1
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/driver_test.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+# Copyright (C) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * 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.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# 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.
+
+#
+# FIXME: this is a poor attempt at a unit tests driver. We should replace
+# this with something that actually uses a unit testing framework or
+# at least produces output that could be useful.
+
+"""Simple test client for the port/Driver interface."""
+
+import os
+import optparse
+import port
+
+
+def run_tests(port, options, tests):
+ # |image_path| is a path to the image capture from the driver.
+ image_path = 'image_result.png'
+ driver = port.start_driver(image_path, None)
+ for t in tests:
+ uri = port.filename_to_uri(os.path.join(port.layout_tests_dir(), t))
+ print "uri: " + uri
+ crash, timeout, checksum, output, err = \
+ driver.run_test(uri, int(options.timeout), None)
+ print "crash: " + str(crash)
+ print "timeout: " + str(timeout)
+ print "checksum: " + str(checksum)
+ print 'stdout: """'
+ print ''.join(output)
+ print '"""'
+ print 'stderr: """'
+ print ''.join(err)
+ print '"""'
+ print
+
+
+if __name__ == '__main__':
+ optparser = optparse.OptionParser()
+ optparser.add_option('-p', '--port', action='store', default='mac',
+ 'Platform to test (e.g., "mac", "chromium-mac", etc.')
+ optparser.add_option('-t', '--target', action='store', default='Release',
+ 'build type ("Debug" or "Release")')
+ optparser.add_option('', '--timeout', action='store', default='2000',
+ 'test timeout in milliseconds (2000 by default)')
+ optparser.add_option('', '--wrapper', action='store')
+ optparser.add_option('', '--no-pixel-tests', action='store_true',
+ default=False,
+ help='disable pixel-to-pixel PNG comparisons')
+ options, args = optparser.parse_args()
+ p = port.get(options.port, options)
+ run_tests(p, options, args)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py
index b4fa2ad..4d8751d 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py
@@ -38,7 +38,13 @@ def get(port_name=None, options=None):
if port_to_use is None:
port_to_use = 'chromium-mac'
- if port_to_use.startswith('chromium-mac'):
+ if port_to_use == 'test':
+ import test
+ return test.TestPort(port_name, options)
+ elif port_to_use.startswith('mac'):
+ import mac
+ return mac.MacPort(port_name, options)
+ elif port_to_use.startswith('chromium-mac'):
import chromium_mac
return chromium_mac.ChromiumMacPort(port_name, options)
elif port_to_use.startswith('chromium-linux'):
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
new file mode 100644
index 0000000..5a770ef
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
@@ -0,0 +1,429 @@
+#!/usr/bin/env python
+# Copyright (C) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * 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.
+# * Neither the Google name nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# 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.
+
+"""WebKit Mac implementation of the Port interface."""
+
+import fcntl
+import os
+import pdb
+import platform
+import select
+import signal
+import subprocess
+import sys
+import time
+import webbrowser
+
+import base
+
+
+class MacPort(base.Port):
+ """WebKit Mac implementation of the Port class."""
+
+ def __init__(self, port_name=None, options=None):
+ if port_name is None:
+ port_name = 'mac' + self.version()
+ base.Port.__init__(self, port_name, options)
+
+ def baseline_search_path(self):
+ dirs = []
+ if self._name == 'mac-tiger':
+ dirs.append(self._webkit_baseline_path(self._name))
+ if self._name in ('mac-tiger', 'mac-leopard'):
+ dirs.append(self._webkit_baseline_path('mac-leopard'))
+ if self._name in ('mac-tiger', 'mac-leopard', 'mac-snowleopard'):
+ dirs.append(self._webkit_baseline_path('mac-snowleopard'))
+ dirs.append(self._webkit_baseline_path('mac'))
+ return dirs
+
+ def check_sys_deps(self):
+ # There are no platform-specific checks we need to do.
+ return True
+
+ def num_cores(self):
+ return int(os.popen2("sysctl -n hw.ncpu")[1].read())
+
+ def results_directory(self):
+ return ('/tmp/run-chromium-webkit-tests-' +
+ self._options.results_directory)
+
+ def setup_test_run(self):
+ # This port doesn't require any specific configuration.
+ pass
+
+ def show_results_html_file(self, results_filename):
+ uri = self.filename_to_uri(results_filename)
+ webbrowser.open(uri, new=1)
+
+ def start_driver(self, image_path, options):
+ """Starts a new Driver and returns a handle to it."""
+ return MacDriver(self, image_path, options)
+
+ def start_helper(self):
+ # This port doesn't use a helper process.
+ pass
+
+ def stop_helper(self):
+ # This port doesn't use a helper process.
+ pass
+
+ def test_base_platform_names(self):
+ # At the moment we don't use test platform names, but we have
+ # to return something.
+ return ('mac',)
+
+ def test_expectations(self):
+ #
+ # The WebKit mac port uses 'Skipped' files at the moment. Each
+ # file contains a list of files or directories to be skipped during
+ # the test run. The total list of tests to skipped is given by the
+ # contents of the generic Skipped file found in platform/X plus
+ # a version-specific file found in platform/X-version. Duplicate
+ # entries are allowed. This routine reads those files and turns
+ # contents into the format expected by test_expectations.
+ expectations = []
+ skipped_files = []
+ if self._name in ('mac-tiger', 'mac-leopard', 'mac-snowleopard'):
+ skipped_files.append(os.path.join(
+ self._webkit_baseline_path(self._name), 'Skipped'))
+ skipped_files.append(os.path.join(self._webkit_baseline_path('mac'),
+ 'Skipped'))
+ for filename in skipped_files:
+ if os.path.exists(filename):
+ f = file(filename)
+ for l in f.readlines():
+ l = l.strip()
+ if not l.startswith('#') and len(l):
+ l = 'BUG_SKIPPED SKIP : ' + l + ' = FAIL'
+ if l not in expectations:
+ expectations.append(l)
+ f.close()
+
+ # TODO - figure out how to check for these dynamically
+ expectations.append('BUG_SKIPPED SKIP : fast/wcss = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : fast/xhtmlmp = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : http/tests/wml = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : mathml = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : platform/chromium = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : platform/gtk = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : platform/qt = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : platform/win = FAIL')
+ expectations.append('BUG_SKIPPED SKIP : wml = FAIL')
+
+ # TODO - figure out how to handle webarchive tests
+ expectations.append('BUG_SKIPPED SKIP : webarchive = PASS')
+ expectations.append('BUG_SKIPPED SKIP : svg/webarchive = PASS')
+ expectations.append('BUG_SKIPPED SKIP : http/tests/webarchive = PASS')
+ expectations.append('BUG_SKIPPED SKIP : svg/custom/'
+ 'image-with-prefix-in-webarchive.svg = PASS')
+
+ expectations_str = '\n'.join(expectations)
+ return expectations_str
+
+ def test_platform_name(self):
+ # At the moment we don't use test platform names, but we have
+ # to return something.
+ return 'mac'
+
+ def test_platform_names(self):
+ # At the moment we don't use test platform names, but we have
+ # to return something.
+ return ('mac',)
+
+ def version(self):
+ os_version_string = platform.mac_ver()[0] # e.g. "10.5.6"
+ if not os_version_string:
+ return '-leopard'
+ release_version = int(os_version_string.split('.')[1])
+ if release_version == 4:
+ return '-tiger'
+ elif release_version == 5:
+ return '-leopard'
+ elif release_version == 6:
+ return '-snowleopard'
+ return ''
+
+ #
+ # PROTECTED METHODS
+ #
+
+ def _build_path(self, *comps):
+ return self.path_from_webkit_base('WebKitBuild', self._options.target,
+ *comps)
+
+ def _kill_process(self, pid):
+ """Forcefully kill the process.
+
+ Args:
+ pid: The id of the process to be killed.
+ """
+ os.kill(pid, signal.SIGKILL)
+
+ def _kill_all_process(self, process_name):
+ # On Mac OS X 10.6, killall has a new constraint: -SIGNALNAME or
+ # -SIGNALNUMBER must come first. Example problem:
+ # $ killall -u $USER -TERM lighttpd
+ # killall: illegal option -- T
+ # Use of the earlier -TERM placement is just fine on 10.5.
+ null = open(os.devnull)
+ subprocess.call(['killall', '-TERM', '-u', os.getenv('USER'),
+ process_name], stderr=null)
+ null.close()
+
+ def _path_to_apache(self):
+ return '/usr/sbin/httpd'
+
+ def _path_to_apache_config_file(self):
+ return os.path.join(self.layout_tests_dir(), 'http', 'conf',
+ 'apache2-httpd.conf')
+
+ def _path_to_driver(self):
+ return self._build_path('DumpRenderTree')
+
+ def _path_to_helper(self):
+ return None
+
+ def _path_to_image_diff(self):
+ return self._build_path('image_diff')
+
+ def _path_to_wdiff(self):
+ return 'wdiff'
+
+ def _shut_down_http_server(self, server_pid):
+ """Shut down the lighttpd web server. Blocks until it's fully
+ shut down.
+
+ Args:
+ server_pid: The process ID of the running server.
+ """
+ # server_pid is not set when "http_server.py stop" is run manually.
+ if server_pid is None:
+ # TODO(mmoss) This isn't ideal, since it could conflict with
+ # lighttpd processes not started by http_server.py,
+ # but good enough for now.
+ self._kill_all_process('httpd')
+ else:
+ try:
+ os.kill(server_pid, signal.SIGTERM)
+ # TODO(mmoss) Maybe throw in a SIGKILL just to be sure?
+ except OSError:
+ # Sometimes we get a bad PID (e.g. from a stale httpd.pid
+ # file), so if kill fails on the given PID, just try to
+ # 'killall' web servers.
+ self._shut_down_http_server(None)
+
+
+class MacDriver(base.Driver):
+ """implementation of the DumpRenderTree interface."""
+
+ def __init__(self, port, image_path, driver_options):
+ self._port = port
+ self._driver_options = driver_options
+ self._target = port._options.target
+ self._image_path = image_path
+ self._stdout_fd = None
+ self._cmd = None
+ self._env = None
+ self._proc = None
+ self._read_buffer = ''
+
+ cmd = []
+ # Hook for injecting valgrind or other runtime instrumentation,
+ # used by e.g. tools/valgrind/valgrind_tests.py.
+ wrapper = os.environ.get("BROWSER_WRAPPER", None)
+ if wrapper != None:
+ cmd += [wrapper]
+ if self._port._options.wrapper:
+ # This split() isn't really what we want -- it incorrectly will
+ # split quoted strings within the wrapper argument -- but in
+ # practice it shouldn't come up and the --help output warns
+ # about it anyway.
+ cmd += self._options.wrapper.split()
+ cmd += ['arch', '-i386', port._path_to_driver(), '-']
+ if not self._port._options.no_pixel_tests:
+ cmd.append('--pixel-tests')
+
+ #if driver_options:
+ # cmd += driver_options
+ env = os.environ
+ env['DYLD_FRAMEWORK_PATH'] = self._port.path_from_webkit_base(
+ 'WebKitBuild', port._options.target)
+ self._cmd = cmd
+ self._env = env
+ self.restart()
+
+ def poll(self):
+ return self._proc.poll()
+
+ def restart(self):
+ self.stop()
+ self._proc = subprocess.Popen(self._cmd, stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ env=self._env)
+
+ def returncode(self):
+ return self._proc.returncode
+
+ def run_test(self, uri, timeoutms, image_hash):
+ output = []
+ error = []
+ image = ''
+ crash = False
+ timeout = False
+ actual_uri = None
+ actual_image_hash = None
+
+ if uri.startswith("file:///"):
+ cmd = uri[7:]
+ else:
+ cmd = uri
+
+ if image_hash:
+ cmd += "'" + image_hash
+ cmd += "\n"
+
+ self._proc.stdin.write(cmd)
+ self._stdout_fd = self._proc.stdout.fileno()
+ fl = fcntl.fcntl(self._stdout_fd, fcntl.F_GETFL)
+ fcntl.fcntl(self._stdout_fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
+
+ stop_time = time.time() + (int(timeoutms) / 1000.0)
+ resp = ''
+ (timeout, line) = self._read_line(timeout, stop_time)
+ resp += line
+ have_seen_content_type = False
+ while not timeout and line.rstrip() != "#EOF":
+ # Make sure we haven't crashed.
+ if line == '' and self.poll() is not None:
+ # This is hex code 0xc000001d, which is used for abrupt
+ # termination. This happens if we hit ctrl+c from the prompt
+ # and we happen to be waiting on the test_shell.
+ # sdoyon: Not sure for which OS and in what circumstances the
+ # above code is valid. What works for me under Linux to detect
+ # ctrl+c is for the subprocess returncode to be negative
+ # SIGINT. And that agrees with the subprocess documentation.
+ if (-1073741510 == self.returncode() or
+ - signal.SIGINT == self.returncode()):
+ raise KeyboardInterrupt
+ crash = True
+ break
+
+ elif (line.startswith('Content-Type:') and not
+ have_seen_content_type):
+ have_seen_content_type = True
+ pass
+ else:
+ output.append(line)
+
+ (timeout, line) = self._read_line(timeout, stop_time)
+ resp += line
+
+ # Now read a second block of text for the optional image data
+ image_length = 0
+ (timeout, line) = self._read_line(timeout, stop_time)
+ resp += line
+ HASH_HEADER = 'ActualHash: '
+ LENGTH_HEADER = 'Content-Length: '
+ while not timeout and not crash and line.rstrip() != "#EOF":
+ if line == '' and self.poll() is not None:
+ if (-1073741510 == self.returncode() or
+ - signal.SIGINT == self.returncode()):
+ raise KeyboardInterrupt
+ crash = True
+ break
+ elif line.startswith(HASH_HEADER):
+ actual_image_hash = line[len(HASH_HEADER):].strip()
+ elif line.startswith('Content-Type:'):
+ pass
+ elif line.startswith(LENGTH_HEADER):
+ image_length = int(line[len(LENGTH_HEADER):])
+ elif image_length:
+ image += line
+
+ (timeout, line) = self._read_line(timeout, stop_time, image_length)
+ resp += line
+
+ if timeout:
+ self.restart()
+
+ if self._image_path and len(self._image_path):
+ image_file = file(self._image_path, "wb")
+ image_file.write(image)
+ image_file.close()
+
+ return (crash, timeout, actual_image_hash,
+ ''.join(output), ''.join(error))
+ pass
+
+ def stop(self):
+ if self._proc:
+ self._proc.stdin.close()
+ self._proc.stdout.close()
+ if self._proc.stderr:
+ self._proc.stderr.close()
+ if (sys.platform not in ('win32', 'cygwin') and
+ not self._proc.poll()):
+ # Closing stdin/stdout/stderr hangs sometimes on OS X.
+ null = open(os.devnull, "w")
+ subprocess.Popen(["kill", "-9",
+ str(self._proc.pid)], stderr=null)
+ null.close()
+
+ def _read_line(self, timeout, stop_time, image_length=0):
+ now = time.time()
+ read_fds = []
+
+ # first check to see if we have a line already read or if we've
+ # read the entire image
+ if image_length and len(self._read_buffer) >= image_length:
+ out = self._read_buffer[0:image_length]
+ self._read_buffer = self._read_buffer[image_length:]
+ return (timeout, out)
+
+ idx = self._read_buffer.find('\n')
+ if not image_length and idx != -1:
+ out = self._read_buffer[0:idx + 1]
+ self._read_buffer = self._read_buffer[idx + 1:]
+ return (timeout, out)
+
+ # If we've timed out, return just what we have, if anything
+ if timeout or now >= stop_time:
+ out = self._read_buffer
+ self._read_buffer = ''
+ return (True, out)
+
+ (read_fds, write_fds, err_fds) = select.select(
+ [self._stdout_fd], [], [], stop_time - now)
+ try:
+ if timeout or len(read_fds) == 1:
+ self._read_buffer += self._proc.stdout.read()
+ except IOError, e:
+ read = []
+ return self._read_line(timeout, stop_time)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
new file mode 100644
index 0000000..0bc6e7c
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
@@ -0,0 +1,144 @@
+#!/usr/bin/env python
+# Copyright (C) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * 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.
+# * Neither the Google name nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# 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.
+
+"""Dummy Port implementation used for testing."""
+
+import os
+import time
+
+import base
+
+
+class TestPort(base.Port):
+ """Test implementation of the Port interface."""
+
+ def __init__(self, port_name=None, options=None):
+ base.Port.__init__(self, port_name, options)
+
+ def base_platforms(self):
+ return ('test',)
+
+ def baseline_path(self):
+ curdir = os.path.abspath(__file__)
+ self.topdir = curdir[0:curdir.index("WebKitTools")]
+ return os.path.join(self.topdir, 'LayoutTests', 'platform', 'test')
+
+ def baseline_search_path(self):
+ return [self.baseline_path()]
+
+ def check_sys_deps(self):
+ return True
+
+ def diff_image(self, actual_filename, expected_filename, diff_filename):
+ return False
+
+ def compare_text(self, actual_text, expected_text):
+ return False
+
+ def diff_text(self, actual_text, expected_text,
+ actual_filename, expected_filename):
+ return ''
+
+ def name(self):
+ return self._name
+
+ def num_cores(self):
+ return int(os.popen2("sysctl -n hw.ncpu")[1].read())
+
+ def options(self):
+ return self._options
+
+ def results_directory(self):
+ return '/tmp' + self._options.results_directory
+
+ def setup_test_run(self):
+ pass
+
+ def show_results_html_file(self, filename):
+ pass
+
+ def start_driver(self, image_path, options):
+ return TestDriver(image_path, options, self)
+
+ def start_http_server(self):
+ pass
+
+ def start_websocket_server(self):
+ pass
+
+ def start_helper(self):
+ pass
+
+ def stop_http_server(self):
+ pass
+
+ def stop_websocket_server(self):
+ pass
+
+ def stop_helper(self):
+ pass
+
+ def test_expectations(self):
+ return ''
+
+ def test_base_platform_names(self):
+ return ('test',)
+
+ def test_platform_name(self):
+ return 'test'
+
+ def test_platform_names(self):
+ return self.test_base_platform_names()
+
+ def version():
+ return ''
+
+ def wdiff_text(self, actual_filename, expected_filename):
+ return ''
+
+
+class TestDriver(base.Driver):
+ """Test/Dummy implementation of the DumpRenderTree interface."""
+
+ def __init__(self, image_path, test_driver_options, port):
+ self._driver_options = test_driver_options
+ self._image_path = image_path
+ self._port = port
+
+ def poll(self):
+ return True
+
+ def returncode(self):
+ return 0
+
+ def run_test(self, uri, timeoutms, image_hash):
+ return (False, False, image_hash, '', None)
+
+ def stop(self):
+ pass
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list