| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 import json | 6 import json |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 | 10 |
| 11 import common | 11 import common |
| 12 | 12 |
| 13 | 13 |
| 14 def main_run(args): | 14 def main_run(args): |
| 15 filter_tests = [] | 15 filter_tests = [] |
| 16 if args.filter_file: | 16 if args.filter_file: |
| 17 filter_tests = json.load(args.filter_file) | 17 filter_tests = json.load(args.filter_file) |
| 18 | 18 |
| 19 test_args = ['--retry-limit', '3'] |
| 20 if 'android' == args.properties.get('target_platform'): |
| 21 test_args += ['--browser', 'android-chrome-shell', '--device', 'android'] |
| 22 else: |
| 23 test_args += ['--browser', args.build_config_fs.lower()] |
| 24 |
| 19 with common.temporary_file() as tempfile_path: | 25 with common.temporary_file() as tempfile_path: |
| 26 test_args += ['--write-full-results-to', tempfile_path] |
| 20 rc = common.run_runtest(args, [ | 27 rc = common.run_runtest(args, [ |
| 21 '--annotate', 'gtest', | 28 '--annotate', 'gtest', |
| 22 '--test-type', 'telemetry_perf_unittests', | 29 '--test-type', 'telemetry_perf_unittests', |
| 23 '--run-python-script', | 30 '--run-python-script', |
| 24 os.path.join(common.SRC_DIR, 'tools', 'perf', 'run_tests'), | 31 os.path.join(common.SRC_DIR, 'tools', 'perf', 'run_tests') |
| 25 '--browser', args.build_config_fs.lower(), | 32 ] + test_args + filter_tests) |
| 26 '--retry-limit', '3', | |
| 27 '--write-full-results-to', tempfile_path, | |
| 28 ] + filter_tests) | |
| 29 | 33 |
| 30 with open(tempfile_path) as f: | 34 with open(tempfile_path) as f: |
| 31 results = json.load(f) | 35 results = json.load(f) |
| 32 | 36 |
| 33 parsed_results = common.parse_common_test_results(results, test_separator='.') | 37 parsed_results = common.parse_common_test_results(results, test_separator='.') |
| 34 failures = parsed_results['unexpected_failures'] | 38 failures = parsed_results['unexpected_failures'] |
| 35 | 39 |
| 36 json.dump({ | 40 json.dump({ |
| 37 'valid': bool(rc <= common.MAX_FAILURES_EXIT_STATUS and | 41 'valid': bool(rc <= common.MAX_FAILURES_EXIT_STATUS and |
| 38 ((rc == 0) or failures)), | 42 ((rc == 0) or failures)), |
| 39 'failures': failures.keys(), | 43 'failures': failures.keys(), |
| 40 }, args.output) | 44 }, args.output) |
| 41 | 45 |
| 42 return rc | 46 return rc |
| 43 | 47 |
| 44 | 48 |
| 45 def main_compile_targets(args): | 49 def main_compile_targets(args): |
| 46 json.dump(['chrome'], args.output) | 50 if 'android' == args.properties.get('target_platform'): |
| 51 json.dump(['chrome_shell_apk'], args.output) |
| 52 else: |
| 53 json.dump(['chrome'], args.output) |
| 47 | 54 |
| 48 | 55 |
| 49 if __name__ == '__main__': | 56 if __name__ == '__main__': |
| 50 funcs = { | 57 funcs = { |
| 51 'run': main_run, | 58 'run': main_run, |
| 52 'compile_targets': main_compile_targets, | 59 'compile_targets': main_compile_targets, |
| 53 } | 60 } |
| 54 sys.exit(common.run_script(sys.argv[1:], funcs)) | 61 sys.exit(common.run_script(sys.argv[1:], funcs)) |
| OLD | NEW |