summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/webkitpy/layout_tests
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-05-21 16:53:46 +0100
committerKristian Monsen <kristianm@google.com>2010-05-25 10:24:15 +0100
commit6c2af9490927c3c5959b5cb07461b646f8b32f6c (patch)
treef7111b9b22befab472616c1d50ec94eb50f1ec8c /WebKitTools/Scripts/webkitpy/layout_tests
parenta149172322a9067c14e8b474a53e63649aa17cad (diff)
downloadexternal_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.zip
external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.gz
external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.bz2
Merge WebKit at r59636: Initial merge by git
Change-Id: I59b289c4e6b18425f06ce41cc9d34c522515de91
Diffstat (limited to 'WebKitTools/Scripts/webkitpy/layout_tests')
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream.py10
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream_unittest.py28
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing.py20
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py56
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_results_uploader.py71
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/base.py11
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py7
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py7
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py39
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py8
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/factory_unittest.py138
-rwxr-xr-xWebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py18
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py12
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py32
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py25
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/win.py5
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py41
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py88
-rwxr-xr-xWebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py42
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py27
20 files changed, 554 insertions, 131 deletions
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream.py
index 9c42d73..20646a1 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream.py
@@ -137,12 +137,10 @@ class MeteredStream:
# Print the necessary number of backspaces to erase the previous
# message.
if len(self._last_update):
- self._stream.write("\b" * len(self._last_update))
- if len(str):
- self._stream.write(str)
- num_remaining = len(self._last_update) - len(str)
- if num_remaining > 0:
- self._stream.write(" " * num_remaining + "\b" * num_remaining)
+ self._stream.write("\b" * len(self._last_update) +
+ " " * len(self._last_update) +
+ "\b" * len(self._last_update))
+ self._stream.write(str)
last_newline = str.rfind("\n")
self._last_update = str[(last_newline + 1):]
self._dirty = True
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream_unittest.py
index 926f9b3..a9c6d5b 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/metered_stream_unittest.py
@@ -50,32 +50,36 @@ class TestMeteredStream(unittest.TestCase):
# for coverage.
m.write("foo")
m.flush()
- self.assertEquals(a.get(), ['foo'])
+ exp = ['foo']
+ self.assertEquals(a.get(), exp)
# now check that a second write() does not overwrite the first.
m.write("bar")
- self.assertEquals(a.get(), ['foo', 'bar'])
+ exp.append('bar')
+ self.assertEquals(a.get(), exp)
m.update("batter")
- self.assertEquals(a.get(), ['foo', 'bar', 'batter'])
+ exp.append('batter')
+ self.assertEquals(a.get(), exp)
# The next update() should overwrite the laste update() but not the
# other text. Note that the cursor is effectively positioned at the
# end of 'foo', even though we had to erase three more characters.
m.update("foo")
- self.assertEquals(a.get(), ['foo', 'bar', 'batter', '\b\b\b\b\b\b',
- 'foo', ' \b\b\b'])
+ exp.append('\b\b\b\b\b\b \b\b\b\b\b\b')
+ exp.append('foo')
+ self.assertEquals(a.get(), exp)
m.progress("progress")
- self.assertEquals(a.get(), ['foo', 'bar', 'batter', '\b\b\b\b\b\b',
- 'foo', ' \b\b\b', '\b\b\b', 'progress'])
+ exp.append('\b\b\b \b\b\b')
+ exp.append('progress')
+ self.assertEquals(a.get(), exp)
# now check that a write() does overwrite the progress bar
m.write("foo")
- self.assertEquals(a.get(), ['foo', 'bar', 'batter', '\b\b\b\b\b\b',
- 'foo', ' \b\b\b', '\b\b\b', 'progress',
- '\b\b\b\b\b\b\b\b',
- 'foo', ' \b\b\b\b\b'])
+ exp.append('\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b')
+ exp.append('foo')
+ self.assertEquals(a.get(), exp)
# Now test that we only back up to the most recent newline.
@@ -84,7 +88,7 @@ class TestMeteredStream(unittest.TestCase):
a.reset()
m.update("foo\nbar")
m.update("baz")
- self.assertEquals(a.get(), ['foo\nbar', '\b\b\b', 'baz'])
+ self.assertEquals(a.get(), ['foo\nbar', '\b\b\b \b\b\b', 'baz'])
def test_verbose(self):
a = ArrayStream()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing.py
index 91d49c6..77de2e0 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing.py
@@ -56,6 +56,8 @@ the output at the beginning of the run, during the run, or at the end:
Overall options:
nothing don't print anything. This overrides every other option
+ default include the default options. This is useful for logging
+ the default options plus additional settings.
everything print everything (except the trace-* options and the
detailed-progress option, see below for the full list )
misc print miscellaneous things like blank lines
@@ -101,15 +103,19 @@ Notes:
--print 'everything' is equivalent to --print '%(everything)s'.
-The default is to --print '%(default)s'.
+The default (--print default) is equivalent to --print '%(default)s'.
""" % {'slowest': NUM_SLOW_TESTS_TO_LOG, 'everything': PRINT_EVERYTHING,
'default': PRINT_DEFAULT}
def print_options():
return [
- # Note: we use print_options rather than just 'print' because print
+ # Note: We use print_options rather than just 'print' because print
# is a reserved word.
+ # Note: Also, we don't specify a default value so we can detect when
+ # no flag is specified on the command line and use different defaults
+ # based on whether or not --verbose is specified (since --print
+ # overrides --verbose).
optparse.make_option("--print", dest="print_options",
help=("controls print output of test run. "
"Use --help-printing for more.")),
@@ -171,6 +177,10 @@ def parse_print_options(print_options, verbose, child_processes,
switches.discard('everything')
switches.update(set(PRINT_EVERYTHING.split(',')))
+ if 'default' in switches:
+ switches.discard('default')
+ switches.update(set(PRINT_DEFAULT.split(',')))
+
if 'detailed-progress' in switches:
switches.discard('one-line-progress')
@@ -310,7 +320,7 @@ class Printer(object):
png_file = self._port.expected_filename(filename, '.png')
if os.path.exists(png_file):
self._write(' png: %s' %
- self._port.relative_test_filename(filename))
+ self._port.relative_test_filename(png_file))
else:
self._write(' png: <none>')
self._write(' exp: %s' % exp_str)
@@ -486,10 +496,8 @@ class Printer(object):
# from the logger :(.
if self._options.verbose:
_log.info(msg)
- elif msg == "":
- self._meter.write("\n")
else:
- self._meter.write(msg)
+ self._meter.write("%s\n" % msg)
#
# Utility routines used by the Controller class
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py
index 8e6aa8f..dba1194 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py
@@ -98,6 +98,44 @@ class TestUtilityFunctions(unittest.TestCase):
options, args = get_options([])
self.assertTrue(options is not None)
+ def test_parse_print_options(self):
+ def test_switches(args, verbose, child_processes, is_fully_parallel,
+ expected_switches_str):
+ options, args = get_options(args)
+ if expected_switches_str:
+ expected_switches = set(expected_switches_str.split(','))
+ else:
+ expected_switches = set()
+ switches = printing.parse_print_options(options.print_options,
+ verbose,
+ child_processes,
+ is_fully_parallel)
+ self.assertEqual(expected_switches, switches)
+
+ # test that we default to the default set of switches
+ test_switches([], False, 1, False,
+ printing.PRINT_DEFAULT)
+
+ # test that verbose defaults to everything
+ test_switches([], True, 1, False,
+ printing.PRINT_EVERYTHING)
+
+ # test that --print default does what it's supposed to
+ test_switches(['--print', 'default'], False, 1, False,
+ printing.PRINT_DEFAULT)
+
+ # test that --print nothing does what it's supposed to
+ test_switches(['--print', 'nothing'], False, 1, False,
+ None)
+
+ # test that --print everything does what it's supposed to
+ test_switches(['--print', 'everything'], False, 1, False,
+ printing.PRINT_EVERYTHING)
+
+ # this tests that '--print X' overrides '--verbose'
+ test_switches(['--print', 'actual'], True, 1, False,
+ 'actual')
+
class Testprinter(unittest.TestCase):
def get_printer(self, args=None, single_threaded=False,
@@ -144,7 +182,7 @@ class Testprinter(unittest.TestCase):
exp_bot = [message + "\n"]
else:
if exp_err is None:
- exp_err = [message]
+ exp_err = [message + "\n"]
if exp_bot is None:
exp_bot = []
do_helper(method_name, 'nothing', 'hello', [], [])
@@ -182,21 +220,21 @@ class Testprinter(unittest.TestCase):
printer, err, out = self.get_printer(['--print', 'one-line-summary'])
printer.print_one_line_summary(1, 1)
- self.assertEquals(err.get(), ["All 1 tests ran as expected.", "\n"])
+ self.assertEquals(err.get(), ["All 1 tests ran as expected.\n", "\n"])
printer, err, out = self.get_printer(['--print', 'everything'])
printer.print_one_line_summary(1, 1)
- self.assertEquals(err.get(), ["All 1 tests ran as expected.", "\n"])
+ self.assertEquals(err.get(), ["All 1 tests ran as expected.\n", "\n"])
err.reset()
printer.print_one_line_summary(2, 1)
self.assertEquals(err.get(),
- ["1 test ran as expected, 1 didn't:", "\n"])
+ ["1 test ran as expected, 1 didn't:\n", "\n"])
err.reset()
printer.print_one_line_summary(3, 2)
self.assertEquals(err.get(),
- ["2 tests ran as expected, 1 didn't:", "\n"])
+ ["2 tests ran as expected, 1 didn't:\n", "\n"])
def test_print_test_result(self):
result = get_result('foo.html')
@@ -212,7 +250,7 @@ class Testprinter(unittest.TestCase):
printer.print_test_result(result, expected=False, exp_str='',
got_str='')
self.assertEquals(err.get(),
- [' foo.html -> unexpected pass'])
+ [' foo.html -> unexpected pass\n'])
printer, err, out = self.get_printer(['--print', 'everything'])
printer.print_test_result(result, expected=True, exp_str='',
@@ -222,7 +260,7 @@ class Testprinter(unittest.TestCase):
printer.print_test_result(result, expected=False, exp_str='',
got_str='')
self.assertEquals(err.get(),
- [' foo.html -> unexpected pass'])
+ [' foo.html -> unexpected pass\n'])
printer, err, out = self.get_printer(['--print', 'nothing'])
printer.print_test_result(result, expected=False, exp_str='',
@@ -318,7 +356,7 @@ class Testprinter(unittest.TestCase):
err.reset()
out.reset()
printer.print_progress(rs, True, test_files)
- self.assertEqual(err.get(), [])
+ self.assertEqual(err.get(), [''])
self.assertTrue(out.empty())
printer, err, out = self.get_printer(
@@ -347,7 +385,7 @@ class Testprinter(unittest.TestCase):
err.reset()
out.reset()
printer.print_progress(rs, True, test_files)
- self.assertEqual(err.get(), [])
+ self.assertEqual(err.get(), [''])
self.assertTrue(out.empty())
def test_write(self):
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_results_uploader.py b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_results_uploader.py
new file mode 100644
index 0000000..680b848
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_results_uploader.py
@@ -0,0 +1,71 @@
+#!/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.
+
+import mimetypes
+import socket
+
+from webkitpy.common.net.networktransaction import NetworkTransaction
+from webkitpy.thirdparty.autoinstalled.mechanize import Browser
+
+
+def get_mime_type(filename):
+ return mimetypes.guess_type(filename)[0] or "text/plain"
+
+
+class TestResultsUploader:
+ def __init__(self, host):
+ self._host = host
+ self._browser = Browser()
+
+ def _upload_files(self, attrs, file_objs):
+ self._browser.open("http://%s/testfile/uploadform" % self._host)
+ self._browser.select_form("test_result_upload")
+ for (name, data) in attrs:
+ self._browser[name] = str(data)
+
+ for (filename, handle) in file_objs:
+ self._browser.add_file(handle, get_mime_type(filename), filename,
+ "file")
+
+ self._browser.submit()
+
+ def upload(self, params, files, timeout_seconds):
+ orig_timeout = socket.getdefaulttimeout()
+ file_objs = []
+ try:
+ file_objs = [(filename, open(path, "rb")) for (filename, path)
+ in files]
+
+ socket.setdefaulttimeout(timeout_seconds)
+ NetworkTransaction(timeout_seconds=timeout_seconds).run(
+ lambda: self._upload_files(params, file_objs))
+ finally:
+ socket.setdefaulttimeout(orig_timeout)
+ for (filename, handle) in file_objs:
+ handle.close()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
index 25946af..a4cbe42 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
@@ -414,10 +414,17 @@ class Port(object):
raise NotImplemented('Port.results_directory')
def setup_test_run(self):
- """This routine can be overridden to perform any port-specific
- work that shouuld be done at the beginning of a test run."""
+ """Perform port-specific work at the beginning of a test run."""
pass
+ def setup_environ_for_server(self):
+ """Perform port-specific work at the beginning of a server launch.
+
+ Returns:
+ Operating-system's environment.
+ """
+ return os.environ
+
def show_html_results_file(self, results_filename):
"""This routine should display the HTML file pointed at by
results_filename in a users' browser."""
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
index a01bd14..979e225 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
@@ -49,11 +49,8 @@ class ChromiumLinuxPort(chromium.ChromiumPort):
chromium.ChromiumPort.__init__(self, port_name, options)
def baseline_search_path(self):
- return [self._webkit_baseline_path('chromium-linux'),
- self._webkit_baseline_path('chromium-win'),
- self._webkit_baseline_path('chromium'),
- self._webkit_baseline_path('win'),
- self._webkit_baseline_path('mac')]
+ port_names = ["chromium-linux", "chromium-win", "chromium", "win", "mac"]
+ return map(self._webkit_baseline_path, port_names)
def check_build(self, needs_http):
result = chromium.ChromiumPort.check_build(self, needs_http)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
index 4ead26f..ba67a3e 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
@@ -52,10 +52,8 @@ class ChromiumMacPort(chromium.ChromiumPort):
chromium.ChromiumPort.__init__(self, port_name, options)
def baseline_search_path(self):
- return [self._webkit_baseline_path('chromium-mac'),
- self._webkit_baseline_path('chromium'),
- self._webkit_baseline_path('mac' + self.version()),
- self._webkit_baseline_path('mac')]
+ port_names = ["chromium-mac", "chromium", "mac" + self.version(), "mac"]
+ return map(self._webkit_baseline_path, port_names)
def check_build(self, needs_http):
result = chromium.ChromiumPort.check_build(self, needs_http)
@@ -87,6 +85,7 @@ class ChromiumMacPort(chromium.ChromiumPort):
return 'mac'
def version(self):
+ # FIXME: It's strange that this string is -version, not just version.
os_version_string = platform.mac_ver()[0] # e.g. "10.5.6"
if not os_version_string:
return '-leopard'
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
index 302af86..ad78e61 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
@@ -43,22 +43,39 @@ class ChromiumWinPort(chromium.ChromiumPort):
def __init__(self, port_name=None, options=None):
if port_name is None:
- port_name = 'chromium-win' + self.version()
- if options and not hasattr(options, 'configuration'):
- options.configuration = 'Release'
+ port_name = "chromium-win" + self.version()
+ if options and not hasattr(options, "configuration"):
+ options.configuration = "Release"
chromium.ChromiumPort.__init__(self, port_name, options)
+ def setup_environ_for_server(self):
+ env = chromium.ChromiumPort.setup_environ_for_server(self)
+ # Put the cygwin directory first in the path to find cygwin1.dll.
+ env["PATH"] = "%s;%s" % (
+ self.path_from_chromium_base("third_party", "cygwin", "bin"),
+ env["PATH"])
+ # Configure the cygwin directory so that pywebsocket finds proper
+ # python executable to run cgi program.
+ env["CYGWIN_PATH"] = self.path_from_chromium_base(
+ "third_party", "cygwin", "bin")
+ if (sys.platform == "win32" and self._options and
+ hasattr(self._options, "register_cygwin") and
+ self._options.register_cygwin):
+ setup_mount = self.path_from_chromium_base("third_party",
+ "cygwin",
+ "setup_mount.bat")
+ self._executive.run_command(setup_mount)
+ return env
+
def baseline_search_path(self):
- dirs = []
+ port_names = []
if self._name == 'chromium-win-xp':
- dirs.append(self._webkit_baseline_path('chromium-win-xp'))
+ port_names.append("chromium-win-xp")
if self._name in ('chromium-win-xp', 'chromium-win-vista'):
- dirs.append(self._webkit_baseline_path('chromium-win-vista'))
- dirs.append(self._webkit_baseline_path('chromium-win'))
- dirs.append(self._webkit_baseline_path('chromium'))
- dirs.append(self._webkit_baseline_path('win'))
- dirs.append(self._webkit_baseline_path('mac'))
- return dirs
+ port_names.append("chromium-win-vista")
+ # FIXME: This may need to include mac-snowleopard like win.py.
+ port_names.extend(["chromium-win", "chromium", "win", "mac"])
+ return map(self._webkit_baseline_path, port_names)
def check_build(self, needs_http):
result = chromium.ChromiumPort.check_build(self, needs_http)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py
index 2cbb1b9..2c92865 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/dryrun.py
@@ -46,6 +46,8 @@
from __future__ import with_statement
+import sys
+
import base
import factory
@@ -172,7 +174,11 @@ class DryrunDriver(base.Driver):
test = uri
if uri.startswith("file:///"):
- test = test.replace('file://', '')
+ if sys.platform == 'win32':
+ test = test.replace('file:///', '')
+ test = test.replace('/', '\\')
+ else:
+ test = test.replace('file://', '')
return test
elif uri.startswith("http://127.0.0.1:8880/"):
# websocket tests
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/factory_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/factory_unittest.py
new file mode 100644
index 0000000..d8dffdf
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/factory_unittest.py
@@ -0,0 +1,138 @@
+# 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.
+
+import sys
+import unittest
+
+import chromium_linux
+import chromium_mac
+import chromium_win
+import dryrun
+import factory
+import gtk
+import mac
+import qt
+import test
+import win
+
+
+class FactoryTest(unittest.TestCase):
+ """Test factory creates proper port object for the target.
+
+ Target is specified by port_name, sys.platform and options.
+
+ """
+ # FIXME: The ports themselves should expose what options they require,
+ # instead of passing generic "options".
+
+ class WebKitOptions(object):
+ """Represents the minimum options for WebKit port."""
+ def __init__(self):
+ self.pixel_tests = False
+
+ class ChromiumOptions(WebKitOptions):
+ """Represents minimum options for Chromium port."""
+ def __init__(self):
+ FactoryTest.WebKitOptions.__init__(self)
+ self.chromium = True
+
+ def setUp(self):
+ self.real_sys_platform = sys.platform
+ self.webkit_options = FactoryTest.WebKitOptions()
+ self.chromium_options = FactoryTest.ChromiumOptions()
+
+ def tearDown(self):
+ sys.platform = self.real_sys_platform
+
+ def assert_port(self, port_name, expected_port):
+ """Helper assert for port_name.
+
+ Args:
+ port_name: port name to get port object.
+ expected_port: class of expected port object.
+
+ """
+ self.assertTrue(isinstance(factory.get(port_name=port_name),
+ expected_port))
+
+ def assert_platform_port(self, platform, options, expected_port):
+ """Helper assert for platform and options.
+
+ Args:
+ platform: sys.platform.
+ options: options to get port object.
+ expected_port: class of expected port object.
+
+ """
+ orig_platform = sys.platform
+ sys.platform = platform
+ self.assertTrue(isinstance(factory.get(options=options),
+ expected_port))
+ sys.platform = orig_platform
+
+ def test_test(self):
+ self.assert_port("test", test.TestPort)
+
+ def test_dryrun(self):
+ self.assert_port("dryrun-test", dryrun.DryRunPort)
+ self.assert_port("dryrun-mac", dryrun.DryRunPort)
+
+ def test_mac(self):
+ self.assert_port("mac", mac.MacPort)
+ self.assert_platform_port("darwin", None, mac.MacPort)
+ self.assert_platform_port("darwin", self.webkit_options, mac.MacPort)
+
+ def test_win(self):
+ self.assert_port("win", win.WinPort)
+ self.assert_platform_port("win32", None, win.WinPort)
+ self.assert_platform_port("win32", self.webkit_options, win.WinPort)
+ self.assert_platform_port("cygwin", None, win.WinPort)
+ self.assert_platform_port("cygwin", self.webkit_options, win.WinPort)
+
+ def test_gtk(self):
+ self.assert_port("gtk", gtk.GtkPort)
+
+ def test_qt(self):
+ self.assert_port("qt", qt.QtPort)
+
+ def test_chromium_mac(self):
+ self.assert_port("chromium-mac", chromium_mac.ChromiumMacPort)
+ self.assert_platform_port("darwin", self.chromium_options,
+ chromium_mac.ChromiumMacPort)
+
+ def test_chromium_linux(self):
+ self.assert_port("chromium-linux", chromium_linux.ChromiumLinuxPort)
+ self.assert_platform_port("linux2", self.chromium_options,
+ chromium_linux.ChromiumLinuxPort)
+
+ def test_chromium_win(self):
+ self.assert_port("chromium-win", chromium_win.ChromiumWinPort)
+ self.assert_platform_port("win32", self.chromium_options,
+ chromium_win.ChromiumWinPort)
+ self.assert_platform_port("cygwin", self.chromium_options,
+ chromium_win.ChromiumWinPort)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py
index fbe47e3..0f8a21e 100755
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py
@@ -55,7 +55,7 @@ class HttpdNotStarted(Exception):
class Lighttpd(http_server_base.HttpServerBase):
def __init__(self, port_obj, output_dir, background=False, port=None,
- root=None, register_cygwin=None, run_background=None):
+ root=None, run_background=None):
"""Args:
output_dir: the absolute path to the layout test result directory
"""
@@ -65,7 +65,6 @@ class Lighttpd(http_server_base.HttpServerBase):
self._process = None
self._port = port
self._root = root
- self._register_cygwin = register_cygwin
self._run_background = run_background
if self._port:
self._port = int(self._port)
@@ -199,20 +198,7 @@ class Lighttpd(http_server_base.HttpServerBase):
shutil.copyfile(os.path.join(module_path, lib_file),
os.path.join(tmp_module_path, lib_file))
- # Put the cygwin directory first in the path to find cygwin1.dll
- env = os.environ
- if sys.platform in ('cygwin', 'win32'):
- env['PATH'] = '%s;%s' % (
- self._port_obj.path_from_chromium_base('third_party',
- 'cygwin', 'bin'),
- env['PATH'])
-
- if sys.platform == 'win32' and self._register_cygwin:
- setup_mount = self._port_obj.path_from_chromium_base('third_party',
- 'cygwin', 'setup_mount.bat')
- # FIXME: Should use Executive.run_command
- subprocess.Popen(setup_mount).wait()
-
+ env = self._port_obj.setup_environ_for_server()
_log.debug('Starting http server')
# FIXME: Should use Executive.run_command
self._process = subprocess.Popen(start_cmd, env=env)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
index 350b088..413b5f2 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
@@ -58,15 +58,15 @@ class MacPort(WebKitPort):
return child_processes
def baseline_search_path(self):
- dirs = []
+ port_names = []
if self._name == 'mac-tiger':
- dirs.append(self._webkit_baseline_path(self._name))
+ port_names.append("mac-tiger")
if self._name in ('mac-tiger', 'mac-leopard'):
- dirs.append(self._webkit_baseline_path('mac-leopard'))
+ port_names.append("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
+ port_names.append("mac-snowleopard")
+ port_names.append("mac")
+ return map(self._webkit_baseline_path, port_names)
def path_to_test_expectations_file(self):
return self.path_from_webkit_base('LayoutTests', 'platform',
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py
index ada83ce..2097ce7 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py
@@ -294,13 +294,33 @@ class WebKitPort(base.Port):
return self.test_base_platform_names() + (
'mac-tiger', 'mac-leopard', 'mac-snowleopard')
+ def _configuration_file_path(self):
+ build_root = self._webkit_build_directory(["--top-level"])
+ return os.path.join(build_root, "Configuration")
+
+ # Easy override for unit tests
+ def _open_configuration_file(self):
+ configuration_path = self._configuration_file_path()
+ return codecs.open(configuration_path, "r", "utf-8")
+
+ def _read_configuration(self):
+ try:
+ with self._open_configuration_file() as file:
+ return file.readline().rstrip()
+ except IOError, e:
+ return None
+
+ # FIXME: This list may be incomplete as Apple has some sekret configs.
+ _RECOGNIZED_CONFIGURATIONS = ("Debug", "Release")
+
def default_configuration(self):
- # This is a bit of a hack. This state exists in a much nicer form in
- # perl-land.
- configuration = ospath.relpath(
- self._webkit_build_directory(["--configuration"]),
- self._webkit_build_directory(["--top-level"]))
- assert(configuration == "Debug" or configuration == "Release")
+ # FIXME: Unify this with webkitdir.pm configuration reading code.
+ configuration = self._read_configuration()
+ if not configuration:
+ configuration = "Release"
+ if configuration not in self._RECOGNIZED_CONFIGURATIONS:
+ _log.warn("Configuration \"%s\" found in %s is not a recognized value.\n" % (configuration, self._configuration_file_path()))
+ _log.warn("Scripts may fail. See 'set-webkit-configuration --help'.")
return configuration
def _webkit_build_directory(self, args):
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py
index ad557bd..22ae780 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py
@@ -46,6 +46,8 @@ import factory
import http_server
from webkitpy.common.system.executive import Executive
+from webkitpy.thirdparty.autoinstalled.pywebsocket import mod_pywebsocket
+
_log = logging.getLogger("webkitpy.layout_tests.port.websocket_server")
@@ -95,15 +97,13 @@ class PyWebSocket(http_server.Lighttpd):
def __init__(self, port_obj, output_dir, port=_DEFAULT_WS_PORT,
root=None, use_tls=False,
- register_cygwin=True,
pidfile=None):
"""Args:
output_dir: the absolute path to the layout test result directory
"""
http_server.Lighttpd.__init__(self, port_obj, output_dir,
port=_DEFAULT_WS_PORT,
- root=root,
- register_cygwin=register_cygwin)
+ root=root)
self._output_dir = output_dir
self._process = None
self._port = port
@@ -159,7 +159,8 @@ class PyWebSocket(http_server.Lighttpd):
python_interp = sys.executable
pywebsocket_base = os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(
- os.path.abspath(__file__)))), 'thirdparty', 'pywebsocket')
+ os.path.abspath(__file__)))), 'thirdparty',
+ 'autoinstalled', 'pywebsocket')
pywebsocket_script = os.path.join(pywebsocket_base, 'mod_pywebsocket',
'standalone.py')
start_cmd = [
@@ -185,21 +186,7 @@ class PyWebSocket(http_server.Lighttpd):
start_cmd.extend(['-t', '-k', self._private_key,
'-c', self._certificate])
- # Put the cygwin directory first in the path to find cygwin1.dll
- env = os.environ
- if sys.platform in ('cygwin', 'win32'):
- env['PATH'] = '%s;%s' % (
- self._port_obj.path_from_chromium_base('third_party',
- 'cygwin', 'bin'),
- env['PATH'])
- env['CYGWIN_PATH'] = self._port_obj.path_from_chromium_base(
- 'third_party', 'cygwin', 'bin')
-
- if sys.platform == 'win32' and self._register_cygwin:
- setup_mount = self._port_obj.path_from_chromium_base(
- 'third_party', 'cygwin', 'setup_mount.bat')
- subprocess.Popen(setup_mount).wait()
-
+ env = self._port_obj.setup_environ_for_server()
env['PYTHONPATH'] = (pywebsocket_base + os.path.pathsep +
env.get('PYTHONPATH', ''))
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/win.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/win.py
index 3b7a817..e05a69d 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/win.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/win.py
@@ -44,6 +44,11 @@ class WinPort(WebKitPort):
port_name = 'win'
WebKitPort.__init__(self, port_name, options)
+ def baseline_search_path(self):
+ # Based on code from old-run-webkit-tests expectedDirectoryForTest()
+ port_names = ["win", "mac-snowleopard", "mac"]
+ return map(self._webkit_baseline_path, port_names)
+
def _tests_for_other_platforms(self):
# FIXME: This list could be dynamic based on platform name and
# pushed into base.Port.
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
index 211ce93..f11b8a9 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
@@ -970,6 +970,28 @@ class HtmlGenerator(object):
return 'Other'
+def get_host_port_object(options):
+ """Return a port object for the platform we're running on."""
+ # The only thing we really need on the host is a way to diff
+ # text files and image files, which means we need to check that some
+ # version of ImageDiff has been built. We will look for either Debug
+ # or Release versions of the default port on the platform.
+ options.configuration = "Release"
+ port_obj = port.get(None, options)
+ if not port_obj.check_image_diff(override_step=None, logging=False):
+ _log.debug('No release version of the image diff binary was found.')
+ options.configuration = "Debug"
+ port_obj = port.get(None, options)
+ if not port_obj.check_image_diff(override_step=None, logging=False):
+ _log.error('No version of image diff was found. Check your build.')
+ return None
+ else:
+ _log.debug('Found the debug version of the image diff binary.')
+ else:
+ _log.debug('Found the release version of the image diff binary.')
+ return port_obj
+
+
def main():
"""Main function to produce new baselines."""
@@ -1034,19 +1056,11 @@ def main():
'%(levelname)s %(message)s'),
datefmt='%y%m%d %H:%M:%S')
- # options.configuration is used by port to locate image_diff binary.
- # Check the imgage_diff release binary, if it does not exist,
- # fallback to debug.
- options.configuration = "Release"
- port_obj = port.get(None, options)
- if not port_obj.check_image_diff(override_step=None, logging=False):
- _log.debug('No release version image diff binary found.')
- options.configuration = "Debug"
- port_obj = port.get(None, options)
- else:
- _log.debug('Found release version image diff binary.')
+ host_port_obj = get_host_port_object(options)
+ if not host_port_obj:
+ sys.exit(1)
- # Verify 'platforms' option is valid
+ # Verify 'platforms' option is valid.
if not options.platforms:
_log.error('Invalid "platforms" option. --platforms must be '
'specified in order to rebaseline.')
@@ -1071,7 +1085,8 @@ def main():
rebaselining_tests = set()
backup = options.backup
for platform in rebaseline_platforms:
- rebaseliner = Rebaseliner(port_obj, target_port_obj, platform, options)
+ rebaseliner = Rebaseliner(host_port_obj, target_port_obj,
+ platform, options)
_log.info('')
log_dashed_string('Rebaseline started', platform)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py
new file mode 100644
index 0000000..fa03238
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py
@@ -0,0 +1,88 @@
+#!/usr/bin/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.
+
+"""Unit tests for rebaseline_chromium_webkit_tests.py."""
+
+import unittest
+
+from webkitpy.layout_tests import port
+from webkitpy.layout_tests import rebaseline_chromium_webkit_tests
+
+
+class MockPort(object):
+ def __init__(self, image_diff_exists):
+ self.image_diff_exists = image_diff_exists
+
+ def check_image_diff(self, override_step, logging):
+ return self.image_diff_exists
+
+
+class MockOptions(object):
+ def __init__(self):
+ self.configuration = None
+
+
+def get_mock_get(config_expectations):
+ def mock_get(port_name, options):
+ return MockPort(config_expectations[options.configuration])
+ return mock_get
+
+
+class TestGetHostPortObject(unittest.TestCase):
+ def assert_result(self, release_present, debug_present, valid_port_obj):
+ # Tests whether we get a valid port object returned when we claim
+ # that Image diff is (or isn't) present in the two configs.
+ port.get = get_mock_get({'Release': release_present,
+ 'Debug': debug_present})
+ options = MockOptions()
+ port_obj = rebaseline_chromium_webkit_tests.get_host_port_object(
+ options)
+ if valid_port_obj:
+ self.assertNotEqual(port_obj, None)
+ else:
+ self.assertEqual(port_obj, None)
+
+ def test_get_host_port_object(self):
+ # Save the normal port.get() function for future testing.
+ old_get = port.get
+
+ # Test whether we get a valid port object back for the four
+ # possible cases of having ImageDiffs built. It should work when
+ # there is at least one binary present.
+ self.assert_result(False, False, False)
+ self.assert_result(True, False, True)
+ self.assert_result(False, True, True)
+ self.assert_result(True, True, True)
+
+ # Restore the normal port.get() function.
+ port.get = old_get
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
index 456c6f3..148174d 100755
--- a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
@@ -62,16 +62,17 @@ import sys
import time
import traceback
-from layout_package import test_expectations
+from layout_package import dump_render_tree_thread
from layout_package import json_layout_results_generator
from layout_package import printing
+from layout_package import test_expectations
from layout_package import test_failures
-from layout_package import dump_render_tree_thread
from layout_package import test_files
+from layout_package import test_results_uploader
from test_types import fuzzy_image_diff
from test_types import image_diff
-from test_types import test_type_base
from test_types import text_diff
+from test_types import test_type_base
from webkitpy.common.system.executive import Executive
from webkitpy.thirdparty import simplejson
@@ -790,6 +791,9 @@ class TestRunner:
self._write_json_files(unexpected_results, result_summary,
individual_test_timings)
+ # Upload generated JSON files to appengine server.
+ self._upload_json_files()
+
# Write the summary to disk (results.html) and display it if requested.
wrote_results = self._write_results_html_file(result_summary)
if self._options.show_results and wrote_results:
@@ -878,6 +882,31 @@ class TestRunner:
_log.debug("Finished writing JSON files.")
+ def _upload_json_files(self):
+ if not self._options.test_results_server:
+ return
+
+ _log.info("Uploading JSON files for builder: %s",
+ self._options.builder_name)
+
+ attrs = [('builder', self._options.builder_name)]
+ json_files = ["expectations.json", "results.json"]
+
+ files = [(file, os.path.join(self._options.results_directory, file))
+ for file in json_files]
+
+ uploader = test_results_uploader.TestResultsUploader(
+ self._options.test_results_server)
+ try:
+ # Set uploading timeout in case appengine server is having problem.
+ # 120 seconds are more than enough to upload test results.
+ uploader.upload(attrs, files, 120)
+ except Exception, err:
+ _log.error("Upload failed: %s" % err)
+ return
+
+ _log.info("JSON files uploaded.")
+
def _print_expected_results_of_type(self, result_summary,
result_type, result_type_str):
"""Print the number of the tests in a given result class.
@@ -1289,11 +1318,11 @@ def run(port_obj, options, args, regular_output=sys.stderr,
if options.print_last_failures or options.retest_last_failures:
unexpected_results_filename = os.path.join(
options.results_directory, "unexpected_results.json")
- with open(unexpected_results_filename, "r", "utf-8") as file:
+ with codecs.open(unexpected_results_filename, "r", "utf-8") as file:
results = simplejson.load(file)
last_unexpected_results = results['tests'].keys()
if options.print_last_failures:
- print "\n".join(last_unexpected_results) + "\n"
+ printer.write("\n".join(last_unexpected_results) + "\n")
return 0
if options.clobber_old_results:
@@ -1608,6 +1637,9 @@ def parse_args(args=None):
"webkit-rel.")),
optparse.make_option("--build-number", default="DUMMY_BUILD_NUMBER",
help=("The build number of the builder running this script.")),
+ optparse.make_option("--test-results-server", default="",
+ help=("If specified, upload results json files to this appengine "
+ "server.")),
]
option_list = (configuration_options + print_options +
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
index cd72fa3..e050cba 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
@@ -78,15 +78,21 @@ class MainTest(unittest.TestCase):
(res, buildbot_output, regular_output) = logging_run(
['--platform', 'test', '--print', 'config', '--child-processes',
'1', 'fast/html'])
- self.assertTrue('Running one DumpRenderTree'
+ self.assertTrue('Running one DumpRenderTree\n'
in regular_output.get())
(res, buildbot_output, regular_output) = logging_run(
['--platform', 'test', '--print', 'config', '--child-processes',
'2', 'fast/html'])
- self.assertTrue('Running 2 DumpRenderTrees in parallel'
+ self.assertTrue('Running 2 DumpRenderTrees in parallel\n'
in regular_output.get())
+ def test_last_results(self):
+ passing_run(['--platform', 'test', 'fast/html'])
+ (res, buildbot_output, regular_output) = logging_run(
+ ['--platform', 'test', '--print-last-failures'])
+ self.assertEqual(regular_output.get(), ['\n\n'])
+ self.assertEqual(buildbot_output.get(), [])
class TestRunnerTest(unittest.TestCase):
@@ -112,16 +118,17 @@ class TestRunnerTest(unittest.TestCase):
class DryrunTest(unittest.TestCase):
def test_basics(self):
+ # FIXME: it's hard to know which platforms are safe to test; the
+ # chromium platforms require a chromium checkout, and the mac platform
+ # requires fcntl, so it can't be tested on win32, etc. There is
+ # probably a better way of handling this.
+ if sys.platform != "mac":
+ return
self.assertTrue(passing_run(['--platform', 'dryrun',
'fast/html']))
- #self.assertTrue(passing_run(['--platform', 'dryrun-mac',
- # 'fast/html']))
- #self.assertTrue(passing_run(['--platform', 'dryrun-chromium-mac',
- # 'fast/html']))
- #self.assertTrue(passing_run(['--platform', 'dryrun-chromium-win',
- # 'fast/html']))
- #self.assertTrue(passing_run(['--platform', 'dryrun-chromium-linux',
- # 'fast/html']))
+ self.assertTrue(passing_run(['--platform', 'dryrun-mac',
+ 'fast/html']))
+
if __name__ == '__main__':
unittest.main()