Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 isolate bundled Telemetry unittests. | 6 """Runs isolate bundled Telemetry unittests. |
| 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 21 matching lines...) Expand all Loading... | |
| 32 import xvfb | 32 import xvfb |
| 33 | 33 |
| 34 | 34 |
| 35 def main(): | 35 def main(): |
| 36 parser = argparse.ArgumentParser() | 36 parser = argparse.ArgumentParser() |
| 37 parser.add_argument( | 37 parser.add_argument( |
| 38 '--isolated-script-test-output', type=argparse.FileType('w'), | 38 '--isolated-script-test-output', type=argparse.FileType('w'), |
| 39 required=True) | 39 required=True) |
| 40 parser.add_argument('--xvfb', help='Start xvfb.', action='store_true') | 40 parser.add_argument('--xvfb', help='Start xvfb.', action='store_true') |
| 41 args, rest_args = parser.parse_known_args() | 41 args, rest_args = parser.parse_known_args() |
| 42 # Remove the chartjson extra arg until this script cares about chartjson | |
| 43 # results from telemetry | |
| 44 index = 0 | |
| 45 for arg in rest_args: | |
| 46 if '--isolated-script-test-chartjson-output' in arg: | |
| 47 rest_args.pop(index) | |
| 48 break | |
| 49 index += 1 | |
|
Ken Russell (switch to Gerrit)
2016/09/19 20:27:57
Same here.
eyaich1
2016/09/20 12:52:02
Done.
| |
| 50 | |
| 42 xvfb_proc = None | 51 xvfb_proc = None |
| 43 openbox_proc = None | 52 openbox_proc = None |
| 44 xcompmgr_proc = None | 53 xcompmgr_proc = None |
| 45 env = os.environ.copy() | 54 env = os.environ.copy() |
| 46 if args.xvfb and xvfb.should_start_xvfb(env): | 55 if args.xvfb and xvfb.should_start_xvfb(env): |
| 47 xvfb_proc, openbox_proc, xcompmgr_proc = xvfb.start_xvfb(env=env, | 56 xvfb_proc, openbox_proc, xcompmgr_proc = xvfb.start_xvfb(env=env, |
| 48 build_dir='.') | 57 build_dir='.') |
| 49 assert xvfb_proc and openbox_proc and xcompmgr_proc, 'Failed to start xvfb' | 58 assert xvfb_proc and openbox_proc and xcompmgr_proc, 'Failed to start xvfb' |
| 50 # Compatibility with gtest-based sharding. | 59 # Compatibility with gtest-based sharding. |
| 51 total_shards = None | 60 total_shards = None |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 | 104 |
| 96 if __name__ == '__main__': | 105 if __name__ == '__main__': |
| 97 # Conform minimally to the protocol defined by ScriptTest. | 106 # Conform minimally to the protocol defined by ScriptTest. |
| 98 if 'compile_targets' in sys.argv: | 107 if 'compile_targets' in sys.argv: |
| 99 funcs = { | 108 funcs = { |
| 100 'run': None, | 109 'run': None, |
| 101 'compile_targets': main_compile_targets, | 110 'compile_targets': main_compile_targets, |
| 102 } | 111 } |
| 103 sys.exit(common.run_script(sys.argv[1:], funcs)) | 112 sys.exit(common.run_script(sys.argv[1:], funcs)) |
| 104 sys.exit(main()) | 113 sys.exit(main()) |
| OLD | NEW |