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

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

Issue 2008833002: allow usage of transparent visuals when using xvfb (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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/run_telemetry_as_googletest.py ('k') | testing/xvfb.py » ('j') | 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 benchmark. 6 """Runs an isolate bundled Telemetry benchmark.
7 7
8 This script attempts to emulate the contract of gtest-style tests 8 This script attempts to emulate the contract of gtest-style tests
9 invoked via recipes. The main contract is that the caller passes the 9 invoked via recipes. The main contract is that the caller passes the
10 argument: 10 argument:
(...skipping 30 matching lines...) Expand all
41 41
42 def main(): 42 def main():
43 parser = argparse.ArgumentParser() 43 parser = argparse.ArgumentParser()
44 parser.add_argument( 44 parser.add_argument(
45 '--isolated-script-test-output', type=argparse.FileType('w'), 45 '--isolated-script-test-output', type=argparse.FileType('w'),
46 required=True) 46 required=True)
47 parser.add_argument('--xvfb', help='Start xvfb.', action='store_true') 47 parser.add_argument('--xvfb', help='Start xvfb.', action='store_true')
48 args, rest_args = parser.parse_known_args() 48 args, rest_args = parser.parse_known_args()
49 xvfb_proc = None 49 xvfb_proc = None
50 openbox_proc = None 50 openbox_proc = None
51 xcompmgr_proc = None
51 env = os.environ.copy() 52 env = os.environ.copy()
52 # Assume we want to set up the sandbox environment variables all the 53 # Assume we want to set up the sandbox environment variables all the
53 # time; doing so is harmless on non-Linux platforms and is needed 54 # time; doing so is harmless on non-Linux platforms and is needed
54 # all the time on Linux. 55 # all the time on Linux.
55 env[CHROME_SANDBOX_ENV] = CHROME_SANDBOX_PATH 56 env[CHROME_SANDBOX_ENV] = CHROME_SANDBOX_PATH
56 if args.xvfb and xvfb.should_start_xvfb(env): 57 if args.xvfb and xvfb.should_start_xvfb(env):
57 xvfb_proc, openbox_proc = xvfb.start_xvfb(env=env, build_dir='.') 58 xvfb_proc, openbox_proc, xcompmgr_proc = xvfb.start_xvfb(env=env,
58 assert xvfb_proc and openbox_proc, 'Failed to start xvfb' 59 build_dir='.')
60 assert xvfb_proc and openbox_proc and xcompmgr_proc, 'Failed to start xvfb'
59 try: 61 try:
60 tempfile_dir = tempfile.mkdtemp('telemetry') 62 tempfile_dir = tempfile.mkdtemp('telemetry')
61 valid = True 63 valid = True
62 failures = [] 64 failures = []
63 try: 65 try:
64 rc = common.run_command([sys.executable] + rest_args + [ 66 rc = common.run_command([sys.executable] + rest_args + [
65 '--output-dir', tempfile_dir, 67 '--output-dir', tempfile_dir,
66 '--output-format=json' 68 '--output-format=json'
67 ], env=env) 69 ], env=env)
68 tempfile_name = os.path.join(tempfile_dir, 'results.json') 70 tempfile_name = os.path.join(tempfile_dir, 'results.json')
(...skipping 16 matching lines...) Expand all
85 87
86 json.dump({ 88 json.dump({
87 'valid': valid, 89 'valid': valid,
88 'failures': failures, 90 'failures': failures,
89 }, args.isolated_script_test_output) 91 }, args.isolated_script_test_output)
90 return rc 92 return rc
91 93
92 finally: 94 finally:
93 xvfb.kill(xvfb_proc) 95 xvfb.kill(xvfb_proc)
94 xvfb.kill(openbox_proc) 96 xvfb.kill(openbox_proc)
97 xvfb.kill(xcompmgr_proc)
95 98
96 99
97 # This is not really a "script test" so does not need to manually add 100 # This is not really a "script test" so does not need to manually add
98 # any additional compile targets. 101 # any additional compile targets.
99 def main_compile_targets(args): 102 def main_compile_targets(args):
100 json.dump([], args.output) 103 json.dump([], args.output)
101 104
102 105
103 if __name__ == '__main__': 106 if __name__ == '__main__':
104 # Conform minimally to the protocol defined by ScriptTest. 107 # Conform minimally to the protocol defined by ScriptTest.
105 if 'compile_targets' in sys.argv: 108 if 'compile_targets' in sys.argv:
106 funcs = { 109 funcs = {
107 'run': None, 110 'run': None,
108 'compile_targets': main_compile_targets, 111 'compile_targets': main_compile_targets,
109 } 112 }
110 sys.exit(common.run_script(sys.argv[1:], funcs)) 113 sys.exit(common.run_script(sys.argv[1:], funcs))
111 sys.exit(main()) 114 sys.exit(main())
OLDNEW
« no previous file with comments | « testing/scripts/run_telemetry_as_googletest.py ('k') | testing/xvfb.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698