[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / testing / scripts / android_gtest_test.py
blob6fc6ca86c5521d7d4a83379892b69de3954f956f
1 #!/usr/bin/env python
2 # Copyright 2015 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 script_args = args.args
20 test_suite = script_args[0]
22 with common.temporary_file() as tempfile_path:
23 cmd = [
24 os.path.join(
25 args.paths['checkout'], 'build', 'android', 'test_runner.py'),
26 'gtest',
27 '--release' if 'release' in args.build_config_fs.lower() else '--debug',
28 '--suite', test_suite,
29 '--verbose',
30 '--flakiness-dashboard-server=http://test-results.appspot.com',
31 '--json-results-file', tempfile_path,
32 '--blacklist-file',
33 os.path.join(args.paths['checkout'], 'out', 'bad_devices.json'),
35 if filter_tests:
36 cmd.extend(['--gtest-filter', ':'.join(filter_tests)])
38 rc = common.run_command(cmd)
40 with open(tempfile_path) as f:
41 results = json.load(f)
43 parsed_results = common.parse_gtest_test_results(results)
45 json.dump({
46 'valid': True,
47 'failures': parsed_results['failures'],
48 }, args.output)
50 return rc
53 def main_compile_targets(args):
54 json.dump(['${name}_apk'], args.output)
57 if __name__ == '__main__':
58 funcs = {
59 'run': main_run,
60 'compile_targets': main_compile_targets,
62 sys.exit(common.run_script(sys.argv[1:], funcs))