Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #! /usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2017 The Chromium Authors. All rights reserved. | 3 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import argparse | 7 import argparse |
| 8 import collections | 8 import collections |
| 9 import json | 9 import json |
| 10 import tempfile | 10 import tempfile |
| 11 import os | 11 import os |
| 12 import sys | 12 import sys |
| 13 import urllib | 13 import urllib |
| 14 | 14 |
| 15 | |
| 15 CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) | 16 CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 16 BASE_DIR = os.path.abspath(os.path.join( | 17 BASE_DIR = os.path.abspath(os.path.join( |
| 17 CURRENT_DIR, '..', '..', '..', '..', '..')) | 18 CURRENT_DIR, '..', '..', '..', '..', '..')) |
| 18 | 19 |
| 19 sys.path.append(os.path.join(BASE_DIR, 'build', 'android')) | 20 sys.path.append(os.path.join(BASE_DIR, 'build', 'android')) |
| 21 from pylib.results.presentation import standard_gtest_merge | |
| 20 from pylib.utils import google_storage_helper # pylint: disable=import-error | 22 from pylib.utils import google_storage_helper # pylint: disable=import-error |
| 21 | 23 |
| 22 sys.path.append(os.path.join(BASE_DIR, 'third_party')) | 24 sys.path.append(os.path.join(BASE_DIR, 'third_party')) |
| 23 import jinja2 # pylint: disable=import-error | 25 import jinja2 # pylint: disable=import-error |
| 24 JINJA_ENVIRONMENT = jinja2.Environment( | 26 JINJA_ENVIRONMENT = jinja2.Environment( |
| 25 loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), | 27 loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), |
| 26 autoescape=True) | 28 autoescape=True) |
| 27 | 29 |
| 28 | 30 |
| 29 def cell(data, html_class='center'): | 31 def cell(data, html_class='center'): |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 if ((not 'buildnumber' in build_properties) or | 395 if ((not 'buildnumber' in build_properties) or |
| 394 (not 'buildername' in build_properties)): | 396 (not 'buildername' in build_properties)): |
| 395 raise parser.error('Build number/builder name not specified.') | 397 raise parser.error('Build number/builder name not specified.') |
| 396 build_number = build_properties['buildnumber'] | 398 build_number = build_properties['buildnumber'] |
| 397 builder_name = build_properties['buildername'] | 399 builder_name = build_properties['buildername'] |
| 398 elif args.build_number and args.builder_name: | 400 elif args.build_number and args.builder_name: |
| 399 build_number = args.build_number | 401 build_number = args.build_number |
| 400 builder_name = args.builder_name | 402 builder_name = args.builder_name |
| 401 | 403 |
| 402 if args.positional: | 404 if args.positional: |
| 403 if not len(args.positional) == 1: | 405 if len(args.positional) == 1: |
| 404 raise parser.error('More than 1 json file specified.') | 406 json_file = args.positional[0] |
| 405 json_file = args.positional[0] | 407 else: |
| 408 if args.output_json and args.summary_json: | |
| 409 standard_gtest_merge.standard_gtest_merge( | |
| 410 args.output_json, args.summary_json, args.positional) | |
| 411 json_file = args.output_json | |
| 412 else: | |
|
jbudorick
2017/06/21 22:12:51
nit:
if args.output_json and args.summary_json:
BigBossZhiling
2017/06/21 22:42:54
Done.
| |
| 413 if not args.output_json: | |
| 414 raise Exception('output_json required by merge API is missing.') | |
| 415 else: | |
| 416 raise Exception('summary_json required by merge API is missing.') | |
| 406 elif args.json_file: | 417 elif args.json_file: |
| 407 json_file = args.json_file | 418 json_file = args.json_file |
| 408 | 419 |
| 409 if not os.path.exists(json_file): | 420 if not os.path.exists(json_file): |
| 410 raise IOError('--json-file %s not found.' % json_file) | 421 raise IOError('--json-file %s not found.' % json_file) |
| 411 | 422 |
| 412 # Link to result details presentation page is a part of the page. | 423 # Link to result details presentation page is a part of the page. |
| 413 result_html_string, dest, result_details_link = result_details( | 424 result_html_string, dest, result_details_link = result_details( |
| 414 json_file, args.cs_base_url, args.bucket, | 425 json_file, args.cs_base_url, args.bucket, |
| 415 args.test_name, builder_name, build_number) | 426 args.test_name, builder_name, build_number) |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 426 with open(json_file) as original_json_file: | 437 with open(json_file) as original_json_file: |
| 427 json_object = json.load(original_json_file) | 438 json_object = json.load(original_json_file) |
| 428 json_object['links'] = {'result_details': result_details_link} | 439 json_object['links'] = {'result_details': result_details_link} |
| 429 with open(args.output_json, 'w') as f: | 440 with open(args.output_json, 'w') as f: |
| 430 json.dump(json_object, f) | 441 json.dump(json_object, f) |
| 431 else: | 442 else: |
| 432 print result_details_link | 443 print result_details_link |
| 433 | 444 |
| 434 if __name__ == '__main__': | 445 if __name__ == '__main__': |
| 435 sys.exit(main()) | 446 sys.exit(main()) |
| OLD | NEW |