OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2015 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 """See README.md for usage instructions. | 6 """See README.md for usage instructions. |
7 | 7 |
8 This file heavily modified from build/scripts/slave/gtest_slave_utils.py and | 8 This file heavily modified from build/scripts/slave/gtest_slave_utils.py and |
9 is intended to replace it as all tests move to swarming. | 9 is intended to replace it as all tests move to swarming. |
10 TODO(estaab): Remove build/scripts/slave/gtest.* once this is fully deployed. | 10 TODO(estaab): Remove build/scripts/slave/gtest.* once this is fully deployed. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 return 1 | 128 return 1 |
129 | 129 |
130 if options.test_results_server and not options.master_name: | 130 if options.test_results_server and not options.master_name: |
131 logging.warn('--test-results-server is given but ' | 131 logging.warn('--test-results-server is given but ' |
132 '--master-name is not specified; the results won\'t be ' | 132 '--master-name is not specified; the results won\'t be ' |
133 'uploaded to the server.') | 133 'uploaded to the server.') |
134 | 134 |
135 with file(options.input_json) as json_file: | 135 with file(options.input_json) as json_file: |
136 results_json = json_file.read() | 136 results_json = json_file.read() |
137 | 137 |
138 files = generate_json_results_file( | 138 content = json.loads(results_json) |
139 results_json, builder_name=options.builder_name, | 139 if content.get('version') == 3: |
estaab
2016/11/07 00:13:21
maybe >=3? This seems brittle since later versions
nednguyen
2016/11/07 14:26:24
Done.
| |
140 build_number=options.build_number, | 140 print 'Input JSON file probably has full json results format' |
141 results_directory=options.results_directory, | 141 files = [(os.path.basename(options.input_json), options.input_json)] |
142 chrome_revision=options.chrome_revision, | 142 else: |
143 master_name=options.master_name) | 143 print ('Input JSON file probably has gtest format. Converting to full json' |
144 ' results format') | |
145 files = generate_json_results_file( | |
146 results_json, builder_name=options.builder_name, | |
147 build_number=options.build_number, | |
148 results_directory=options.results_directory, | |
149 chrome_revision=options.chrome_revision, | |
150 master_name=options.master_name) | |
144 | 151 |
145 # Upload to a test results server if specified. | 152 # Upload to a test results server if specified. |
146 if options.test_results_server and options.master_name: | 153 if options.test_results_server and options.master_name: |
147 print 'Uploading JSON files for builder "%s" to server "%s"' % ( | 154 print 'Uploading JSON files for builder "%s" to server "%s"' % ( |
148 options.builder_name, options.test_results_server) | 155 options.builder_name, options.test_results_server) |
149 attrs = [('builder', options.builder_name), | 156 attrs = [('builder', options.builder_name), |
150 ('testtype', options.test_type), | 157 ('testtype', options.test_type), |
151 ('master', options.master_name)] | 158 ('master', options.master_name)] |
152 | 159 |
153 # Set uploading timeout in case appengine server is having problem. | 160 # Set uploading timeout in case appengine server is having problem. |
154 # 120 seconds are more than enough to upload test results. | 161 # 120 seconds are more than enough to upload test results. |
155 test_results_uploader.upload_test_results( | 162 test_results_uploader.upload_test_results( |
156 options.test_results_server, attrs, files, 120) | 163 options.test_results_server, attrs, files, 120) |
157 return 0 | 164 return 0 |
158 | 165 |
159 | 166 |
160 if __name__ == '__main__': | 167 if __name__ == '__main__': |
161 sys.exit(main(sys.argv[1:])) | 168 sys.exit(main(sys.argv[1:])) |
OLD | NEW |