Commit e630c435 authored by eric@webkit.org's avatar eric@webkit.org
Browse files

2010-02-16 Eric Seidel <eric@webkit.org>

        Reviewed by Adam Barth.

        re-factor Skipped list parsing code into multiple functions and unit test it
        https://bugs.webkit.org/show_bug.cgi?id=34986

        * Scripts/test-webkitpy: Add new unit test.
        * Scripts/webkitpy/layout_tests/__init__.py: Copied from WebKitTools/QueueStatusServer/filters/__init__.py.
        * Scripts/webkitpy/layout_tests/port/mac.py: Split parsing function into multiple functions for testing.
        * Scripts/webkitpy/layout_tests/port/mac_unittest.py: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent eb026f3e
2010-02-16 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
re-factor Skipped list parsing code into multiple functions and unit test it
https://bugs.webkit.org/show_bug.cgi?id=34986
* Scripts/test-webkitpy: Add new unit test.
* Scripts/webkitpy/layout_tests/__init__.py: Copied from WebKitTools/QueueStatusServer/filters/__init__.py.
* Scripts/webkitpy/layout_tests/port/mac.py: Split parsing function into multiple functions for testing.
* Scripts/webkitpy/layout_tests/port/mac_unittest.py: Added.
2010-02-16 Xan Lopez <xlopez@igalia.com>
 
Reviewed by Gustavo Noronha.
......
......@@ -44,6 +44,7 @@ from webkitpy.credentials_unittest import *
from webkitpy.diff_parser_unittest import *
from webkitpy.executive_unittest import *
from webkitpy.grammar_unittest import *
from webkitpy.layout_tests.port.mac_unittest import *
from webkitpy.multicommandtool_unittest import *
from webkitpy.networktransaction_unittest import *
from webkitpy.patchcollection_unittest import *
......
# Required for Python to search this directory for module files
......@@ -103,8 +103,67 @@ class MacPort(base.Port):
# to return something.
return ('mac',)
def _skipped_file_paths(self):
# This method will need to be made work for non-mac platforms and moved into base.Port.
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'))
return skipped_files
def _tests_for_other_platforms(self):
# The original run-webkit-tests builds up a "whitelist" of tests to run, and passes that to DumpRenderTree.
# run-chromium-webkit-tests assumes we run *all* tests and test_expectations.txt functions as a blacklist.
# FIXME: This list could be dynamic based on platform name and pushed into base.Port.
return [
"platform/chromium",
"platform/gtk",
"platform/qt",
"platform/win",
]
def _tests_for_disabled_features(self):
# FIXME: This should use the feature detection from webkitperl/features.pm to match run-webkit-tests.
# For now we hard-code a list of features known to be disabled on the Mac platform.
disabled_feature_tests = [
"fast/xhtmlmp",
"http/tests/wml",
"mathml",
"wml",
]
# FIXME: webarchive tests expect to read-write from -expected.webarchive files instead of .txt files.
# This script doesn't know how to do that yet, so pretend they're just "disabled".
webarchive_tests = [
"webarchive",
"svg/webarchive",
"http/tests/webarchive",
"svg/custom/image-with-prefix-in-webarchive.svg",
]
return disabled_feature_tests + webarchive_tests
def _tests_from_skipped_file(self, skipped_file):
tests_to_skip = []
for line in skipped_file.readlines():
line = line.strip()
if line.startswith('#') or not len(line):
continue
tests_to_skip.append(line)
return tests_to_skip
def _expectations_from_skipped_files(self):
tests_to_skip = []
for filename in self._skipped_file_paths():
if not os.path.exists(filename):
logging.warn("Failed to open Skipped file: %s" % filename)
continue
skipped_file = file(filename)
tests_to_skip.extend(self._tests_from_skipped_file(skipped_file))
skipped_file.close()
return tests_to_skip
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
......@@ -112,44 +171,11 @@ class MacPort(base.Port):
# 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
tests_to_skip = set(self._expectations_from_skipped_files()) # Use a set to allow duplicates
tests_to_skip.update(self._tests_for_other_platforms())
tests_to_skip.update(self._tests_for_disabled_features())
expectations = map(lambda test_path: "BUG_SKIPPED SKIP : %s = FAIL" % test_path, tests_to_skip)
return "\n".join(expectations)
def test_platform_name(self):
# At the moment we don't use test platform names, but we have
......@@ -390,7 +416,6 @@ class MacDriver(base.Driver):
return (crash, timeout, actual_image_hash,
''.join(output), ''.join(error))
pass
def stop(self):
if self._proc:
......
# 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 unittest
import mac
import StringIO
class MacTest(unittest.TestCase):
def test_skipped_file_paths(self):
port = mac.MacPort()
skipped_paths = port._skipped_file_paths()
# FIXME: _skipped_file_paths should return WebKit-relative paths.
# So to make it unit testable, we strip the WebKit directory from the path.
relative_paths = [path[len(port.path_from_webkit_base()):] for path in skipped_paths]
self.assertEqual(relative_paths, ['LayoutTests/platform/mac-leopard/Skipped', 'LayoutTests/platform/mac/Skipped'])
example_skipped_file = """
# <rdar://problem/5647952> fast/events/mouseout-on-window.html needs mac DRT to issue mouse out events
fast/events/mouseout-on-window.html
# <rdar://problem/5643675> window.scrollTo scrolls a window with no scrollbars
fast/events/attempt-scroll-with-no-scrollbars.html
# see bug <rdar://problem/5646437> REGRESSION (r28015): svg/batik/text/smallFonts fails
svg/batik/text/smallFonts.svg
"""
example_skipped_tests = [
"fast/events/mouseout-on-window.html",
"fast/events/attempt-scroll-with-no-scrollbars.html",
"svg/batik/text/smallFonts.svg",
]
def test_skipped_file_paths(self):
port = mac.MacPort()
skipped_file = StringIO.StringIO(self.example_skipped_file)
self.assertEqual(port._tests_from_skipped_file(skipped_file), self.example_skipped_tests)
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment