Permission message rules: Each rule must have >= 1 required permissions
[chromium-blink-merge.git] / testing / scripts / android_gtest_test.py
blob998a354135e806d1705b3d524cf343a98c081728
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,
33 if filter_tests:
34 cmd.extend(['--gtest-filter', ':'.join(filter_tests)])
36 rc = common.run_command(cmd)
38 with open(tempfile_path) as f:
39 results = json.load(f)
41 parsed_results = common.parse_gtest_test_results(results)
43 json.dump({
44 'valid': True,
45 'failures': parsed_results['failures'],
46 }, args.output)
48 return rc
51 def main_compile_targets(args):
52 json.dump(['${name}_apk'], 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))