| OLD | NEW |
| 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 Loading... |
| 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) |
| OLD | NEW |