Fix DependencyManager bug.
[chromium-blink-merge.git] / testing / scripts / gtest_perf_test.py
blobaf4380f65710658bc5c8a02a3ddc46b7f85cb063
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 IsWindows():
15 return sys.platform == 'cygwin' or sys.platform.startswith('win')
18 def main_run(args):
19 filter_tests = []
20 if args.filter_file:
21 filter_tests = json.load(args.filter_file)
23 perf_id = args.properties.get('perf-id')
24 script_args = args.args
25 test_suite = script_args[0]
26 if IsWindows():
27 script_args[0] += '.exe'
29 with common.temporary_file() as tempfile_path:
30 gtest_args = [
31 '--target', args.build_config_fs,
32 '--annotate', 'graphing',
33 '--perf-id', perf_id,
34 '--perf-dashboard-id', test_suite,
35 '--results-url', args.properties.get('results-url'),
36 '--slave-name', args.properties.get('slavename'),
37 '--builder-name', args.properties.get('buildername'),
38 '--build-number', str(args.properties.get('buildnumber')),
39 '--log-processor-output-file', tempfile_path,
40 '--test-type', test_suite,
43 if 'android' == args.properties.get('target_platform'):
44 gtest_args.extend([
45 '--no-xvfb',
46 '--run-python-script', os.path.join(
47 args.paths['checkout'], 'build', 'android', 'test_runner.py'),
48 'gtest', '--release',
49 '--suite', test_suite,
50 '--verbose',
52 else:
53 gtest_args.extend(['--xvfb'])
54 gtest_args.extend(script_args)
56 rc = common.run_runtest(args, gtest_args + filter_tests)
58 with open(tempfile_path) as f:
59 results = json.load(f)
61 json.dump({
62 'valid': bool(rc == 0),
63 'failures': results['failed'],
64 }, args.output)
66 return rc
69 def main_compile_targets(args):
70 if 'android' == args.properties.get('target_platform'):
71 json.dump(['${name}_apk'], args.output)
72 else:
73 json.dump(['$name'], args.output)
76 if __name__ == '__main__':
77 funcs = {
78 'run': main_run,
79 'compile_targets': main_compile_targets,
81 sys.exit(common.run_script(sys.argv[1:], funcs))