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

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

Issue 2409903002: When rebaselining testharness tests with new all-PASS results, remove the baseline. (Closed)
Patch Set: Undo docstrings that no longer apply Created 4 years, 2 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 unified diff | Download patch
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 18 matching lines...) Expand all
29 from __future__ import print_function 29 from __future__ import print_function
30 import json 30 import json
31 import logging 31 import logging
32 import optparse 32 import optparse
33 import sys 33 import sys
34 import traceback 34 import traceback
35 35
36 from webkitpy.common.memoized import memoized 36 from webkitpy.common.memoized import memoized
37 from webkitpy.common.net.buildbot import Build 37 from webkitpy.common.net.buildbot import Build
38 from webkitpy.common.system.executive import ScriptError 38 from webkitpy.common.system.executive import ScriptError
39 from webkitpy.layout_tests.models.testharness_results import is_all_pass_testhar ness_result
39 from webkitpy.layout_tests.models.test_expectations import TestExpectations, BAS ELINE_SUFFIX_LIST, SKIP 40 from webkitpy.layout_tests.models.test_expectations import TestExpectations, BAS ELINE_SUFFIX_LIST, SKIP
40 from webkitpy.layout_tests.port import factory 41 from webkitpy.layout_tests.port import factory
41 from webkitpy.tool.commands.command import Command 42 from webkitpy.tool.commands.command import Command
42 43
43 44
44 _log = logging.getLogger(__name__) 45 _log = logging.getLogger(__name__)
45 46
46 47
47 class AbstractRebaseliningCommand(Command): 48 class AbstractRebaseliningCommand(Command):
48 """Base class for rebaseline-related commands.""" 49 """Base class for rebaseline-related commands."""
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 class RebaselineTest(BaseInternalRebaselineCommand): 216 class RebaselineTest(BaseInternalRebaselineCommand):
216 name = "rebaseline-test-internal" 217 name = "rebaseline-test-internal"
217 help_text = "Rebaseline a single test from a buildbot. Only intended for use by other webkit-patch commands." 218 help_text = "Rebaseline a single test from a buildbot. Only intended for use by other webkit-patch commands."
218 219
219 def _save_baseline(self, data, target_baseline): 220 def _save_baseline(self, data, target_baseline):
220 if not data: 221 if not data:
221 _log.debug("No baseline data to save.") 222 _log.debug("No baseline data to save.")
222 return 223 return
223 224
224 filesystem = self._tool.filesystem 225 filesystem = self._tool.filesystem
226 if is_all_pass_testharness_result(data):
227 _log.debug("The new baseline is a passing testharness result with "
228 "no console warnings or errors, so it will not be saved." )
229 if filesystem.exists(target_baseline):
230 filesystem.remove(target_baseline)
231 return
232
225 filesystem.maybe_make_directory(filesystem.dirname(target_baseline)) 233 filesystem.maybe_make_directory(filesystem.dirname(target_baseline))
226 filesystem.write_binary_file(target_baseline, data) 234 filesystem.write_binary_file(target_baseline, data)
227 235
228 def _rebaseline_test(self, builder_name, test_name, suffix, results_url): 236 def _rebaseline_test(self, builder_name, test_name, suffix, results_url):
229 baseline_directory = self._baseline_directory(builder_name) 237 baseline_directory = self._baseline_directory(builder_name)
230 238
231 source_baseline = "%s/%s" % (results_url, self._file_name_for_actual_res ult(test_name, suffix)) 239 source_baseline = "%s/%s" % (results_url, self._file_name_for_actual_res ult(test_name, suffix))
232 target_baseline = self._tool.filesystem.join(baseline_directory, self._f ile_name_for_expected_result(test_name, suffix)) 240 target_baseline = self._tool.filesystem.join(baseline_directory, self._f ile_name_for_expected_result(test_name, suffix))
233 241
234 _log.debug("Retrieving source %s for target %s.", source_baseline, targe t_baseline) 242 _log.debug("Retrieving source %s for target %s.", source_baseline, targe t_baseline)
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 for test in args: 657 for test in args:
650 if test not in test_prefix_list: 658 if test not in test_prefix_list:
651 test_prefix_list[test] = {} 659 test_prefix_list[test] = {}
652 build = Build(builder) 660 build = Build(builder)
653 test_prefix_list[test][build] = suffixes_to_update 661 test_prefix_list[test][build] = suffixes_to_update
654 662
655 if options.verbose: 663 if options.verbose:
656 _log.debug("rebaseline-json: " + str(test_prefix_list)) 664 _log.debug("rebaseline-json: " + str(test_prefix_list))
657 665
658 self.rebaseline(options, test_prefix_list) 666 self.rebaseline(options, test_prefix_list)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698