diff options
author | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 02:26:37 +0000 |
---|---|---|
committer | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 02:26:37 +0000 |
commit | 6699b9ff7d71b164bb1892f31705deff9f0a7be2 (patch) | |
tree | a9f95fd234b72f2fa2e3bc0562e968fe584c5cb0 /webkit | |
parent | e0328fd02870176594b772af6d6e76574c1bc90d (diff) | |
download | chromium_src-6699b9ff7d71b164bb1892f31705deff9f0a7be2.zip chromium_src-6699b9ff7d71b164bb1892f31705deff9f0a7be2.tar.gz chromium_src-6699b9ff7d71b164bb1892f31705deff9f0a7be2.tar.bz2 |
update update_expecations_from_dashboard to work with the upstreamed
new-run-webkit-tests infrastructure.
The code now runs but it fails several unit tests since we now tack a newline
onto the end of the expectations string. I'll let Ojan deal with that.
BUG=none
TEST=update_expectations_from_dashboard_unittest
R=ojan@chromium.org
Review URL: http://codereview.chromium.org/812006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
2 files changed, 38 insertions, 15 deletions
diff --git a/webkit/tools/layout_tests/webkitpy/layout_tests/update_expectations_from_dashboard.py b/webkit/tools/layout_tests/webkitpy/layout_tests/update_expectations_from_dashboard.py index 87a909e..dffc394 100644 --- a/webkit/tools/layout_tests/webkitpy/layout_tests/update_expectations_from_dashboard.py +++ b/webkit/tools/layout_tests/webkitpy/layout_tests/update_expectations_from_dashboard.py @@ -17,16 +17,39 @@ import logging import os import sys -from layout_package import path_utils +# +# Find the WebKit python directories and add them to the PYTHONPATH +# +try: + f = __file__ +except NameError: + f = sys.argv[0] + +this_file = os.path.abspath(f) +base_dir = this_file[0:this_file.find('webkit'+ os.sep + 'tools')] +webkitpy_dir = os.path.join(base_dir, 'third_party', 'WebKit', 'WebKitTools', + 'Scripts', 'webkitpy') +sys.path.append(os.path.join(webkitpy_dir, 'thirdparty')) +sys.path.append(os.path.join(webkitpy_dir, 'layout_tests')) + +# +# Now import the python packages we need from WebKit +# +import simplejson + from layout_package import test_expectations +import port -sys.path.append(path_utils.path_from_base('third_party')) -import simplejson +def get_port(): + class Options: + def __init__(self): + self.chromium = True + return port.get(None, Options()) -def update_expectations(expectations, updates): - expectations = ExpectationsUpdater(None, None, - 'WIN', False, False, expectations, True) +def update_expectations(port, expectations, updates): + expectations = ExpectationsUpdater(port, expectations, None, 'WIN', + False, False, True) return expectations.update_based_on_json(updates) @@ -67,7 +90,7 @@ class ExpectationsUpdater(test_expectations.TestExpectationsFile): build_types = [] other_options = [] for option in options: - if option in self.PLATFORMS: + if option in self._port.test_platform_names(): platforms.append(option) elif option in self.BUILD_TYPES: build_types.append(option) @@ -80,7 +103,7 @@ class ExpectationsUpdater(test_expectations.TestExpectationsFile): if not len(platforms): # If there are no platforms specified, use the most generic version # of each platform name so we don't have to dedup them later. - platforms = self.BASE_PLATFORMS + platforms = self._port.test_base_platform_names() return (platforms, build_types, other_options) @@ -430,7 +453,7 @@ class ExpectationsUpdater(test_expectations.TestExpectationsFile): platforms: List of lower-case platform names. """ platforms.sort() - if platforms == list(self.BASE_PLATFORMS): + if platforms == list(self._port.test_base_platform_names()): return "" else: return " ".join(platforms) @@ -465,13 +488,11 @@ def main(): updates = simplejson.load(open(sys.argv[1])) - path_to_expectations = path_utils.get_absolute_path( - os.path.dirname(sys.argv[0])) - path_to_expectations = os.path.join(path_to_expectations, - "test_expectations.txt") + port_obj = get_port() + path_to_expectations = port_obj.path_to_expectations_file() old_expectations = open(path_to_expectations).read() - new_expectations = update_expectations(old_expectations, updates) + new_expectations = update_expectations(port_obj, old_expectations, updates) open(path_to_expectations, 'w').write(new_expectations) if '__main__' == __name__: diff --git a/webkit/tools/layout_tests/webkitpy/layout_tests/update_expectations_from_dashboard_unittest.py b/webkit/tools/layout_tests/webkitpy/layout_tests/update_expectations_from_dashboard_unittest.py index 33afb4d..034831c 100644 --- a/webkit/tools/layout_tests/webkitpy/layout_tests/update_expectations_from_dashboard_unittest.py +++ b/webkit/tools/layout_tests/webkitpy/layout_tests/update_expectations_from_dashboard_unittest.py @@ -16,6 +16,8 @@ import update_expectations_from_dashboard class UpdateExpectationsUnittest(unittest.TestCase): ########################################################################### # Tests + def setUp(self): + self._port = update_expectations_from_dashboard.get_port() def test_keeps_unmodified_lines(self): expectations = """// Ensure comments and newlines don't get stripped. @@ -346,7 +348,7 @@ class UpdateExpectationsUnittest(unittest.TestCase): def update_expectations(self, expectations, updates, expected_results): results = update_expectations_from_dashboard.update_expectations( - expectations, updates) + self._port, expectations, updates) self.assertEqual(expected_results, results) if '__main__' == __name__: |