Changeset 90520 in webkit
- Timestamp:
- Jul 6, 2011, 6:22:31 PM (14 years ago)
- Location:
- trunk/Tools
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r90519 r90520 1 2011-07-06 Dirk Pranke <dpranke@chromium.org> 2 3 Reviewed by Eric Siedel. 4 5 nrwt: make the code be consistent about using test names instead of filenames or paths 6 7 https://bugs.webkit.org/show_bug.cgi?id=63597 8 9 It can be hard to figure out where in the code we're assuming 10 test names are listed as unix-style relative filenames and where 11 they are either absolute paths or relative paths following the 12 host filesystem convention. 13 14 This patch changes things so that everything outside of the 15 Port object uses (and must assume) unix-style relative 16 filenames (with one exception, which is specifying host-local 17 filenames as a list of test arguments on the command line). 18 19 This should make things clearer and more consistent, and also 20 removes a lot of path conversion calls. 21 22 The changes in this patch outside of port/base.py are largely 23 cosmetic changes of "filename" to "test". We add a few routines 24 to the base Port implementation to manipulate test names to 25 split them, figure out if we're referring to a directory of 26 tests, etc. 27 28 * Scripts/webkitpy/common/net/layouttestresults.py: 29 * Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py: 30 * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py: 31 * Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py: 32 * Scripts/webkitpy/layout_tests/layout_package/manager.py: 33 * Scripts/webkitpy/layout_tests/layout_package/manager_unittest.py: 34 * Scripts/webkitpy/layout_tests/layout_package/printing.py: 35 * Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py: 36 * Scripts/webkitpy/layout_tests/layout_package/result_summary.py: 37 * Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py: 38 * Scripts/webkitpy/layout_tests/layout_package/test_expectations.py: 39 * Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py: 40 * Scripts/webkitpy/layout_tests/layout_package/test_input.py: 41 * Scripts/webkitpy/layout_tests/layout_package/test_result_writer.py: 42 * Scripts/webkitpy/layout_tests/layout_package/test_results.py: 43 * Scripts/webkitpy/layout_tests/layout_package/test_results_unittest.py: 44 * Scripts/webkitpy/layout_tests/layout_package/worker.py: 45 * Scripts/webkitpy/layout_tests/port/base.py: 46 * Scripts/webkitpy/layout_tests/port/base_unittest.py: 47 * Scripts/webkitpy/layout_tests/port/chromium.py: 48 * Scripts/webkitpy/layout_tests/port/chromium_unittest.py: 49 * Scripts/webkitpy/layout_tests/port/dryrun.py: 50 * Scripts/webkitpy/layout_tests/port/test.py: 51 * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py: 52 * Scripts/webkitpy/style/checkers/test_expectations_unittest.py: 53 * Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests.py: 54 * Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests_unittest.py: 55 * Scripts/webkitpy/tool/bot/flakytestreporter.py: 56 * Scripts/webkitpy/tool/commands/rebaseline.py: 57 * Scripts/webkitpy/tool/commands/rebaselineserver.py: 58 1 59 2011-07-06 Chris Guillory <ctguil@chromium.org> 2 60 -
trunk/Tools/Scripts/webkitpy/common/net/layouttestresults.py
r90055 r90520 173 173 174 174 def failing_tests(self): 175 return [result. filename for result in self.failing_test_results()]175 return [result.test_name for result in self.failing_test_results()] -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py
r90024 r90520 72 72 self._expectations = expectations 73 73 74 # We want relative paths to LayoutTest root for JSON output.75 path_to_name = self._get_path_relative_to_layout_test_root76 74 self._result_summary = result_summary 77 self._failures = dict( 78 (path_to_name(test), test_failures.determine_result_type(failures)) 79 for (test, failures) in result_summary.failures.iteritems()) 80 self._all_tests = [path_to_name(test) for test in all_tests] 81 self._test_timings = dict( 82 (path_to_name(test_tuple.filename), test_tuple.test_run_time) 83 for test_tuple in test_timings) 75 self._failures = dict((test_name, test_failures.determine_result_type(failures)) 76 for (test_name, failures) in result_summary.failures.iteritems()) 77 self._all_tests = all_tests 78 self._test_timings = dict((test_tuple.test_name, test_tuple.test_run_time) for test_tuple in test_timings) 84 79 85 80 self.generate_json_output() -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
r90024 r90520 69 69 70 70 def test_timings_trie(port, individual_test_timings): 71 """Breaks a filename into chunks by directory and puts the test time as a value in the lowest part, e.g.71 """Breaks a test name into chunks by directory and puts the test time as a value in the lowest part, e.g. 72 72 foo/bar/baz.html: 1ms 73 73 foo/bar/baz1.html: 3ms … … 83 83 trie = {} 84 84 for test_result in individual_test_timings: 85 try: 86 test = port.relative_test_filename(test_result.filename) 87 except AssertionError: 88 # FIXME: Handle this better. Non-layout tests shouldn't be relativized. 89 test = test_result.filename 85 test = test_result.test_name 90 86 91 87 parts = test.split('/') … … 108 104 (NONE, FAILS, FLAKY, DISABLED) = range(4) 109 105 110 def __init__(self, name, failed=False, elapsed_time=0): 111 # FIXME: s/filename/name to be consistent with the rest of layout_package. 112 self.filename = name 106 def __init__(self, test, failed=False, elapsed_time=0): 107 self.test_name = test 113 108 self.failed = failed 114 109 self.test_run_time = elapsed_time 115 110 116 test_name = name111 test_name = test 117 112 try: 118 test_name = name.split('.')[1]113 test_name = test.split('.')[1] 119 114 except IndexError: 120 _log.warn("Invalid test name: %s.", name)115 _log.warn("Invalid test name: %s.", test) 121 116 pass 122 117 … … 321 316 def _get_failed_test_names(self): 322 317 """Returns a set of failed test names.""" 323 return set([r. filename for r in self._test_results if r.failed])318 return set([r.test_name for r in self._test_results if r.failed]) 324 319 325 320 def _get_modifier_char(self, test_name): -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py
r90024 r90520 86 86 87 87 port = Mock() 88 port.relative_test_filename = lambda filename: filename89 88 port._filesystem = filesystem_mock.MockFileSystem() 90 89 generator = json_results_generator.JSONResultsGeneratorBase(port, … … 201 200 test_port = test.TestPort() 202 201 individual_test_timings = [] 203 individual_test_timings.append(json_results_generator.TestResult(' /test.checkout/LayoutTests/foo/bar/baz.html', elapsed_time=1.2))204 individual_test_timings.append(json_results_generator.TestResult(' /test.checkout/LayoutTests/bar.html', elapsed_time=0.0001))202 individual_test_timings.append(json_results_generator.TestResult('foo/bar/baz.html', elapsed_time=1.2)) 203 individual_test_timings.append(json_results_generator.TestResult('bar.html', elapsed_time=0.0001)) 205 204 trie = json_results_generator.test_timings_trie(test_port, individual_test_timings) 206 205 207 206 expected_trie = { 208 207 'bar.html': 0, … … 213 212 } 214 213 } 215 214 216 215 self.assertEqual(simplejson.dumps(trie), simplejson.dumps(expected_trie)) 217 218 216 217 219 218 220 219 if __name__ == '__main__': -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/manager.py
r90419 r90520 122 122 original_results = result_summary.unexpected_results if only_unexpected else result_summary.results 123 123 124 for filename, result in original_results.iteritems():124 for test_name, result in original_results.iteritems(): 125 125 # Note that if a test crashed in the original run, we ignore 126 126 # whether or not it crashed when we retried it (if we retried it), 127 127 # and always consider the result not flaky. 128 test = port_obj.relative_test_filename(filename) 129 expected = expectations.get_expectations_string(filename) 128 expected = expectations.get_expectations_string(test_name) 130 129 result_type = result.type 131 130 actual = [keywords[result_type]] … … 145 144 elif result_type == test_expectations.CRASH: 146 145 num_regressions += 1 147 elif filename in result_summary.unexpected_results:148 if filename not in retry_summary.unexpected_results:149 actual.extend(expectations.get_expectations_string( filename).split(" "))146 elif test_name in result_summary.unexpected_results: 147 if test_name not in retry_summary.unexpected_results: 148 actual.extend(expectations.get_expectations_string(test_name).split(" ")) 150 149 num_flaky += 1 151 150 else: 152 retry_result_type = retry_summary.unexpected_results[ filename].type151 retry_result_type = retry_summary.unexpected_results[test_name].type 153 152 if result_type != retry_result_type: 154 153 actual.append(keywords[retry_result_type]) … … 195 194 # } 196 195 # } 197 parts = test .split('/')196 parts = test_name.split('/') 198 197 current_map = tests 199 198 for i, part in enumerate(parts): … … 277 276 self._message_broker = None 278 277 279 self.HTTP_SUBDIR = self._fs.join('', 'http', '')280 self.WEBSOCKET_SUBDIR = self._fs.join('', 'websocket', '')281 self.LAYOUT_TESTS_DIRECTORY = "LayoutTests" + self._fs.sep278 self.HTTP_SUBDIR = port.TEST_PATH_SEPARATOR + 'http' + port.TEST_PATH_SEPARATOR 279 self.WEBSOCKET_SUBDIR = port.TEST_PATH_SEPARATOR + 'websocket' + port.TEST_PATH_SEPARATOR 280 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' 282 281 self._has_http_lock = False 283 282 … … 313 312 paths += last_unexpected_results 314 313 if self._options.test_list: 315 paths += self._strip_test_dir_prefixes(read_test_files(self._fs, self._options.test_list ))314 paths += self._strip_test_dir_prefixes(read_test_files(self._fs, self._options.test_list, self._port.TEST_PATH_SEPARATOR)) 316 315 self._test_files = self._port.tests(paths) 317 316 … … 320 319 321 320 def _strip_test_dir_prefix(self, path): 322 if path.startswith(self.LAYOUT_TESTS_DIRECTORY): 323 return path[len(self.LAYOUT_TESTS_DIRECTORY):] 321 # Handle both "LayoutTests/foo/bar.html" and "LayoutTests\foo\bar.html" if 322 # the filesystem uses '\\' as a directory separator. 323 if path.startswith(self.LAYOUT_TESTS_DIRECTORY + self._port.TEST_PATH_SEPARATOR): 324 return path[len(self.LAYOUT_TESTS_DIRECTORY + self._port.TEST_PATH_SEPARATOR):] 325 if path.startswith(self.LAYOUT_TESTS_DIRECTORY + self._fs.sep): 326 return path[len(self.LAYOUT_TEST_DIRECTORY + self._fs.sep):] 324 327 return path 325 328 … … 394 397 random.shuffle(self._test_files_list) 395 398 else: 396 self._test_files_list.sort(key=lambda path: path_key(self._fs, path))399 self._test_files_list.sort(key=lambda test: test_key(self._port, test)) 397 400 398 401 # If the user specifies they just want to run a subset of the tests, … … 512 515 """Returns the highest-level directory by which to shard the given 513 516 test file.""" 514 index = test_file.rfind(self._fs.sep + self.LAYOUT_TESTS_DIRECTORY) 515 516 test_file = test_file[index + len(self.LAYOUT_TESTS_DIRECTORY):] 517 test_file_parts = test_file.split(self._fs.sep, 1) 518 directory = test_file_parts[0] 519 test_file = test_file_parts[1] 517 directory, test_file = self._port.split_test(test_file) 520 518 521 519 # The http tests are very stable on mac/linux. … … 523 521 # turn shard the http tests there as well. Switching to apache is 524 522 # what made them stable on linux/mac. 525 return_value = directory 526 while ((directory != 'http' or sys.platform == 'darwin' or sys.platform.startswith('linux')) 527 and test_file.find(self._fs.sep) >= 0): 528 test_file_parts = test_file.split(self._fs.sep, 1) 529 directory = test_file_parts[0] 530 return_value = self._fs.join(return_value, directory) 531 test_file = test_file_parts[1] 532 533 return return_value 523 return directory 534 524 535 525 def _get_test_input_for_file(self, test_file): … … 544 534 """Return True if the test needs to be locked when 545 535 running multiple copies of NRWTs.""" 546 split_path = test_file.split(self._port. _filesystem.sep)536 split_path = test_file.split(self._port.TEST_PATH_SEPARATOR) 547 537 return 'http' in split_path or 'websocket' in split_path 548 538 549 539 def _test_is_slow(self, test_file): 550 return self._expectations.has_modifier(test_file, 551 test_expectations.SLOW) 540 return self._expectations.has_modifier(test_file, test_expectations.SLOW) 552 541 553 542 def _shard_tests(self, test_files, num_workers, fully_parallel): … … 1009 998 result_summary.add(result, expected=True) 1010 999 else: 1011 expected = self._expectations.matches_an_expected_result(result. filename, result.type, self._options.pixel_tests)1000 expected = self._expectations.matches_an_expected_result(result.test_name, result.type, self._options.pixel_tests) 1012 1001 result_summary.add(result, expected) 1013 exp_str = self._expectations.get_expectations_string(result. filename)1002 exp_str = self._expectations.get_expectations_string(result.test_name) 1014 1003 got_str = self._expectations.expectation_to_string(result.type) 1015 1004 self._printer.print_test_result(result, expected, exp_str, got_str) … … 1220 1209 unexpected_slow_tests = [] 1221 1210 for test_tuple in individual_test_timings: 1222 filename = test_tuple.filename1211 test_name = test_tuple.test_name 1223 1212 is_timeout_crash_or_slow = False 1224 if self._test_is_slow( filename):1213 if self._test_is_slow(test_name): 1225 1214 is_timeout_crash_or_slow = True 1226 1215 slow_tests.append(test_tuple) 1227 1216 1228 if filename in result_summary.failures:1229 result = result_summary.results[ filename].type1217 if test_name in result_summary.failures: 1218 result = result_summary.results[test_name].type 1230 1219 if (result == test_expectations.TIMEOUT or 1231 1220 result == test_expectations.CRASH): … … 1261 1250 self._printer.print_timing(title) 1262 1251 for test_tuple in test_list: 1263 filename = test_tuple.filename[len(1264 self._port.layout_tests_dir()) + 1:]1265 filename = filename.replace('\\', '/')1266 1252 test_run_time = round(test_tuple.test_run_time, 1) 1267 self._printer.print_timing(" %s took %s seconds" % 1268 (filename, test_run_time)) 1253 self._printer.print_timing(" %s took %s seconds" % (test_tuple.test_name, test_run_time)) 1269 1254 1270 1255 def _print_directory_timings(self, directory_test_timings): … … 1420 1405 def handle_started_test(self, source, test_info, hang_timeout): 1421 1406 worker_state = self._worker_states[source] 1422 worker_state.current_test_name = self._port.relative_test_filename(test_info.filename)1407 worker_state.current_test_name = test_info.test_name 1423 1408 worker_state.next_timeout = time.time() + hang_timeout 1424 1409 … … 1470 1455 _log.error(' %s' % text) 1471 1456 1472 def read_test_files(fs, files): 1457 1458 def read_test_files(fs, files, test_path_separator): 1473 1459 tests = [] 1474 1460 for file in files: 1475 1461 try: 1462 if test_path_separator != fs.sep: 1463 file = file.replace(test_path_separator, fs.sep) 1476 1464 file_contents = fs.read_text_file(file).split('\n') 1477 1465 for line in file_contents: … … 1489 1477 # FIXME: These two free functions belong either on manager (since it's the only one 1490 1478 # which uses them) or in a different file (if they need to be re-used). 1491 def path_key(filesystem, path):1492 """Turns a pathinto a list with two sublists, the natural key of the1479 def test_key(port, test_name): 1480 """Turns a test name into a list with two sublists, the natural key of the 1493 1481 dirname, and the natural key of the basename. 1494 1482 … … 1496 1484 directory are kept together rather than being mixed in with files in 1497 1485 subdirectories.""" 1498 dirname, basename = filesystem.split(path)1499 return (natural_sort_key(dirname + filesystem.sep), natural_sort_key(basename))1486 dirname, basename = port.split_test(test_name) 1487 return (natural_sort_key(dirname + port.TEST_PATH_SEPARATOR), natural_sort_key(basename)) 1500 1488 1501 1489 -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/manager_unittest.py
r90419 r90520 37 37 from webkitpy.common.system import outputcapture 38 38 from webkitpy.thirdparty.mock import Mock 39 from webkitpy import layout_tests 40 from webkitpy.layout_tests import port 39 41 40 42 from webkitpy import layout_tests 41 43 from webkitpy.layout_tests import run_webkit_tests 42 from webkitpy.layout_tests.layout_package.manager import Manager, natural_sort_key, path_key, TestRunInterruptedException, TestShard44 from webkitpy.layout_tests.layout_package.manager import Manager, natural_sort_key, test_key, TestRunInterruptedException, TestShard 43 45 from webkitpy.layout_tests.layout_package import printing 44 46 from webkitpy.layout_tests.layout_package.result_summary import ResultSummary … … 52 54 53 55 class ShardingTests(unittest.TestCase): 54 # FIXME: Remove "LayoutTests" from this if we can ever convert the generic55 # code from filenames to test names.56 56 test_list = [ 57 " LayoutTests/http/tests/websocket/tests/unicode.htm",58 " LayoutTests/animations/keyframes.html",59 " LayoutTests/http/tests/security/view-source-no-refresh.html",60 " LayoutTests/http/tests/websocket/tests/websocket-protocol-ignored.html",61 " LayoutTests/fast/css/display-none-inline-style-change-crash.html",62 " LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html",63 " LayoutTests/dom/html/level2/html/HTMLAnchorElement03.html",64 " LayoutTests/ietestcenter/Javascript/11.1.5_4-4-c-1.html",65 " LayoutTests/dom/html/level2/html/HTMLAnchorElement06.html",57 "http/tests/websocket/tests/unicode.htm", 58 "animations/keyframes.html", 59 "http/tests/security/view-source-no-refresh.html", 60 "http/tests/websocket/tests/websocket-protocol-ignored.html", 61 "fast/css/display-none-inline-style-change-crash.html", 62 "http/tests/xmlhttprequest/supported-xml-content-types.html", 63 "dom/html/level2/html/HTMLAnchorElement03.html", 64 "ietestcenter/Javascript/11.1.5_4-4-c-1.html", 65 "dom/html/level2/html/HTMLAnchorElement06.html", 66 66 ] 67 67 68 68 def get_shards(self, num_workers, fully_parallel): 69 port = Mock()69 port = layout_tests.port.get(port_name='test') 70 70 port._filesystem = filesystem_mock.MockFileSystem() 71 71 self.manager = ManagerWrapper(port=port, options=Mock(), printer=Mock()) … … 80 80 self.assertEquals(locked, 81 81 [TestShard('locked_shard_1', 82 [' LayoutTests/http/tests/security/view-source-no-refresh.html',83 ' LayoutTests/http/tests/websocket/tests/unicode.htm',84 ' LayoutTests/http/tests/websocket/tests/websocket-protocol-ignored.html',85 ' LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html'])])82 ['http/tests/security/view-source-no-refresh.html', 83 'http/tests/websocket/tests/unicode.htm', 84 'http/tests/websocket/tests/websocket-protocol-ignored.html', 85 'http/tests/xmlhttprequest/supported-xml-content-types.html'])]) 86 86 self.assertEquals(unlocked, 87 87 [TestShard('animations', 88 [' LayoutTests/animations/keyframes.html']),88 ['animations/keyframes.html']), 89 89 TestShard('dom/html/level2/html', 90 [' LayoutTests/dom/html/level2/html/HTMLAnchorElement03.html',91 ' LayoutTests/dom/html/level2/html/HTMLAnchorElement06.html']),90 ['dom/html/level2/html/HTMLAnchorElement03.html', 91 'dom/html/level2/html/HTMLAnchorElement06.html']), 92 92 TestShard('fast/css', 93 [' LayoutTests/fast/css/display-none-inline-style-change-crash.html']),93 ['fast/css/display-none-inline-style-change-crash.html']), 94 94 TestShard('ietestcenter/Javascript', 95 [' LayoutTests/ietestcenter/Javascript/11.1.5_4-4-c-1.html'])])95 ['ietestcenter/Javascript/11.1.5_4-4-c-1.html'])]) 96 96 97 97 def test_shard_every_file(self): 98 98 locked, unlocked = self.get_shards(num_workers=2, fully_parallel=True) 99 99 self.assertEquals(locked, 100 [TestShard('.', [' LayoutTests/http/tests/websocket/tests/unicode.htm']),101 TestShard('.', [' LayoutTests/http/tests/security/view-source-no-refresh.html']),102 TestShard('.', [' LayoutTests/http/tests/websocket/tests/websocket-protocol-ignored.html']),103 TestShard('.', [' LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html'])])100 [TestShard('.', ['http/tests/websocket/tests/unicode.htm']), 101 TestShard('.', ['http/tests/security/view-source-no-refresh.html']), 102 TestShard('.', ['http/tests/websocket/tests/websocket-protocol-ignored.html']), 103 TestShard('.', ['http/tests/xmlhttprequest/supported-xml-content-types.html'])]) 104 104 self.assertEquals(unlocked, 105 [TestShard('.', [' LayoutTests/animations/keyframes.html']),106 TestShard('.', [' LayoutTests/fast/css/display-none-inline-style-change-crash.html']),107 TestShard('.', [' LayoutTests/dom/html/level2/html/HTMLAnchorElement03.html']),108 TestShard('.', [' LayoutTests/ietestcenter/Javascript/11.1.5_4-4-c-1.html']),109 TestShard('.', [' LayoutTests/dom/html/level2/html/HTMLAnchorElement06.html'])])105 [TestShard('.', ['animations/keyframes.html']), 106 TestShard('.', ['fast/css/display-none-inline-style-change-crash.html']), 107 TestShard('.', ['dom/html/level2/html/HTMLAnchorElement03.html']), 108 TestShard('.', ['ietestcenter/Javascript/11.1.5_4-4-c-1.html']), 109 TestShard('.', ['dom/html/level2/html/HTMLAnchorElement06.html'])]) 110 110 111 111 def test_shard_in_two(self): … … 113 113 self.assertEquals(locked, 114 114 [TestShard('locked_tests', 115 [' LayoutTests/http/tests/websocket/tests/unicode.htm',116 ' LayoutTests/http/tests/security/view-source-no-refresh.html',117 ' LayoutTests/http/tests/websocket/tests/websocket-protocol-ignored.html',118 ' LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html'])])115 ['http/tests/websocket/tests/unicode.htm', 116 'http/tests/security/view-source-no-refresh.html', 117 'http/tests/websocket/tests/websocket-protocol-ignored.html', 118 'http/tests/xmlhttprequest/supported-xml-content-types.html'])]) 119 119 self.assertEquals(unlocked, 120 120 [TestShard('unlocked_tests', 121 ['LayoutTests/animations/keyframes.html', 122 'LayoutTests/fast/css/display-none-inline-style-change-crash.html', 123 'LayoutTests/dom/html/level2/html/HTMLAnchorElement03.html', 124 'LayoutTests/ietestcenter/Javascript/11.1.5_4-4-c-1.html', 125 'LayoutTests/dom/html/level2/html/HTMLAnchorElement06.html'])]) 126 121 ['animations/keyframes.html', 122 'fast/css/display-none-inline-style-change-crash.html', 123 'dom/html/level2/html/HTMLAnchorElement03.html', 124 'ietestcenter/Javascript/11.1.5_4-4-c-1.html', 125 'dom/html/level2/html/HTMLAnchorElement06.html'])]) 126 127 128 class ManagerTest(unittest.TestCase): 127 129 def test_http_locking(tester): 128 130 class LockCheckingManager(Manager): … … 160 162 def test_interrupt_if_at_failure_limits(self): 161 163 port = Mock() 164 port.TEST_PATH_SEPARATOR = '/' 162 165 port._filesystem = filesystem_mock.MockFileSystem() 163 166 manager = Manager(port=port, options=MockOptions(), printer=Mock()) … … 207 210 208 211 209 class PathCompareTest(unittest.TestCase):212 class KeyCompareTest(unittest.TestCase): 210 213 def setUp(self): 211 self.filesystem = filesystem_mock.MockFileSystem() 212 213 def path_key(self, k): 214 return path_key(self.filesystem, k) 214 self.port = layout_tests.port.get('test') 215 215 216 216 def assert_cmp(self, x, y, result): 217 self.assertEquals(cmp( self.path_key(x), self.path_key(y)), result)218 219 def test_ path_compare(self):217 self.assertEquals(cmp(test_key(self.port, x), test_key(self.port, y)), result) 218 219 def test_test_key(self): 220 220 self.assert_cmp('/a', '/a', 0) 221 221 self.assert_cmp('/a', '/b', -1) -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/printing.py
r88986 r90520 322 322 - timing info 323 323 """ 324 filename = result.filename325 test_name = self._port.relative_test_filename(filename)324 filename = self._port.abspath_for_test(result.test_name) 325 test_name = result.test_name 326 326 self._write('trace: %s' % test_name) 327 327 for extension in ('.txt', '.png', '.wav', '.webarchive'): … … 334 334 def _print_baseline(self, filename, extension): 335 335 baseline = self._port.expected_filename(filename, extension) 336 if self._port. path_exists(baseline):336 if self._port._filesystem.exists(baseline): 337 337 relpath = self._port.relative_test_filename(baseline) 338 338 else: … … 344 344 desc = TestExpectations.EXPECTATION_DESCRIPTIONS[result.type][0] 345 345 self.write(" %s -> unexpected %s" % 346 (self._port.relative_test_filename(result.filename), 347 desc), "unexpected") 346 (result.test_name, desc), "unexpected") 348 347 349 348 def print_progress(self, result_summary, retrying, test_list): -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py
r90413 r90520 124 124 return printer, regular_output, buildbot_output 125 125 126 def get_result(self, test , result_type=test_expectations.PASS, run_time=0):126 def get_result(self, test_name, result_type=test_expectations.PASS, run_time=0): 127 127 failures = [] 128 128 if result_type == test_expectations.TIMEOUT: … … 130 130 elif result_type == test_expectations.CRASH: 131 131 failures = [test_failures.FailureCrash()] 132 path = self._port._filesystem.join(self._port.layout_tests_dir(), test) 133 return test_results.TestResult(path, failures=failures, test_run_time=run_time) 134 135 def get_result_summary(self, tests, expectations_str): 136 test_paths = [self._port._filesystem.join(self._port.layout_tests_dir(), test) for 137 test in tests] 132 return test_results.TestResult(test_name, failures=failures, test_run_time=run_time) 133 134 def get_result_summary(self, test_names, expectations_str): 138 135 expectations = test_expectations.TestExpectations( 139 self._port, test_ paths, expectations_str,136 self._port, test_names, expectations_str, 140 137 self._port.test_configuration(), 141 138 is_lint_mode=False) 142 139 143 rs = result_summary.ResultSummary(expectations, test_ paths)144 return test_ paths, rs, expectations140 rs = result_summary.ResultSummary(expectations, test_names) 141 return test_names, rs, expectations 145 142 146 143 def test_help_printer(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/result_summary.py
r90413 r90520 74 74 """ 75 75 76 self.tests_by_expectation[result.type].add(result. filename)77 self.results[result. filename] = result76 self.tests_by_expectation[result.type].add(result.test_name) 77 self.results[result.test_name] = result 78 78 self.remaining -= 1 79 79 if len(result.failures): 80 self.failures[result. filename] = result.failures80 self.failures[result.test_name] = result.failures 81 81 if expected: 82 82 self.expected += 1 83 83 else: 84 self.unexpected_results[result. filename] = result84 self.unexpected_results[result.test_name] = result 85 85 self.unexpected += 1 86 86 if len(result.failures): -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py
r90506 r90520 52 52 self._port = port 53 53 self._driver = driver 54 self._filename = test_input.filename55 54 self._timeout = test_input.timeout 56 55 self._worker_name = worker_name 57 self._test name = port.relative_test_filename(test_input.filename)56 self._test_name = test_input.test_name 58 57 59 58 self._is_reftest = False … … 62 61 63 62 fs = port._filesystem 64 reftest_expected_filename = port.reftest_expected_filename(self._ filename)63 reftest_expected_filename = port.reftest_expected_filename(self._test_name) 65 64 if fs.exists(reftest_expected_filename): 66 65 self._is_reftest = True 67 66 self._reference_filename = reftest_expected_filename 68 67 69 reftest_expected_mismatch_filename = port.reftest_expected_mismatch_filename(self._ filename)68 reftest_expected_mismatch_filename = port.reftest_expected_mismatch_filename(self._test_name) 70 69 if fs.exists(reftest_expected_mismatch_filename): 71 70 if self._is_reftest: … … 85 84 # in either layout tests or reftests, but not in both. 86 85 for suffix in ('.txt', '.png', '.wav'): 87 expected_filename = self._port.expected_filename(self._ filename, suffix)86 expected_filename = self._port.expected_filename(self._test_name, suffix) 88 87 if fs.exists(expected_filename): 89 88 _log.error('The reftest (%s) can not have an expectation file (%s).' 90 ' Please remove that file.', self._test name, expected_filename)89 ' Please remove that file.', self._test_name, expected_filename) 91 90 92 91 def _expected_driver_output(self): 93 return DriverOutput(self._port.expected_text(self._ filename),94 self._port.expected_image(self._ filename),95 self._port.expected_checksum(self._ filename),96 self._port.expected_audio(self._ filename))92 return DriverOutput(self._port.expected_text(self._test_name), 93 self._port.expected_image(self._test_name), 94 self._port.expected_checksum(self._test_name), 95 self._port.expected_audio(self._test_name)) 97 96 98 97 def _should_fetch_expected_checksum(self): … … 107 106 image_hash = None 108 107 if self._should_fetch_expected_checksum(): 109 image_hash = self._port.expected_checksum(self._ filename)110 return DriverInput(self._ filename, self._timeout, image_hash)108 image_hash = self._port.expected_checksum(self._test_name) 109 return DriverInput(self._test_name, self._timeout, image_hash) 111 110 112 111 def run(self): … … 114 113 if self._is_reftest: 115 114 # Returns a dummy TestResult. We don't have to rebase for reftests. 116 return TestResult(self._ filename)115 return TestResult(self._test_name) 117 116 else: 118 117 return self._run_rebaseline() … … 120 119 if self._port.get_option('pixel_tests'): 121 120 return self._run_reftest() 122 result = TestResult(self._ filename)121 result = TestResult(self._test_name) 123 122 result.type = test_expectations.SKIP 124 123 return result … … 131 130 if self._options.new_test_results: 132 131 self._add_missing_baselines(test_result, driver_output) 133 test_result_writer.write_test_result(self._port, self._ filename, driver_output, expected_driver_output, test_result.failures)132 test_result_writer.write_test_result(self._port, self._test_name, driver_output, expected_driver_output, test_result.failures) 134 133 return test_result 135 134 … … 137 136 driver_output = self._driver.run_test(self._driver_input()) 138 137 failures = self._handle_error(driver_output) 139 test_result_writer.write_test_result(self._port, self._ filename, driver_output, None, failures)138 test_result_writer.write_test_result(self._port, self._test_name, driver_output, None, failures) 140 139 # FIXME: It the test crashed or timed out, it might be bettter to avoid 141 140 # to write new baselines. 142 141 self._overwrite_baselines(driver_output) 143 return TestResult(self._ filename, failures, driver_output.test_time, driver_output.has_stderr())142 return TestResult(self._test_name, failures, driver_output.test_time, driver_output.has_stderr()) 144 143 145 144 def _add_missing_baselines(self, test_result, driver_output): … … 181 180 fs = port._filesystem 182 181 if generate_new_baseline: 183 relative_dir = fs.dirname(self._test name)182 relative_dir = fs.dirname(self._test_name) 184 183 baseline_path = port.baseline_path() 185 184 output_dir = fs.join(baseline_path, relative_dir) 186 output_file = fs.basename(fs.splitext(self._ filename)[0] +185 output_file = fs.basename(fs.splitext(self._test_name)[0] + 187 186 "-expected" + modifier) 188 187 fs.maybe_make_directory(output_dir) 189 188 output_path = fs.join(output_dir, output_file) 190 189 else: 191 output_path = port.expected_filename(self._ filename, modifier)190 output_path = port.expected_filename(self._test_name, modifier) 192 191 193 192 result_name = fs.relpath(output_path, port.layout_tests_dir()) 194 193 _log.info('Writing new expected result "%s"' % result_name) 195 196 194 port.update_baseline(output_path, data) 197 195 … … 213 211 testname = self._port.relative_test_filename(reference_filename) 214 212 else: 215 testname = self._test name213 testname = self._test_name 216 214 217 215 if driver_output.crash: … … 231 229 # Don't continue any more if we already have a crash. 232 230 # In case of timeouts, we continue since we still want to see the text and image output. 233 return TestResult(self._ filename, failures, driver_output.test_time, driver_output.has_stderr())231 return TestResult(self._test_name, failures, driver_output.test_time, driver_output.has_stderr()) 234 232 235 233 failures.extend(self._compare_text(driver_output.text, expected_driver_output.text)) … … 237 235 if self._options.pixel_tests: 238 236 failures.extend(self._compare_image(driver_output, expected_driver_output)) 239 return TestResult(self._ filename, failures, driver_output.test_time, driver_output.has_stderr())237 return TestResult(self._test_name, failures, driver_output.test_time, driver_output.has_stderr()) 240 238 241 239 def _compare_text(self, actual_text, expected_text): … … 286 284 def _run_reftest(self): 287 285 driver_output1 = self._driver.run_test(self._driver_input()) 288 driver_output2 = self._driver.run_test(DriverInput(self._reference_filename, self._timeout, driver_output1.image_hash)) 286 reference_test_name = self._port.relative_test_filename(self._reference_filename) 287 driver_output2 = self._driver.run_test(DriverInput(reference_test_name, self._timeout, driver_output1.image_hash)) 289 288 test_result = self._compare_output_with_reference(driver_output1, driver_output2) 290 289 291 test_result_writer.write_test_result(self._port, self._ filename, driver_output1, driver_output2, test_result.failures)290 test_result_writer.write_test_result(self._port, self._test_name, driver_output1, driver_output2, test_result.failures) 292 291 return test_result 293 292 … … 299 298 if failures: 300 299 # Don't continue any more if we already have crash or timeout. 301 return TestResult(self._ filename, failures, total_test_time, has_stderr)300 return TestResult(self._test_name, failures, total_test_time, has_stderr) 302 301 failures.extend(self._handle_error(driver_output2, reference_filename=self._reference_filename)) 303 302 if failures: 304 return TestResult(self._ filename, failures, total_test_time, has_stderr)303 return TestResult(self._test_name, failures, total_test_time, has_stderr) 305 304 306 305 if self._is_mismatch_reftest: … … 309 308 elif driver_output1.image_hash != driver_output2.image_hash: 310 309 failures.append(test_failures.FailureReftestMismatch()) 311 return TestResult(self._ filename, failures, total_test_time, has_stderr)310 return TestResult(self._test_name, failures, total_test_time, has_stderr) -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py
r90479 r90520 447 447 448 448 def _add_to_all_expectations(self, test, options, expectations): 449 # Make all paths unix-style so the dashboard doesn't need to.450 test = test.replace('\\', '/')451 449 if not test in self._all_expectations: 452 450 self._all_expectations[test] = [] … … 551 549 552 550 def _check_path_does_not_exist(self, lineno, test_list_path): 553 full_path = self._fs.join(self._port.layout_tests_dir(),554 test_list_path)555 full_path = self._fs.normpath(full_path)556 551 # WebKit's way of skipping tests is to add a -disabled suffix. 557 552 # So we should consider the path existing if the path or the 558 553 # -disabled version exists. 559 if (not self._port. path_exists(full_path)560 and not self._port. path_exists(full_path + '-disabled')):554 if (not self._port.test_exists(test_list_path) 555 and not self._port.test_exists(test_list_path + '-disabled')): 561 556 # Log a non fatal error here since you hit this case any 562 557 # time you update test_expectations.txt without syncing … … 576 571 # files and nodes being categories. 577 572 578 path = self._fs.join(self._port.layout_tests_dir(), test_list_path) 579 path = self._fs.normpath(path) 580 if self._fs.isdir(path): 573 if self._port.test_isdir(test_list_path): 581 574 # this is a test category, return all the tests of the category. 582 path = self._fs.join(path, '')583 584 return [test for test in self._full_test_list if test.startswith( path)]575 test_list_path = self._port.normalize_test_name(test_list_path) 576 577 return [test for test in self._full_test_list if test.startswith(test_list_path)] 585 578 586 579 # this is a test file, do a quick check if it's in the 587 580 # full test suite. 588 581 result = [] 589 if path in self._full_test_list:590 result = [ path, ]582 if test_list_path in self._full_test_list: 583 result = [test_list_path, ] 591 584 return result 592 585 … … 598 591 599 592 self._clear_expectations_for_test(test, test_list_path) 600 self._test_list_paths[test] = (self._ fs.normpath(test_list_path), num_matches, lineno)593 self._test_list_paths[test] = (self._port.normalize_test_name(test_list_path), num_matches, lineno) 601 594 self._add_test(test, modifiers, expectations, options, overrides_allowed) 602 595 … … 655 648 self._remove_from_sets(test, self._result_type_to_tests) 656 649 657 self._test_list_paths[test] = self._ fs.normpath(test_list_path)650 self._test_list_paths[test] = self._port.normalize_test_name(test_list_path) 658 651 659 652 def _remove_from_sets(self, test, dict): … … 675 668 """ 676 669 # FIXME: See comment below about matching test configs and num_matches. 677 678 670 if not test in self._test_list_paths: 679 671 # We've never seen this test before. … … 681 673 682 674 prev_base_path, prev_num_matches, prev_lineno = self._test_list_paths[test] 683 base_path = self._ fs.normpath(test_list_path)675 base_path = self._port.normalize_test_name(test_list_path) 684 676 685 677 if len(prev_base_path) > len(base_path): -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py
r85880 r90520 90 90 91 91 def get_test(self, test_name): 92 return self._fs.join(self._port.layout_tests_dir(), test_name) 92 # FIXME: Remove this routine and just reference test names directly. 93 return test_name 93 94 94 95 def get_basic_tests(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_input.py
r89542 r90520 33 33 """Groups information about a test for easy passing of data.""" 34 34 35 def __init__(self, filename, timeout):35 def __init__(self, test_name, timeout): 36 36 """Holds the input parameters for a test. 37 37 Args: 38 filename: Full path to the test.38 test: name of test (not an absolute path!) 39 39 timeout: Timeout in msecs the driver should use while running the test 40 40 """ 41 # FIXME: filename should really be test_name as a relative path. 42 self.filename = filename 41 self.test_name = test_name 43 42 self.timeout = timeout 44 43 45 44 def __repr__(self): 46 return "TestInput('%s', %d)" % (self. filename, self.timeout)45 return "TestInput('%s', %d)" % (self.test_name, self.timeout) -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_result_writer.py
r90138 r90520 38 38 39 39 40 def write_test_result(port, filename, driver_output,40 def write_test_result(port, test_name, driver_output, 41 41 expected_driver_output, failures): 42 42 """Write the test result to the result output directory.""" 43 43 root_output_dir = port.results_directory() 44 writer = TestResultWriter(port, root_output_dir, filename)44 writer = TestResultWriter(port, root_output_dir, test_name) 45 45 if driver_output.error: 46 46 writer.write_stderr(driver_output.error) … … 74 74 if image_diff: 75 75 writer.write_image_diff_files(image_diff) 76 writer.copy_file(port.reftest_expected_filename( filename), '-expected.html')76 writer.copy_file(port.reftest_expected_filename(test_name), '-expected.html') 77 77 elif isinstance(failure, test_failures.FailureReftestMismatchDidNotOccur): 78 78 writer.write_image_files(driver_output.image, expected_image=None) 79 writer.copy_file(port.reftest_expected_mismatch_filename( filename), '-expected-mismatch.html')79 writer.copy_file(port.reftest_expected_mismatch_filename(test_name), '-expected-mismatch.html') 80 80 else: 81 81 assert isinstance(failure, (test_failures.FailureTimeout,)) … … 96 96 FILENAME_SUFFIX_IMAGE_DIFFS_HTML = "-diffs.html" 97 97 98 def __init__(self, port, root_output_dir, filename):98 def __init__(self, port, root_output_dir, test_name): 99 99 self._port = port 100 100 self._root_output_dir = root_output_dir 101 self._filename = filename 102 self._testname = port.relative_test_filename(filename) 101 self._test_name = test_name 103 102 104 103 def _make_output_directory(self): 105 104 """Creates the output directory (if needed) for a given test filename.""" 106 105 fs = self._port._filesystem 107 output_filename = fs.join(self._root_output_dir, self._test name)106 output_filename = fs.join(self._root_output_dir, self._test_name) 108 107 self._port.maybe_make_directory(fs.dirname(output_filename)) 109 108 … … 121 120 """ 122 121 fs = self._port._filesystem 123 output_filename = fs.join(self._root_output_dir, self._test name)122 output_filename = fs.join(self._root_output_dir, self._test_name) 124 123 return fs.splitext(output_filename)[0] + modifier 125 124 126 125 def _output_testname(self, modifier): 127 126 fs = self._port._filesystem 128 return fs.splitext(fs.basename(self._test name))[0] + modifier127 return fs.splitext(fs.basename(self._test_name))[0] + modifier 129 128 130 129 def write_output_files(self, file_type, output, expected): … … 259 258 </html> 260 259 """ % { 261 'title': self._test name,260 'title': self._test_name, 262 261 'diff_filename': self._output_testname(self.FILENAME_SUFFIX_IMAGE_DIFF), 263 262 'prefix': self._output_testname(''), -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_results.py
r90055 r90520 39 39 return cPickle.loads(str) 40 40 41 def __init__(self, filename, failures=None, test_run_time=None, has_stderr=False): 42 # FIXME: s/filename/name to be consistent with the rest of layout_package. 43 self.filename = filename 41 def __init__(self, test_name, failures=None, test_run_time=None, has_stderr=False): 42 self.test_name = test_name 44 43 self.failures = failures or [] 45 44 self.test_run_time = test_run_time or 0 … … 49 48 50 49 def __eq__(self, other): 51 return (self. filename == other.filename and50 return (self.test_name == other.test_name and 52 51 self.failures == other.failures and 53 52 self.test_run_time == other.test_run_time) -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_results_unittest.py
r89852 r90520 35 35 def test_defaults(self): 36 36 result = TestResult("foo") 37 self.assertEqual(result. filename, 'foo')37 self.assertEqual(result.test_name, 'foo') 38 38 self.assertEqual(result.failures, []) 39 39 self.assertEqual(result.test_run_time, 0) 40 40 41 41 def test_loads(self): 42 result = TestResult( filename='foo',42 result = TestResult(test_name='foo', 43 43 failures=[], 44 44 test_run_time=1.1) -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/worker.py
r90279 r90520 183 183 def clean_up_after_test(self, test_input, result): 184 184 self._batch_count += 1 185 test_name = self._port.relative_test_filename(test_input.filename)185 test_name = test_input.test_name 186 186 self._tests_run_file.write(test_name + "\n") 187 187 … … 247 247 248 248 if not result: 249 result = test_results.TestResult(test_input. filename, failures=[], test_run_time=0)249 result = test_results.TestResult(test_input.test_name, failures=[], test_run_time=0) 250 250 return result 251 251 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py
r90514 r90520 84 84 port_name = None # Subclasses override this 85 85 86 # Test names resemble unix relative paths, and use '/' as a directory separator. 87 TEST_PATH_SEPARATOR = '/' 88 86 89 def __init__(self, port_name=None, options=None, 87 90 executive=None, … … 200 203 return False 201 204 202 if not self. path_exists(self._pretty_patch_path):205 if not self._filesystem.exists(self._pretty_patch_path): 203 206 if logging: 204 207 _log.error("Unable to find %s; can't generate pretty patches." % self._pretty_patch_path) … … 289 292 return "DumpRenderTree" 290 293 291 def expected_baselines(self, filename, suffix, all_baselines=False):294 def expected_baselines(self, test_name, suffix, all_baselines=False): 292 295 """Given a test name, finds where the baseline results are located. 293 296 294 297 Args: 295 filename: absolute filename to test file298 test_name: name of test file (usually a relative path under LayoutTests/) 296 299 suffix: file suffix of the expected results, including dot; e.g. 297 300 '.txt' or '.png'. This should not be None, but may be an empty … … 316 319 platform specific. 317 320 """ 318 testname = self._filesystem.splitext(self.relative_test_filename(filename))[0] 319 320 baseline_filename = testname + '-expected' + suffix 321 321 baseline_filename = self._filesystem.splitext(test_name)[0] + '-expected' + suffix 322 322 baseline_search_path = self.get_option('additional_platform_directory', []) + self.baseline_search_path() 323 323 324 324 baselines = [] 325 325 for platform_dir in baseline_search_path: 326 if self. path_exists(self._filesystem.join(platform_dir, baseline_filename)):326 if self._filesystem.exists(self._filesystem.join(platform_dir, baseline_filename)): 327 327 baselines.append((platform_dir, baseline_filename)) 328 328 … … 333 333 # result in the test directory, even if no such file actually exists. 334 334 platform_dir = self.layout_tests_dir() 335 if self. path_exists(self._filesystem.join(platform_dir, baseline_filename)):335 if self._filesystem.exists(self._filesystem.join(platform_dir, baseline_filename)): 336 336 baselines.append((platform_dir, baseline_filename)) 337 337 … … 341 341 return [(None, baseline_filename)] 342 342 343 def expected_filename(self, filename, suffix):343 def expected_filename(self, test_name, suffix): 344 344 """Given a test name, returns an absolute path to its expected results. 345 345 … … 350 350 351 351 Args: 352 filename: absolute filename to test file352 test_name: name of test file (usually a relative path under LayoutTests/) 353 353 suffix: file suffix of the expected results, including dot; e.g. '.txt' 354 354 or '.png'. This should not be None, but may be an empty string. … … 361 361 """ 362 362 # FIXME: The [0] here is very mysterious, as is the destructured return. 363 platform_dir, baseline_filename = self.expected_baselines( filename, suffix)[0]363 platform_dir, baseline_filename = self.expected_baselines(test_name, suffix)[0] 364 364 if platform_dir: 365 365 return self._filesystem.join(platform_dir, baseline_filename) 366 366 return self._filesystem.join(self.layout_tests_dir(), baseline_filename) 367 367 368 def expected_checksum(self, test ):368 def expected_checksum(self, test_name): 369 369 """Returns the checksum of the image we expect the test to produce, or None if it is a text-only test.""" 370 png_path = self.expected_filename(test , '.png')371 372 if self. path_exists(png_path):370 png_path = self.expected_filename(test_name, '.png') 371 372 if self._filesystem.exists(png_path): 373 373 with self._filesystem.open_binary_file_for_reading(png_path) as filehandle: 374 374 return read_checksum_from_png.read_checksum(filehandle) … … 376 376 return None 377 377 378 def expected_image(self, test ):378 def expected_image(self, test_name): 379 379 """Returns the image we expect the test to produce.""" 380 path = self.expected_filename(test , '.png')381 if not self. path_exists(path):380 path = self.expected_filename(test_name, '.png') 381 if not self._filesystem.exists(path): 382 382 return None 383 383 return self._filesystem.read_binary_file(path) 384 384 385 def expected_audio(self, test ):386 path = self.expected_filename(test , '.wav')387 if not self. path_exists(path):385 def expected_audio(self, test_name): 386 path = self.expected_filename(test_name, '.wav') 387 if not self._filesystem.exists(path): 388 388 return None 389 389 return self._filesystem.read_binary_file(path) 390 390 391 def expected_text(self, test ):391 def expected_text(self, test_name): 392 392 """Returns the text output we expect the test to produce, or None 393 393 if we don't expect there to be any text output. … … 396 396 # output from DRT (instead treating it as a binary string), we read the 397 397 # baselines as a binary string, too. 398 path = self.expected_filename(test , '.txt')399 if not self. path_exists(path):400 path = self.expected_filename(test , '.webarchive')401 if not self. path_exists(path):398 path = self.expected_filename(test_name, '.txt') 399 if not self._filesystem.exists(path): 400 path = self.expected_filename(test_name, '.webarchive') 401 if not self._filesystem.exists(path): 402 402 return None 403 403 text = self._filesystem.read_binary_file(path) 404 404 return text.replace("\r\n", "\n") 405 405 406 def reftest_expected_filename(self, filename):406 def reftest_expected_filename(self, test_name): 407 407 """Return the filename of reference we expect the test matches.""" 408 return self.expected_filename( filename, '.html')409 410 def reftest_expected_mismatch_filename(self, filename):408 return self.expected_filename(test_name, '.html') 409 410 def reftest_expected_mismatch_filename(self, test_name): 411 411 """Return the filename of reference we don't expect the test matches.""" 412 return self.expected_filename( filename, '-mismatch.html')413 414 def filename_to_uri(self, filename):415 """Convert a test file (which is an absolute path)to a URI."""412 return self.expected_filename(test_name, '-mismatch.html') 413 414 def test_to_uri(self, test_name): 415 """Convert a test name to a URI.""" 416 416 LAYOUTTEST_HTTP_DIR = "http/tests/" 417 417 LAYOUTTEST_WEBSOCKET_DIR = "http/tests/websocket/tests/" 418 418 419 relative_path = self.relative_test_filename(filename)420 419 port = None 421 420 use_ssl = False 422 421 422 relative_path = test_name 423 423 if (relative_path.startswith(LAYOUTTEST_WEBSOCKET_DIR) 424 424 or relative_path.startswith(LAYOUTTEST_HTTP_DIR)): … … 438 438 return "%s://127.0.0.1:%u/%s" % (protocol, port, relative_path) 439 439 440 return path.abspath_to_uri(self. _filesystem.abspath(filename))440 return path.abspath_to_uri(self.abspath_for_test(test_name)) 441 441 442 442 def tests(self, paths): 443 """Return the list of tests found (relative to layout_tests_dir().""" 444 return test_files.find(self, paths) 443 """Return the list of tests found.""" 444 # FIXME: Should test_files.find() return normalized, relative test names? 445 return set([self.relative_test_filename(f) for f in test_files.find(self, paths)]) 445 446 446 447 def test_dirs(self): … … 450 451 self._filesystem.listdir(layout_tests_dir)) 451 452 452 def path_isdir(self, path):453 """Return True if the pathrefers to a directory of tests."""453 def test_isdir(self, test_name): 454 """Return True if the test name refers to a directory of tests.""" 454 455 # Used by test_expectations.py to apply rules to whole directories. 456 path = self.abspath_for_test(test_name) 455 457 return self._filesystem.isdir(path) 456 458 457 def path_exists(self, path):458 """Return True if the pathrefers to an existing test or baseline."""459 def test_exists(self, test_name): 460 """Return True if the test name refers to an existing test or baseline.""" 459 461 # Used by test_expectations.py to determine if an entry refers to a 460 462 # valid test and by printing.py to determine if baselines exist. 463 path = self.abspath_for_test(test_name) 461 464 return self._filesystem.exists(path) 465 466 def split_test(self, test_name): 467 """Splits a test name into the 'directory' part and the 'basename' part.""" 468 index = test_name.rfind(self.TEST_PATH_SEPARATOR) 469 if index < 1: 470 return ('', test_name) 471 return (test_name[0:index], test_name[index:]) 472 473 def normalize_test_name(self, test_name): 474 """Returns a normalized version of the test name or test directory.""" 475 if self.test_isdir(test_name) and not test_name.endswith('/'): 476 return test_name + '/' 477 return test_name 462 478 463 479 def driver_cmd_line(self): -
trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py
r90506 r90520 191 191 self.assertTrue('css2.1' in dirs) 192 192 193 def test_ filename_to_uri(self):193 def test_test_to_uri(self): 194 194 port = Port() 195 195 layout_test_dir = port.layout_tests_dir() 196 test_file = port._filesystem.join(layout_test_dir, "foo", "bar.html") 197 198 # On Windows, absolute paths are of the form "c:\foo.txt". However, 199 # all current browsers (except for Opera) normalize file URLs by 200 # prepending an additional "/" as if the absolute path was 201 # "/c:/foo.txt". This means that all file URLs end up with "file:///" 202 # at the beginning. 196 test = 'foo/bar.html' 197 path = port._filesystem.join(layout_test_dir, test) 203 198 if sys.platform == 'win32': 204 prefix = "file:///" 205 path = test_file.replace("\\", "/") 206 else: 207 prefix = "file://" 208 path = test_file 209 210 self.assertEqual(port.filename_to_uri(test_file), abspath_to_uri(test_file)) 199 path = path.replace("\\", "/") 200 201 self.assertEqual(port.test_to_uri(test), abspath_to_uri(path)) 211 202 212 203 def test_get_option__set(self): … … 237 228 port.baseline_search_path = lambda: ['LayoutTests/platform/foo'] 238 229 layout_test_dir = port.layout_tests_dir() 239 test_file = filesystem.join(layout_test_dir, 'fast', 'test.html')230 test_file = 'fast/test.html' 240 231 241 232 # No additional platform directory -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py
r90514 r90520 289 289 self, all_test_files, expectations_str, self.test_configuration(), 290 290 is_lint_mode=False, overrides=overrides_str) 291 tests_dir = self.layout_tests_dir() 292 return [self.relative_test_filename(test) 293 for test in expectations.get_tests_with_result_type(test_expectations.SKIP)] 291 return expectations.get_tests_with_result_type(test_expectations.SKIP) 294 292 295 293 def test_repository_paths(self): … … 484 482 has_base64 = False 485 483 486 uri = self._port. filename_to_uri(driver_input.filename)484 uri = self._port.test_to_uri(driver_input.test_name) 487 485 cmd = self._test_shell_command(uri, driver_input.timeout, 488 486 driver_input.image_hash) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
r90138 r90520 185 185 port = ChromiumPortTest.TestLinuxPort(options=mock_options) 186 186 187 fake_test = port._filesystem.join(port.layout_tests_dir(), "fast/js/not-good.js")187 fake_test = 'fast/js/not-good.js' 188 188 189 189 port.test_expectations = lambda: """BUG_TEST SKIP : fast/js/not-good.js = TEXT … … 191 191 port.test_expectations_overrides = lambda: '' 192 192 port.tests = lambda paths: set() 193 port. path_exists = lambda test: True193 port.test_exists = lambda test: True 194 194 195 195 skipped_tests = port.skipped_layout_tests(extra_test_files=[fake_test, ]) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py
r90506 r90520 31 31 32 32 class DriverInput(object): 33 def __init__(self, filename, timeout, image_hash): 34 # FIXME: The args should just be renamed to reflect their use. 35 self.filename = filename # Full path to the test. 33 def __init__(self, test_name, timeout, image_hash): 34 self.test_name = test_name 36 35 self.timeout = timeout # in ms 37 36 self.image_hash = image_hash -
trunk/Tools/Scripts/webkitpy/layout_tests/port/dryrun.py
r90506 r90520 116 116 start_time = time.time() 117 117 fs = self._port._filesystem 118 if (fs.exists(self._port.reftest_expected_filename(driver_input. filename)) or119 fs.exists(self._port.reftest_expected_mismatch_filename(driver_input. filename)) or120 driver_input. filename.endswith('-expected.html')):118 if (fs.exists(self._port.reftest_expected_filename(driver_input.test_name)) or 119 fs.exists(self._port.reftest_expected_mismatch_filename(driver_input.test_name)) or 120 driver_input.test_name.endswith('-expected.html')): 121 121 text = 'test-text' 122 122 image = 'test-image' 123 123 checksum = 'test-checksum' 124 124 audio = None 125 elif driver_input. filename.endswith('-expected-mismatch.html'):125 elif driver_input.test_name.endswith('-expected-mismatch.html'): 126 126 text = 'test-text-mismatch' 127 127 image = 'test-image-mismatch' … … 129 129 audio = None 130 130 else: 131 text = self._port.expected_text(driver_input. filename)132 image = self._port.expected_image(driver_input. filename)133 checksum = self._port.expected_checksum(driver_input. filename)134 audio = self._port.expected_audio(driver_input. filename)131 text = self._port.expected_text(driver_input.test_name) 132 image = self._port.expected_image(driver_input.test_name) 133 checksum = self._port.expected_checksum(driver_input.test_name) 134 audio = self._port.expected_audio(driver_input.test_name) 135 135 return DriverOutput(text, image, checksum, audio, crash=False, test_time=time.time() - start_time, timeout=False, error='') 136 136 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py
r90506 r90520 202 202 if test_input.uri.startswith('http'): 203 203 test_name = port.uri_to_test_name(test_input.uri) 204 test_path = self._filesystem.join(port.layout_tests_dir(), test_name) 205 else: 206 test_path = test_input.uri 207 208 actual_text = port.expected_text(test_path) 209 actual_audio = port.expected_audio(test_path) 210 if self._options.pixel_tests and test_input.checksum: 211 actual_checksum = port.expected_checksum(test_path) 212 actual_image = port.expected_image(test_path) 204 else: 205 test_name = port.relative_test_filename(test_input.uri) 206 207 actual_text = port.expected_text(test_name) 208 actual_audio = port.expected_audio(test_name) 209 if self._options.pixel_tests and test_input.checksum: 210 actual_checksum = port.expected_checksum(test_name) 211 actual_image = port.expected_image(test_name) 213 212 214 213 if actual_audio: … … 258 257 port = self._port 259 258 test_name = self._port.uri_to_test_name(test_input.uri) 260 test_path = self._filesystem.join(port.layout_tests_dir(), test_name) 261 262 actual_text = port.expected_text(test_path) 259 260 actual_text = port.expected_text(test_name) 263 261 actual_image = '' 264 262 actual_checksum = '' 265 263 if self._options.pixel_tests and test_input.checksum: 266 actual_checksum = port.expected_checksum(test_ path)264 actual_checksum = port.expected_checksum(test_name) 267 265 if actual_checksum != test_input.checksum: 268 actual_image = port.expected_image(test_ path)266 actual_image = port.expected_image(test_name) 269 267 270 268 self._stdout.write("#URL:%s\n" % test_input.uri) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py
r90514 r90520 85 85 86 86 class MockDRTTest(unittest.TestCase): 87 def to_path(self, port, test_name):88 return port._filesystem.join(port.layout_tests_dir(), test_name)89 90 87 def input_line(self, port, test_name, checksum=None): 91 url = port. filename_to_uri(self.to_path(port, test_name))88 url = port.test_to_uri(test_name) 92 89 # FIXME: we shouldn't have to work around platform-specific issues 93 90 # here. … … 111 108 def make_input_output(self, port, test_name, pixel_tests, 112 109 expected_checksum, drt_output, drt_input=None): 113 path = self.to_path(port, test_name)114 110 if pixel_tests: 115 111 if not expected_checksum: 116 expected_checksum = port.expected_checksum( path)112 expected_checksum = port.expected_checksum(test_name) 117 113 if not drt_input: 118 114 drt_input = self.input_line(port, test_name, expected_checksum) 119 text_output = port.expected_text( path)115 text_output = port.expected_text(test_name) 120 116 121 117 if not drt_output: … … 217 213 218 214 def input_line(self, port, test_name, checksum=None): 219 url = port. filename_to_uri(self.to_path(port, test_name))215 url = port.test_to_uri(test_name) 220 216 if checksum: 221 217 return url + ' 6000 ' + checksum + '\n' … … 223 219 224 220 def expected_output(self, port, test_name, pixel_tests, text_output, expected_checksum): 225 url = port. filename_to_uri(self.to_path(port, test_name))221 url = port.test_to_uri(test_name) 226 222 if pixel_tests and expected_checksum: 227 223 return ['#URL:%s\n' % url, -
trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py
r90506 r90520 366 366 # the calls to path.abspath_to_uri() removed. We shouldn't have 367 367 # to do this. 368 def filename_to_uri(self, filename):368 def test_to_uri(self, test_name): 369 369 """Convert a test file (which is an absolute path) to a URI.""" 370 370 LAYOUTTEST_HTTP_DIR = "http/tests/" 371 371 LAYOUTTEST_WEBSOCKET_DIR = "http/tests/websocket/tests/" 372 372 373 relative_path = self.relative_test_filename(filename)374 373 port = None 375 374 use_ssl = False 376 375 376 relative_path = test_name 377 377 if (relative_path.startswith(LAYOUTTEST_WEBSOCKET_DIR) 378 378 or relative_path.startswith(LAYOUTTEST_HTTP_DIR)): … … 393 393 return "%s://127.0.0.1:%u/%s" % (protocol, port, relative_path) 394 394 395 return "file://" + self._filesystem.abspath(filename) 395 return "file://" + self.abspath_for_test(test_name) 396 397 def abspath_for_test(self, test_name): 398 return self.layout_tests_dir() + self.TEST_PATH_SEPARATOR + test_name 396 399 397 400 def uri_to_test_name(self, uri): … … 433 436 def run_test(self, test_input): 434 437 start_time = time.time() 435 test_name = self._port.relative_test_filename(test_input.filename)438 test_name = test_input.test_name 436 439 test = self._port._tests[test_name] 437 440 if test.keyboard: -
trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py
r90506 r90520 421 421 422 422 def _command_from_driver_input(self, driver_input): 423 uri = self._port. filename_to_uri(driver_input.filename)423 uri = self._port.test_to_uri(driver_input.test_name) 424 424 command = uri[7:] if uri.startswith("file:///") else uri 425 425 -
trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py
r90506 r90520 167 167 self._current_test_batch = [] 168 168 test_batches.append(self._current_test_batch) 169 test_name = self._port.relative_test_filename(test_input.filename)169 test_name = test_input.test_name 170 170 # In case of reftest, one test calls the driver's run_test() twice. 171 171 # We should not add a reference html used by reftests to tests unless include_reference_html parameter 172 172 # is explicitly given. 173 if include_reference_html or not is_reference_html_file(test_input. filename):173 if include_reference_html or not is_reference_html_file(test_input.test_name): 174 174 self._current_test_batch.append(test_name) 175 175 return TestDriver.run_test(self, test_input) -
trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py
r86165 r90520 73 73 self._error_collector = ErrorCollector() 74 74 port_obj = port.get('test') 75 self._test_file = port_obj._filesystem.join(port_obj.layout_tests_dir(), 'passes/text.html')75 self._test_file = 'passes/text.html' 76 76 77 77 def process_expectations(self, expectations, overrides=None): -
trunk/Tools/Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests.py
r90138 r90520 456 456 457 457 def _first_fallback_png_for_test(self, test): 458 test_filepath = self._filesystem.join(self._target_port.layout_tests_dir(), test) 459 all_baselines = self._rebaseline_port.expected_baselines( 460 test_filepath, '.png', True) 458 all_baselines = self._rebaseline_port.expected_baselines(test, '.png', True) 461 459 return self._filesystem.join(all_baselines[0][0], all_baselines[0][1]) 462 460 … … 479 477 False otherwise. 480 478 """ 481 test_filepath = self._filesystem.join(self._target_port.layout_tests_dir(), test) 482 all_baselines = self._rebaseline_port.expected_baselines( 483 test_filepath, suffix, True) 484 test_relpath = self._filesystem.relpath(test_filepath, self._target_port.layout_tests_dir()) 479 all_baselines = self._rebaseline_port.expected_baselines(test, suffix, True) 485 480 486 481 for fallback_dir, fallback_file in all_baselines: … … 500 495 is_image = baseline_path.lower().endswith('.png') 501 496 if not self._diff_baselines(new_output, fallback_output, is_image): 502 _log.info(' Skipping %s (matches %s)', test _relpath, fallback_dir_relpath)497 _log.info(' Skipping %s (matches %s)', test, fallback_dir_relpath) 503 498 return True 504 499 return False -
trunk/Tools/Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests_unittest.py
r90506 r90520 312 312 rebaseliner, filesystem = self.make_rebaseliner("") 313 313 port = rebaseliner._port 314 output = port.expected_text( 315 port._filesystem.join(port.layout_tests_dir(), 'passes/text.html')) 314 output = port.expected_text('passes/text.html') 316 315 self.assertFalse(rebaseliner._diff_baselines(output, output, 317 316 is_image=False)) … … 320 319 rebaseliner, filesystem = self.make_rebaseliner('') 321 320 port = rebaseliner._port 322 image = port.expected_image( 323 port._filesystem.join(port.layout_tests_dir(), 'passes/image.html')) 321 image = port.expected_image('passes/image.html') 324 322 self.assertFalse(rebaseliner._diff_baselines(image, image, 325 323 is_image=True)) -
trunk/Tools/Scripts/webkitpy/tool/bot/flakytestreporter.py
r83614 r90520 126 126 def _latest_flake_message(self, flaky_result, patch): 127 127 failure_messages = [failure.message() for failure in flaky_result.failures] 128 flake_message = "The %s just saw %s flake (%s) while processing attachment %s on bug %s." % (self._bot_name, flaky_result. filename, ", ".join(failure_messages), patch.id(), patch.bug_id())128 flake_message = "The %s just saw %s flake (%s) while processing attachment %s on bug %s." % (self._bot_name, flaky_result.test_name, ", ".join(failure_messages), patch.id(), patch.bug_id()) 129 129 return "%s\n%s" % (flake_message, self._bot_info.summary_text()) 130 130 … … 180 180 message = "The %s encountered the following flaky tests while processing attachment %s:\n\n" % (self._bot_name, patch.id()) 181 181 for flaky_result in flaky_test_results: 182 flaky_test = flaky_result. filename182 flaky_test = flaky_result.test_name 183 183 bug = self._lookup_bug_for_flaky_test(flaky_test) 184 184 latest_flake_message = self._latest_flake_message(flaky_result, patch) -
trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
r89965 r90520 105 105 results_url = self._results_url_for_test(build, test) 106 106 # Port operates with absolute paths. 107 absolute_path = os.path.join(port.layout_tests_dir(), test) 108 expected_file = port.expected_filename(absolute_path, ".txt") 107 expected_file = port.expected_filename(test, '.txt') 109 108 print test 110 109 self._replace_expectation_with_remote_result(expected_file, results_url) -
trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py
r90410 r90520 180 180 all_test_baselines = {} 181 181 for baseline_extension in ('.txt', '.checksum', '.png'): 182 test_baselines = test_config.test_port.expected_baselines(test_ path, baseline_extension)183 baselines = all_platforms_port.expected_baselines(test_ path, baseline_extension, all_baselines=True)182 test_baselines = test_config.test_port.expected_baselines(test_file, baseline_extension) 183 baselines = all_platforms_port.expected_baselines(test_file, baseline_extension, all_baselines=True) 184 184 for platform_directory, expected_filename in baselines: 185 185 if not platform_directory:
Note:
See TracChangeset
for help on using the changeset viewer.