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

Side by Side Diff: build/android/pylib/results/presentation/test_results_presentation.py

Issue 2947603002: Merge test results presentation of multiple shards. (Closed)
Patch Set: Created 3 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
OLDNEW
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 from merge_test import merge_test
jbudorick 2017/06/19 13:33:42 We generally import modules, not the contents ther
BigBossZhiling 2017/06/19 18:24:06 Done.
16
15 CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) 17 CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
16 BASE_DIR = os.path.abspath(os.path.join( 18 BASE_DIR = os.path.abspath(os.path.join(
17 CURRENT_DIR, '..', '..', '..', '..', '..')) 19 CURRENT_DIR, '..', '..', '..', '..', '..'))
18 20
19 sys.path.append(os.path.join(BASE_DIR, 'build', 'android')) 21 sys.path.append(os.path.join(BASE_DIR, 'build', 'android'))
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(
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 not len(args.positional) == 1:
404 raise parser.error('More than 1 json file specified.') 406 if args.output_json and args.summary_json:
405 json_file = args.positional[0] 407 merge_test(args.output_json, args.summary_json, args.positional)
408 json_file = args.output_json
409 else:
410 raise Exception('Not complying with merge API.')
jbudorick 2017/06/19 13:33:42 nit: this should say *why* the arguments aren't co
411 else:
412 json_file = args.positional[0]
406 elif args.json_file: 413 elif args.json_file:
407 json_file = args.json_file 414 json_file = args.json_file
408 415
409 if not os.path.exists(json_file): 416 if not os.path.exists(json_file):
410 raise IOError('--json-file %s not found.' % json_file) 417 raise IOError('--json-file %s not found.' % json_file)
411 418
412 # Link to result details presentation page is a part of the page. 419 # Link to result details presentation page is a part of the page.
413 result_html_string, dest, result_details_link = result_details( 420 result_html_string, dest, result_details_link = result_details(
414 json_file, args.cs_base_url, args.bucket, 421 json_file, args.cs_base_url, args.bucket,
415 args.test_name, builder_name, build_number) 422 args.test_name, builder_name, build_number)
(...skipping 10 matching lines...) Expand all
426 with open(json_file) as original_json_file: 433 with open(json_file) as original_json_file:
427 json_object = json.load(original_json_file) 434 json_object = json.load(original_json_file)
428 json_object['links'] = {'result_details': result_details_link} 435 json_object['links'] = {'result_details': result_details_link}
429 with open(args.output_json, 'w') as f: 436 with open(args.output_json, 'w') as f:
430 json.dump(json_object, f) 437 json.dump(json_object, f)
431 else: 438 else:
432 print result_details_link 439 print result_details_link
433 440
434 if __name__ == '__main__': 441 if __name__ == '__main__':
435 sys.exit(main()) 442 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698