Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations.py

Issue 2200433002: Invoke webkit-patch in update-w3c-test-expectations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modifies get_expected_txt_files Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations.py
index 2a5ef4d82e380518af5a96f459fba4c41b05ec95..3440778d5004e280bd5c6f8a26ea085953076482 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations.py
@@ -10,9 +10,10 @@ by retrieving the try job results for the current CL.
import logging
-from webkitpy.common.net.buildbot import BuildBot
from webkitpy.common.net import rietveld
-
+from webkitpy.common.net.buildbot import BuildBot
+from webkitpy.common.webkit_finder import WebKitFinder
+from webkitpy.w3c.test_parser import TestParser
_log = logging.getLogger(__name__)
@@ -32,6 +33,7 @@ def main(host, port):
test_expectations = expectations_line_adder.merge_dicts(test_expectations, platform_results)
for test_name, platform_result in test_expectations.iteritems():
test_expectations[test_name] = expectations_line_adder.merge_same_valued_keys(platform_result)
+ test_expectations = expectations_line_adder.get_expected_txt_files(test_expectations)
test_expectation_lines = expectations_line_adder.create_line_list(test_expectations)
expectations_line_adder.write_to_test_expectations(host, expectations_file, test_expectation_lines)
@@ -268,3 +270,45 @@ class W3CExpectationsLineAdder(object):
new_data = file_contents[: end_of_comment_line + 1] + all_lines + file_contents[end_of_comment_line:]
file_contents = new_data
host.filesystem.write_text_file(path, file_contents)
+
+ def get_expected_txt_files(self, tests_results):
+ """Gets -expected.txt files.
+
+ Invokes webkit-patch rebaseline-from-try-jobs in order
+ to download new -expected.txt files for testharness.js
+ tests that did not Crash or Timeout. Then the platform-
+ specific test is removed from the overall failure test dictionary.
+
+ Args:
+ tests_results: A dictionary that maps test name to platforms to
+ test results.
+
+ Returns:
+ An updated tests_results dictionary without the platform-specific test-
+ harness.js tests that required new baselines to be downloaded from
+ webkit-patch rebaseline-from-try-jobs.
+ """
+ finder = WebKitFinder(self._host.filesystem)
+ layout_tests_relative_path = self._host.filesystem.relpath(finder.layout_tests_dir(), finder.chromium_base())
+ tests_to_rebaseline = []
+ tests = self._host.executive.run_command(['git', 'diff', 'master', '--name-only'])
+ for test_dir in tests.splitlines():
+ js_test = self.is_js_test(finder, test_dir)
qyearsley 2016/08/01 18:33:19 `test_dir` is generally not a directory, right? It
dcampb 2016/08/02 17:56:57 correct. The name 'test_dir' is a bit confusing.
+ if js_test:
qyearsley 2016/08/01 18:33:19 To simplify the above two lines and avoid adding a
dcampb 2016/08/02 17:56:57 done
+ test_path = self._host.filesystem.relpath(test_dir, layout_tests_relative_path)
+ for platform in tests_results[test_path]:
+ if tests_results[test_path][platform]['actual'] not in ['CRASH', 'TIMEOUT']:
+ del tests_results[test_path][platform]
+ tests_to_rebaseline.append(test_path)
qyearsley 2016/08/01 18:33:19 It seems like you may be able to extract a helper
+ if tests_to_rebaseline:
+ webkit_patch = self._host.filesystem.join(finder.chromium_base(), finder.webkit_base(),
+ finder.path_to_script('webkit-patch'))
+ self._host.executive.run_command(['python', webkit_patch,
+ 'rebaseline-from-try-jobs', '-v',
+ ' '.join(tests_to_rebaseline)])
+ return tests_results
qyearsley 2016/08/01 18:33:19 If we were to write a unit test for this function,
dcampb 2016/08/02 17:56:57 I have extracted helper functions and am currently
+
+ def is_js_test(self, webkit_finder, test_path):
qyearsley 2016/08/01 18:33:18 1. Is test_path relative to the LayoutTests direct
dcampb 2016/08/02 17:56:57 It is relative to layoutTests.
+ absolute_path = self._host.filesystem.join(webkit_finder.chromium_base(), test_path)
+ test_parser = TestParser(None, absolute_path)
+ return test_parser.is_jstest()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698