Remove linux_chromium_gn_dbg from the chromium CQ.
[chromium-blink-merge.git] / testing / scripts / telemetry_unittests.py
blob5e41d4018d91c44e931e1bef0a78b282025bd79f
1 #!/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.
6 import json
7 import os
8 import sys
11 import common
14 def main_run(args):
15 filter_tests = []
16 if args.filter_file:
17 filter_tests = json.load(args.filter_file)
19 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()]
25 with common.temporary_file() as tempfile_path:
26 test_args += ['--write-full-results-to', tempfile_path]
27 rc = common.run_runtest(args, [
28 '--test-type', 'telemetry_unittests',
29 '--run-python-script',
30 os.path.join(common.SRC_DIR, 'tools', 'telemetry', 'run_tests'),
31 ] + test_args + filter_tests)
33 with open(tempfile_path) as f:
34 results = json.load(f)
36 parsed_results = common.parse_common_test_results(results, test_separator='.')
37 failures = parsed_results['unexpected_failures']
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)
45 return rc
48 def main_compile_targets(args):
49 if 'android' == args.properties.get('target_platform'):
50 json.dump(['chrome_public_apk'], args.output)
51 else:
52 json.dump(['chrome'], args.output)
55 if __name__ == '__main__':
56 funcs = {
57 'run': main_run,
58 'compile_targets': main_compile_targets,
60 sys.exit(common.run_script(sys.argv[1:], funcs))