blob: 09e3cb6270eb20a9663cc33adfbedde889fa3e63 [file] [log] [blame]
Paweł Hajdan, Jr643409b2014-10-23 08:34:061#!/usr/bin/env python
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
4# found in the LICENSE file.
5
6import json
7import os
8import sys
9
10
11import common
12
13
14def main_run(args):
15 filter_tests = []
16 if args.filter_file:
17 filter_tests = json.load(args.filter_file)
18
jbudorick2f8b398b2015-08-14 17:50:5219 test_args = ['--retry-limit', '3']
20 if 'android' == args.properties.get('target_platform'):
21 test_args += ['--browser', 'android-chromium', '--device', 'android']
22 else:
23 test_args += ['--browser', args.build_config_fs.lower()]
nednguyend897d04b2015-10-23 13:55:5224 test_args += ['--chrome-root', common.SRC_DIR]
Paweł Hajdan, Jr643409b2014-10-23 08:34:0625 with common.temporary_file() as tempfile_path:
jbudorick2f8b398b2015-08-14 17:50:5226 test_args += ['--write-full-results-to', tempfile_path]
Paweł Hajdan, Jr5647b452014-10-29 13:08:3027 rc = common.run_runtest(args, [
Paweł Hajdan, Jr643409b2014-10-23 08:34:0628 '--test-type', 'telemetry_unittests',
Paweł Hajdan, Jr643409b2014-10-23 08:34:0629 '--run-python-script',
30 os.path.join(common.SRC_DIR, 'tools', 'telemetry', 'run_tests'),
jbudorick2f8b398b2015-08-14 17:50:5231 ] + test_args + filter_tests)
Paweł Hajdan, Jr643409b2014-10-23 08:34:0632
33 with open(tempfile_path) as f:
34 results = json.load(f)
35
Paweł Hajdan, Jr03ee6e032014-10-27 12:51:0836 parsed_results = common.parse_common_test_results(results, test_separator='.')
Paweł Hajdan, Jr643409b2014-10-23 08:34:0637 failures = parsed_results['unexpected_failures']
38
39 json.dump({
40 'valid': bool(rc <= common.MAX_FAILURES_EXIT_STATUS and
41 ((rc == 0) or failures)),
42 'failures': failures.keys(),
43 }, args.output)
44
45 return rc
46
47
48def main_compile_targets(args):
jbudorick3943b3b2015-08-14 22:22:1849 if 'android' == args.properties.get('target_platform'):
50 json.dump(['chrome_public_apk'], args.output)
51 else:
52 json.dump(['chrome'], args.output)
Paweł Hajdan, Jr643409b2014-10-23 08:34:0653
54
55if __name__ == '__main__':
56 funcs = {
57 'run': main_run,
58 'compile_targets': main_compile_targets,
59 }
60 sys.exit(common.run_script(sys.argv[1:], funcs))