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

Side by Side Diff: gm/rebaseline_server/compare_to_expectations.py

Issue 287623006: rebaseline_server: apply ignored-tests.txt within rebaseline_server, not just on the bots (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make the code ignore those failures like it's supposed to Created 6 years, 7 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
« no previous file with comments | « no previous file | gm/rebaseline_server/results.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 """ 3 """
4 Copyright 2013 Google Inc. 4 Copyright 2013 Google Inc.
5 5
6 Use of this source code is governed by a BSD-style license that can be 6 Use of this source code is governed by a BSD-style license that can be
7 found in the LICENSE file. 7 found in the LICENSE file.
8 8
9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer. 9 Repackage expected/actual GM results as needed by our HTML rebaseline viewer.
10 """ 10 """
(...skipping 30 matching lines...) Expand all
41 import imagepair 41 import imagepair
42 import imagepairset 42 import imagepairset
43 import results 43 import results
44 44
45 EXPECTATION_FIELDS_PASSED_THRU_VERBATIM = [ 45 EXPECTATION_FIELDS_PASSED_THRU_VERBATIM = [
46 results.KEY__EXPECTATIONS__BUGS, 46 results.KEY__EXPECTATIONS__BUGS,
47 results.KEY__EXPECTATIONS__IGNOREFAILURE, 47 results.KEY__EXPECTATIONS__IGNOREFAILURE,
48 results.KEY__EXPECTATIONS__REVIEWED, 48 results.KEY__EXPECTATIONS__REVIEWED,
49 ] 49 ]
50 DEFAULT_EXPECTATIONS_DIR = os.path.join(TRUNK_DIRECTORY, 'expectations', 'gm') 50 DEFAULT_EXPECTATIONS_DIR = os.path.join(TRUNK_DIRECTORY, 'expectations', 'gm')
51 DEFAULT_IGNORE_FAILURES_FILE = 'ignored-tests.txt'
51 52
52 IMAGEPAIR_SET_DESCRIPTIONS = ('expected image', 'actual image') 53 IMAGEPAIR_SET_DESCRIPTIONS = ('expected image', 'actual image')
53 54
54 55
55 class ExpectationComparisons(results.BaseComparisons): 56 class ExpectationComparisons(results.BaseComparisons):
56 """Loads actual and expected GM results into an ImagePairSet. 57 """Loads actual and expected GM results into an ImagePairSet.
57 58
58 Loads actual and expected results from all builders, except for those skipped 59 Loads actual and expected results from all builders, except for those skipped
59 by _ignore_builder(). 60 by _ignore_builder().
60 61
61 Once this object has been constructed, the results (in self._results[]) 62 Once this object has been constructed, the results (in self._results[])
62 are immutable. If you want to update the results based on updated JSON 63 are immutable. If you want to update the results based on updated JSON
63 file contents, you will need to create a new ExpectationComparisons object.""" 64 file contents, you will need to create a new ExpectationComparisons object."""
64 65
65 def __init__(self, actuals_root=results.DEFAULT_ACTUALS_DIR, 66 def __init__(self, actuals_root=results.DEFAULT_ACTUALS_DIR,
66 expected_root=DEFAULT_EXPECTATIONS_DIR, 67 expected_root=DEFAULT_EXPECTATIONS_DIR,
68 ignore_failures_file=DEFAULT_IGNORE_FAILURES_FILE,
67 generated_images_root=results.DEFAULT_GENERATED_IMAGES_ROOT, 69 generated_images_root=results.DEFAULT_GENERATED_IMAGES_ROOT,
68 diff_base_url=None, builder_regex_list=None): 70 diff_base_url=None, builder_regex_list=None):
69 """ 71 """
70 Args: 72 Args:
71 actuals_root: root directory containing all actual-results.json files 73 actuals_root: root directory containing all actual-results.json files
72 expected_root: root directory containing all expected-results.json files 74 expected_root: root directory containing all expected-results.json files
75 ignore_failures_file: if a file with this name is found within
76 expected_root, ignore failures for any tests listed in the file
73 generated_images_root: directory within which to create all pixel diffs; 77 generated_images_root: directory within which to create all pixel diffs;
74 if this directory does not yet exist, it will be created 78 if this directory does not yet exist, it will be created
75 diff_base_url: base URL within which the client should look for diff 79 diff_base_url: base URL within which the client should look for diff
76 images; if not specified, defaults to a "file:///" URL representation 80 images; if not specified, defaults to a "file:///" URL representation
77 of generated_images_root 81 of generated_images_root
78 builder_regex_list: List of regular expressions specifying which builders 82 builder_regex_list: List of regular expressions specifying which builders
79 we will process. If None, process all builders. 83 we will process. If None, process all builders.
80 """ 84 """
81 time_start = int(time.time()) 85 time_start = int(time.time())
82 if builder_regex_list != None: 86 if builder_regex_list != None:
83 self.set_match_builders_pattern_list(builder_regex_list) 87 self.set_match_builders_pattern_list(builder_regex_list)
84 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root) 88 self._image_diff_db = imagediffdb.ImageDiffDB(generated_images_root)
85 self._diff_base_url = ( 89 self._diff_base_url = (
86 diff_base_url or 90 diff_base_url or
87 download_actuals.create_filepath_url(generated_images_root)) 91 download_actuals.create_filepath_url(generated_images_root))
88 self._actuals_root = actuals_root 92 self._actuals_root = actuals_root
89 self._expected_root = expected_root 93 self._expected_root = expected_root
94 self._ignore_failures_on_these_tests = []
95 if ignore_failures_file:
96 self._ignore_failures_on_these_tests = (
97 ExpectationComparisons._read_noncomment_lines(
98 os.path.join(expected_root, ignore_failures_file)))
90 self._load_actual_and_expected() 99 self._load_actual_and_expected()
91 self._timestamp = int(time.time()) 100 self._timestamp = int(time.time())
92 logging.info('Results complete; took %d seconds.' % 101 logging.info('Results complete; took %d seconds.' %
93 (self._timestamp - time_start)) 102 (self._timestamp - time_start))
94 103
95 def edit_expectations(self, modifications): 104 def edit_expectations(self, modifications):
96 """Edit the expectations stored within this object and write them back 105 """Edit the expectations stored within this object and write them back
97 to disk. 106 to disk.
98 107
99 Note that this will NOT update the results stored in self._results[] ; 108 Note that this will NOT update the results stored in self._results[] ;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 # from the most recent actuals). Treat these as successes 318 # from the most recent actuals). Treat these as successes
310 # instead of failures. 319 # instead of failures.
311 # 320 #
312 # TODO(epoger): Do we need to do something similar in 321 # TODO(epoger): Do we need to do something similar in
313 # other cases, such as when we have recently marked a test 322 # other cases, such as when we have recently marked a test
314 # as ignoreFailure but it still shows up in the 'failed' 323 # as ignoreFailure but it still shows up in the 'failed'
315 # category? Maybe we should not rely on the result_type 324 # category? Maybe we should not rely on the result_type
316 # categories recorded within the gm_actuals AT ALL, and 325 # categories recorded within the gm_actuals AT ALL, and
317 # instead evaluate the result_type ourselves based on what 326 # instead evaluate the result_type ourselves based on what
318 # we see in expectations vs actual checksum? 327 # we see in expectations vs actual checksum?
319 # See related http://skbug.com/2514 ('rebaseline_server: apply
320 # ignored-tests.txt within rebaseline_server, not just on the bots')
321 if expected_image_relative_url == actual_image_relative_url: 328 if expected_image_relative_url == actual_image_relative_url:
322 updated_result_type = results.KEY__RESULT_TYPE__SUCCEEDED 329 updated_result_type = results.KEY__RESULT_TYPE__SUCCEEDED
330 elif ((result_type == results.KEY__RESULT_TYPE__FAILED) and
331 (test in self._ignore_failures_on_these_tests)):
332 updated_result_type = results.KEY__RESULT_TYPE__FAILUREIGNORED
323 else: 333 else:
324 updated_result_type = result_type 334 updated_result_type = result_type
325 extra_columns_dict = { 335 extra_columns_dict = {
326 results.KEY__EXTRACOLUMNS__RESULT_TYPE: updated_result_type, 336 results.KEY__EXTRACOLUMNS__RESULT_TYPE: updated_result_type,
327 results.KEY__EXTRACOLUMNS__BUILDER: builder, 337 results.KEY__EXTRACOLUMNS__BUILDER: builder,
328 results.KEY__EXTRACOLUMNS__TEST: test, 338 results.KEY__EXTRACOLUMNS__TEST: test,
329 results.KEY__EXTRACOLUMNS__CONFIG: config, 339 results.KEY__EXTRACOLUMNS__CONFIG: config,
330 } 340 }
331 try: 341 try:
332 image_pair = imagepair.ImagePair( 342 image_pair = imagepair.ImagePair(
(...skipping 22 matching lines...) Expand all
355 parser = argparse.ArgumentParser() 365 parser = argparse.ArgumentParser()
356 parser.add_argument( 366 parser.add_argument(
357 '--actuals', default=results.DEFAULT_ACTUALS_DIR, 367 '--actuals', default=results.DEFAULT_ACTUALS_DIR,
358 help='Directory containing all actual-result JSON files; defaults to ' 368 help='Directory containing all actual-result JSON files; defaults to '
359 '\'%(default)s\' .') 369 '\'%(default)s\' .')
360 parser.add_argument( 370 parser.add_argument(
361 '--expectations', default=DEFAULT_EXPECTATIONS_DIR, 371 '--expectations', default=DEFAULT_EXPECTATIONS_DIR,
362 help='Directory containing all expected-result JSON files; defaults to ' 372 help='Directory containing all expected-result JSON files; defaults to '
363 '\'%(default)s\' .') 373 '\'%(default)s\' .')
364 parser.add_argument( 374 parser.add_argument(
375 '--ignore-failures-file', default=DEFAULT_IGNORE_FAILURES_FILE,
376 help='If a file with this name is found within the EXPECTATIONS dir, '
377 'ignore failures for any tests listed in the file; defaults to '
378 '\'%(default)s\' .')
379 parser.add_argument(
365 '--outfile', required=True, 380 '--outfile', required=True,
366 help='File to write result summary into, in JSON format.') 381 help='File to write result summary into, in JSON format.')
367 parser.add_argument( 382 parser.add_argument(
368 '--results', default=results.KEY__HEADER__RESULTS_FAILURES, 383 '--results', default=results.KEY__HEADER__RESULTS_FAILURES,
369 help='Which result types to include. Defaults to \'%(default)s\'; ' 384 help='Which result types to include. Defaults to \'%(default)s\'; '
370 'must be one of ' + 385 'must be one of ' +
371 str([results.KEY__HEADER__RESULTS_FAILURES, 386 str([results.KEY__HEADER__RESULTS_FAILURES,
372 results.KEY__HEADER__RESULTS_ALL])) 387 results.KEY__HEADER__RESULTS_ALL]))
373 parser.add_argument( 388 parser.add_argument(
374 '--workdir', default=results.DEFAULT_GENERATED_IMAGES_ROOT, 389 '--workdir', default=results.DEFAULT_GENERATED_IMAGES_ROOT,
375 help='Directory within which to download images and generate diffs; ' 390 help='Directory within which to download images and generate diffs; '
376 'defaults to \'%(default)s\' .') 391 'defaults to \'%(default)s\' .')
377 args = parser.parse_args() 392 args = parser.parse_args()
378 results_obj = ExpectationComparisons(actuals_root=args.actuals, 393 results_obj = ExpectationComparisons(
379 expected_root=args.expectations, 394 actuals_root=args.actuals,
380 generated_images_root=args.workdir) 395 expected_root=args.expectations,
396 ignore_failures_file=args.ignore_failures_file,
397 generated_images_root=args.workdir)
381 gm_json.WriteToFile( 398 gm_json.WriteToFile(
382 results_obj.get_packaged_results_of_type(results_type=args.results), 399 results_obj.get_packaged_results_of_type(results_type=args.results),
383 args.outfile) 400 args.outfile)
384 401
385 402
386 if __name__ == '__main__': 403 if __name__ == '__main__':
387 main() 404 main()
OLDNEW
« no previous file with comments | « no previous file | gm/rebaseline_server/results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698