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

Side by Side Diff: tools/rebaseline.py

Issue 19415002: rebaseline.py: fix --add-new for JSON files (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 ''' 3 '''
4 Copyright 2012 Google Inc. 4 Copyright 2012 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 9
10 ''' 10 '''
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 sections = [gm_json.JSONKEY_ACTUALRESULTS_FAILED] 219 sections = [gm_json.JSONKEY_ACTUALRESULTS_FAILED]
220 if self._add_new: 220 if self._add_new:
221 sections.append(gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON) 221 sections.append(gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON)
222 results_to_update = self._GetActualResults(json_url=actuals_url, 222 results_to_update = self._GetActualResults(json_url=actuals_url,
223 sections=sections) 223 sections=sections)
224 224
225 # Read in current expectations. 225 # Read in current expectations.
226 expectations_json_filepath = os.path.join( 226 expectations_json_filepath = os.path.join(
227 self._expectations_root, subdir, self._expectations_filename) 227 self._expectations_root, subdir, self._expectations_filename)
228 expectations_dict = gm_json.LoadFromFile(expectations_json_filepath) 228 expectations_dict = gm_json.LoadFromFile(expectations_json_filepath)
229 expected_results = expectations_dict[gm_json.JSONKEY_EXPECTEDRESULTS]
229 230
230 # Update the expectations in memory, skipping any tests/configs that 231 # Update the expectations in memory, skipping any tests/configs that
231 # the caller asked to exclude. 232 # the caller asked to exclude.
232 skipped_images = [] 233 skipped_images = []
233 if results_to_update: 234 if results_to_update:
234 for (image_name, image_results) in results_to_update.iteritems(): 235 for (image_name, image_results) in results_to_update.iteritems():
235 (test, config) = \ 236 (test, config) = \
236 self._image_filename_re.match(image_name).groups() 237 self._image_filename_re.match(image_name).groups()
237 if self._tests: 238 if self._tests:
238 if test not in self._tests: 239 if test not in self._tests:
239 skipped_images.append(image_name) 240 skipped_images.append(image_name)
240 continue 241 continue
241 if self._configs: 242 if self._configs:
242 if config not in self._configs: 243 if config not in self._configs:
243 skipped_images.append(image_name) 244 skipped_images.append(image_name)
244 continue 245 continue
245 expectations_dict \ 246 if not expected_results.get(image_name):
246 [gm_json.JSONKEY_EXPECTEDRESULTS] \ 247 expected_results[image_name] = {}
247 [image_name] \ 248 expected_results[image_name] \
248 [gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS] = \ 249 [gm_json.JSONKEY_EXPECTEDRESULTS_ALLOWEDDIGESTS] = \
249 [image_results] 250 [image_results]
250 251
251 # Write out updated expectations. 252 # Write out updated expectations.
252 gm_json.WriteToFile(expectations_dict, expectations_json_filepath) 253 gm_json.WriteToFile(expectations_dict, expectations_json_filepath)
253 254
254 255
255 # main... 256 # main...
256 257
257 parser = argparse.ArgumentParser() 258 parser = argparse.ArgumentParser()
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 exception_handler=exception_handler, 357 exception_handler=exception_handler,
357 add_new=args.add_new, 358 add_new=args.add_new,
358 missing_json_is_fatal=missing_json_is_fatal) 359 missing_json_is_fatal=missing_json_is_fatal)
359 360
360 try: 361 try:
361 rebaseliner.RebaselineSubdir(subdir=subdir, builder=builder) 362 rebaseliner.RebaselineSubdir(subdir=subdir, builder=builder)
362 except BaseException as e: 363 except BaseException as e:
363 exception_handler.RaiseExceptionOrContinue(e) 364 exception_handler.RaiseExceptionOrContinue(e)
364 365
365 exception_handler.ReportAllFailures() 366 exception_handler.ReportAllFailures()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698