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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py

Issue 2450383002: Refactoring: Move _port_skips_test to Port class. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 Google Inc. All rights reserved. 1 # Copyright (c) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if not self._tool.filesystem.exists(old_baseline): 185 if not self._tool.filesystem.exists(old_baseline):
186 _log.debug("No existing baseline for %s.", test_name) 186 _log.debug("No existing baseline for %s.", test_name)
187 continue 187 continue
188 188
189 new_baseline = self._tool.filesystem.join(port.baseline_path(), self ._file_name_for_expected_result(test_name, suffix)) 189 new_baseline = self._tool.filesystem.join(port.baseline_path(), self ._file_name_for_expected_result(test_name, suffix))
190 if self._tool.filesystem.exists(new_baseline): 190 if self._tool.filesystem.exists(new_baseline):
191 _log.debug("Existing baseline at %s, not copying over it.", new_ baseline) 191 _log.debug("Existing baseline at %s, not copying over it.", new_ baseline)
192 continue 192 continue
193 193
194 expectations = TestExpectations(port, [test_name]) 194 expectations = TestExpectations(port, [test_name])
195 # TODO(qyearsley): Make sure we're also skipping copying existing ba selines in
196 # the case where the port only runs smoke tests and the test is a sm oke test.
195 if SKIP in expectations.get_expectations(test_name): 197 if SKIP in expectations.get_expectations(test_name):
196 _log.debug("%s is skipped on %s.", test_name, port.name()) 198 _log.debug("%s is skipped on %s.", test_name, port.name())
197 continue 199 continue
198 200
199 old_baselines.append(old_baseline) 201 old_baselines.append(old_baseline)
200 new_baselines.append(new_baseline) 202 new_baselines.append(new_baseline)
201 203
202 for i in range(len(old_baselines)): 204 for i in range(len(old_baselines)):
203 old_baseline = old_baselines[i] 205 old_baseline = old_baselines[i]
204 new_baseline = new_baselines[i] 206 new_baseline = new_baselines[i]
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 # This is so we remove lines for builders that skip this test, e.g. Andr oid skips most 420 # This is so we remove lines for builders that skip this test, e.g. Andr oid skips most
419 # tests and we don't want to leave stray [ Android ] lines in TestExpect ations.. 421 # tests and we don't want to leave stray [ Android ] lines in TestExpect ations..
420 # This is only necessary for "webkit-patch rebaseline" and for rebaselin ing expected 422 # This is only necessary for "webkit-patch rebaseline" and for rebaselin ing expected
421 # failures from garden-o-matic. rebaseline-expectations and auto-rebasel ine will always 423 # failures from garden-o-matic. rebaseline-expectations and auto-rebasel ine will always
422 # pass the exact set of ports to rebaseline. 424 # pass the exact set of ports to rebaseline.
423 for port_name in self._tool.port_factory.all_port_names(): 425 for port_name in self._tool.port_factory.all_port_names():
424 port = self._tool.port_factory.get(port_name) 426 port = self._tool.port_factory.get(port_name)
425 generic_expectations = TestExpectations(port, tests=tests, include_o verrides=False) 427 generic_expectations = TestExpectations(port, tests=tests, include_o verrides=False)
426 full_expectations = TestExpectations(port, tests=tests, include_over rides=True) 428 full_expectations = TestExpectations(port, tests=tests, include_over rides=True)
427 for test in tests: 429 for test in tests:
428 if self._port_skips_test(port, test, generic_expectations, full_ expectations): 430 if port.skips_test(test, generic_expectations, full_expectations ):
429 for test_configuration in port.all_test_configurations(): 431 for test_configuration in port.all_test_configurations():
430 if test_configuration.version == port.test_configuration ().version: 432 if test_configuration.version == port.test_configuration ().version:
431 to_remove.append((test, test_configuration)) 433 to_remove.append((test, test_configuration))
432 434
433 for test in lines_to_remove: 435 for test in lines_to_remove:
434 for builder in lines_to_remove[test]: 436 for builder in lines_to_remove[test]:
435 port = self._tool.port_factory.get_from_builder_name(builder) 437 port = self._tool.port_factory.get_from_builder_name(builder)
436 for test_configuration in port.all_test_configurations(): 438 for test_configuration in port.all_test_configurations():
437 if test_configuration.version == port.test_configuration().v ersion: 439 if test_configuration.version == port.test_configuration().v ersion:
438 to_remove.append((test, test_configuration)) 440 to_remove.append((test, test_configuration))
439 441
440 port = self._tool.port_factory.get() 442 port = self._tool.port_factory.get()
441 expectations = TestExpectations(port, include_overrides=False) 443 expectations = TestExpectations(port, include_overrides=False)
442 expectations_string = expectations.remove_configurations(to_remove) 444 expectations_string = expectations.remove_configurations(to_remove)
443 path = port.path_to_generic_test_expectations_file() 445 path = port.path_to_generic_test_expectations_file()
444 self._tool.filesystem.write_text_file(path, expectations_string) 446 self._tool.filesystem.write_text_file(path, expectations_string)
445 447
446 @staticmethod
447 def _port_skips_test(port, test, generic_expectations, full_expectations):
448 fs = port.host.filesystem
449 if port.default_smoke_test_only():
450 smoke_test_filename = fs.join(port.layout_tests_dir(), 'SmokeTests')
451 if fs.exists(smoke_test_filename) and test not in fs.read_text_file( smoke_test_filename):
452 return True
453
454 return (SKIP in full_expectations.get_expectations(test) and
455 SKIP not in generic_expectations.get_expectations(test))
qyearsley 2016/10/27 00:47:11 It seems like this should just be (SKIP in full_ex
Dirk Pranke 2016/10/27 00:53:45 Unfortunately, I don't remember why we did this. Y
456
457 def _run_in_parallel(self, commands): 448 def _run_in_parallel(self, commands):
458 if not commands: 449 if not commands:
459 return {} 450 return {}
460 451
461 command_results = self._tool.executive.run_in_parallel(commands) 452 command_results = self._tool.executive.run_in_parallel(commands)
462 for _, _, stderr in command_results: 453 for _, _, stderr in command_results:
463 if stderr: 454 if stderr:
464 _log.error(stderr) 455 _log.error(stderr)
465 456
466 change_set = self._extract_expectation_line_changes(command_results) 457 change_set = self._extract_expectation_line_changes(command_results)
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 for test in args: 697 for test in args:
707 if test not in test_prefix_list: 698 if test not in test_prefix_list:
708 test_prefix_list[test] = {} 699 test_prefix_list[test] = {}
709 build = Build(builder) 700 build = Build(builder)
710 test_prefix_list[test][build] = suffixes_to_update 701 test_prefix_list[test][build] = suffixes_to_update
711 702
712 if options.verbose: 703 if options.verbose:
713 _log.debug("rebaseline-json: " + str(test_prefix_list)) 704 _log.debug("rebaseline-json: " + str(test_prefix_list))
714 705
715 self.rebaseline(options, test_prefix_list) 706 self.rebaseline(options, test_prefix_list)
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698