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

Side by Side Diff: gm/display_json_results.py

Issue 15934018: gm_json.py: add ability to load JSON file from a string, not just a local file (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 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 | gm/gm_json.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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Utility to display a summary of JSON-format GM results, and exit with 6 """Utility to display a summary of JSON-format GM results, and exit with
7 a nonzero errorcode if there were non-ignored failures in the GM results. 7 a nonzero errorcode if there were non-ignored failures in the GM results.
8 8
9 Usage: 9 Usage:
10 python display_json_results.py <filename> 10 python display_json_results.py <filename>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 do_list=True, do_fail=False), 87 do_list=True, do_fail=False),
88 gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON: 88 gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON:
89 ResultAccumulator(name='MissingExpectations', 89 ResultAccumulator(name='MissingExpectations',
90 do_list=False, do_fail=False), 90 do_list=False, do_fail=False),
91 gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED: 91 gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED:
92 ResultAccumulator(name='Passed', 92 ResultAccumulator(name='Passed',
93 do_list=False, do_fail=False), 93 do_list=False, do_fail=False),
94 } 94 }
95 95
96 success = True 96 success = True
97 json_dict = gm_json.Load(filepath) 97 json_dict = gm_json.LoadFromFile(filepath)
98 actual_results = json_dict[gm_json.JSONKEY_ACTUALRESULTS] 98 actual_results = json_dict[gm_json.JSONKEY_ACTUALRESULTS]
99 for label, accumulator in results_map.iteritems(): 99 for label, accumulator in results_map.iteritems():
100 results = actual_results[label] 100 results = actual_results[label]
101 if results: 101 if results:
102 for result in results: 102 for result in results:
103 accumulator.AddResult(result) 103 accumulator.AddResult(result)
104 print accumulator.GetSummaryLine() 104 print accumulator.GetSummaryLine()
105 if accumulator.ShouldSignalFailure(): 105 if accumulator.ShouldSignalFailure():
106 success = False 106 success = False
107 print '(results marked with [*] will cause nonzero return value)' 107 print '(results marked with [*] will cause nonzero return value)'
108 return success 108 return success
109 109
110 110
111 if '__main__' == __name__: 111 if '__main__' == __name__:
112 if len(sys.argv) != 2: 112 if len(sys.argv) != 2:
113 raise Exception('usage: %s <input-json-filepath>' % sys.argv[0]) 113 raise Exception('usage: %s <input-json-filepath>' % sys.argv[0])
114 sys.exit(0 if Display(sys.argv[1]) else 1) 114 sys.exit(0 if Display(sys.argv[1]) else 1)
OLDNEW
« no previous file with comments | « no previous file | gm/gm_json.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698