ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / testing / scripts / gtest_perf_test.py
blob5518cb1cb2a3ca6fcf25be5aa082ae930979e9ab
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 perf_id = args.properties.get('perf-id')
20 script_args = args.args
21 test_suite = script_args[0]
23 with common.temporary_file() as tempfile_path:
24 gtest_args = [
25 '--target', args.build_config_fs,
26 '--annotate', 'graphing',
27 '--perf-id', perf_id,
28 '--perf-dashboard-id', test_suite,
29 '--results-url', args.properties.get('results-url'),
30 '--slave-name', args.properties.get('slavename'),
31 '--builder-name', args.properties.get('buildername'),
32 '--build-number', str(args.properties.get('buildnumber')),
33 '--log-processor-output-file', tempfile_path,
36 if 'android' == args.properties.get('target_platform'):
37 gtest_args.extend([
38 '--no-xvfb',
39 '--run-python-script', os.path.join(
40 args.paths['checkout'], 'build', 'android', 'test_runner.py'),
41 'gtest', '--release',
42 '--suite', test_suite,
43 '--verbose',
45 else:
46 gtest_args.extend(['--xvfb', '--test-type', test_suite])
47 gtest_args.extend(script_args)
49 rc = common.run_runtest(args, gtest_args + filter_tests)
51 with open(tempfile_path) as f:
52 results = json.load(f)
54 json.dump({
55 'valid': bool(rc == 0),
56 'failures': results['failed'],
57 }, args.output)
59 return rc
62 def main_compile_targets(args):
63 if 'android' == args.properties.get('target_platform'):
64 json.dump(['${name}_apk'], args.output)
65 else:
66 json.dump(['$name'], args.output)
69 if __name__ == '__main__':
70 funcs = {
71 'run': main_run,
72 'compile_targets': main_compile_targets,
74 sys.exit(common.run_script(sys.argv[1:], funcs))