Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: testing/scripts/run_gtest_perf_test.py

Issue 2442663004: Adding isolate for cc_perftests and triggering job on FYI waterfall (Closed)
Patch Set: Removing arg Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/scripts/common.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Runs an isolate bundled Telemetry GPU integration test. 6 """Runs an isolate non-Telemetry perf test .
Ken Russell (switch to Gerrit) 2016/10/21 18:50:21 Suggest "isolate bundled" or "isolated".
eyaich1 2016/10/24 13:28:55 Done.
7 7
8 This script attempts to emulate the contract of gtest-style tests 8 The main contract is that the caller passes the arguments:
9 invoked via recipes. The main contract is that the caller passes the
10 argument:
11 9
12 --isolated-script-test-output=[FILENAME] 10 --isolated-script-test-output=[FILENAME]
13
14 json is written to that file in the format produced by 11 json is written to that file in the format produced by
15 common.parse_common_test_results. 12 common.parse_common_test_results.
16 13
14 --isolated-script-test-chartjson-output=[FILE]
15 stdout is written to this file containing chart results for the perf dashboard
16
17 This script is intended to be the base command invoked by the isolate, 17 This script is intended to be the base command invoked by the isolate,
18 followed by a subsequent Python script. It could be generalized to 18 followed by a subsequent non-python executable. It is modeled after
19 invoke an arbitrary executable. 19 run_gpu_integration_test_as_gtest.py
20 """ 20 """
21 21
22 import argparse 22 import argparse
23 import json 23 import json
24 import os 24 import os
25 import shutil 25 import shutil
26 import sys 26 import sys
27 import tempfile 27 import tempfile
28 import traceback 28 import traceback
29 29
30 import common 30 import common
31 31
32 # Add src/testing/ into sys.path for importing xvfb. 32 # Add src/testing/ into sys.path for importing xvfb.
33 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) 33 sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
34 import xvfb 34 import xvfb
35 35
36 # Unfortunately we need to copy these variables from ../test_env.py. 36 # Unfortunately we need to copy these variables from ../test_env.py.
37 # Importing it and using its get_sandbox_env breaks test runs on Linux 37 # Importing it and using its get_sandbox_env breaks test runs on Linux
38 # (it seems to unset DISPLAY). 38 # (it seems to unset DISPLAY).
39 CHROME_SANDBOX_ENV = 'CHROME_DEVEL_SANDBOX' 39 CHROME_SANDBOX_ENV = 'CHROME_DEVEL_SANDBOX'
40 CHROME_SANDBOX_PATH = '/opt/chromium/chrome_sandbox' 40 CHROME_SANDBOX_PATH = '/opt/chromium/chrome_sandbox'
41 41
42
43 def IsWindows():
44 return sys.platform == 'cygwin' or sys.platform.startswith('win')
45
46
42 def main(): 47 def main():
43 parser = argparse.ArgumentParser() 48 parser = argparse.ArgumentParser()
44 parser.add_argument( 49 parser.add_argument(
45 '--isolated-script-test-output', type=str, 50 '--isolated-script-test-output', type=str,
46 required=True) 51 required=True)
52 parser.add_argument(
53 '--isolated-script-test-chartjson-output', type=str,
54 required=True)
47 parser.add_argument('--xvfb', help='Start xvfb.', action='store_true') 55 parser.add_argument('--xvfb', help='Start xvfb.', action='store_true')
56
48 args, rest_args = parser.parse_known_args() 57 args, rest_args = parser.parse_known_args()
49 # Remove the chartjson extra arg until this script cares about chartjson
50 # results from telemetry
51 index = 0
52 for arg in rest_args:
53 if '--isolated-script-test-chartjson-output' in arg:
54 rest_args.pop(index)
55 break
56 index += 1
57 58
58 xvfb_proc = None 59 xvfb_proc = None
59 openbox_proc = None 60 openbox_proc = None
60 xcompmgr_proc = None 61 xcompmgr_proc = None
61 env = os.environ.copy() 62 env = os.environ.copy()
62 # Assume we want to set up the sandbox environment variables all the 63 # Assume we want to set up the sandbox environment variables all the
63 # time; doing so is harmless on non-Linux platforms and is needed 64 # time; doing so is harmless on non-Linux platforms and is needed
64 # all the time on Linux. 65 # all the time on Linux.
65 env[CHROME_SANDBOX_ENV] = CHROME_SANDBOX_PATH 66 env[CHROME_SANDBOX_ENV] = CHROME_SANDBOX_PATH
66 if args.xvfb and xvfb.should_start_xvfb(env): 67 if args.xvfb and xvfb.should_start_xvfb(env):
67 xvfb_proc, openbox_proc, xcompmgr_proc = xvfb.start_xvfb(env=env, 68 xvfb_proc, openbox_proc, xcompmgr_proc = xvfb.start_xvfb(env=env,
68 build_dir='.') 69 build_dir='.')
69 assert xvfb_proc and openbox_proc and xcompmgr_proc, 'Failed to start xvfb' 70 assert xvfb_proc and openbox_proc and xcompmgr_proc, 'Failed to start xvfb'
70 # Compatibility with gtest-based sharding. 71
71 total_shards = None
72 shard_index = None
73 if 'GTEST_TOTAL_SHARDS' in env:
74 total_shards = int(env['GTEST_TOTAL_SHARDS'])
75 del env['GTEST_TOTAL_SHARDS']
76 if 'GTEST_SHARD_INDEX' in env:
77 shard_index = int(env['GTEST_SHARD_INDEX'])
78 del env['GTEST_SHARD_INDEX']
79 sharding_args = []
80 if total_shards is not None and shard_index is not None:
81 sharding_args = [
82 '--total-shards=%d' % total_shards,
83 '--shard-index=%d' % shard_index
84 ]
85 try: 72 try:
86 valid = True 73 valid = True
87 rc = 0 74 rc = 0
88 try: 75 try:
89 rc = common.run_command([sys.executable] + rest_args + sharding_args + [ 76 executable = rest_args[0]
77 if IsWindows():
78 executable = '.\%s.exe' % executable
79 else:
80 executable = './%s' % executable
81 rc = common.run_command_with_output([executable] + [
90 '--write-abbreviated-json-results-to', args.isolated_script_test_output, 82 '--write-abbreviated-json-results-to', args.isolated_script_test_output,
91 ], env=env) 83 ], env=env, stdoutfile=args.isolated_script_test_chartjson_output)
92 except Exception: 84 except Exception:
93 traceback.print_exc() 85 traceback.print_exc()
94 valid = False 86 valid = False
95 87
96 if not valid: 88 if not valid:
97 failures = ['(entire test suite)'] 89 failures = ['(entire test suite)']
98 with open(args.isolated_script_test_output, 'w') as fp: 90 with open(args.isolated_script_test_output, 'w') as fp:
99 json.dump({ 91 json.dump({
100 'valid': valid, 92 'valid': valid,
101 'failures': failures, 93 'failures': failures,
(...skipping 15 matching lines...) Expand all
117 109
118 if __name__ == '__main__': 110 if __name__ == '__main__':
119 # Conform minimally to the protocol defined by ScriptTest. 111 # Conform minimally to the protocol defined by ScriptTest.
120 if 'compile_targets' in sys.argv: 112 if 'compile_targets' in sys.argv:
121 funcs = { 113 funcs = {
122 'run': None, 114 'run': None,
123 'compile_targets': main_compile_targets, 115 'compile_targets': main_compile_targets,
124 } 116 }
125 sys.exit(common.run_script(sys.argv[1:], funcs)) 117 sys.exit(common.run_script(sys.argv[1:], funcs))
126 sys.exit(main()) 118 sys.exit(main())
OLDNEW
« no previous file with comments | « testing/scripts/common.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698