| 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 19 matching lines...) Expand all Loading... |
| 30 # Add src/testing/ into sys.path for importing xvfb. | 30 # Add src/testing/ into sys.path for importing xvfb. |
| 31 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 31 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
| 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( |
| 41 '--isolated-script-test-chartjson-output', type=argparse.FileType('w'), |
| 42 required=False) |
| 40 parser.add_argument('--xvfb', help='Start xvfb.', action='store_true') | 43 parser.add_argument('--xvfb', help='Start xvfb.', action='store_true') |
| 41 args, rest_args = parser.parse_known_args() | 44 args, rest_args = parser.parse_known_args() |
| 45 |
| 42 xvfb_proc = None | 46 xvfb_proc = None |
| 43 openbox_proc = None | 47 openbox_proc = None |
| 44 xcompmgr_proc = None | 48 xcompmgr_proc = None |
| 45 env = os.environ.copy() | 49 env = os.environ.copy() |
| 46 if args.xvfb and xvfb.should_start_xvfb(env): | 50 if args.xvfb and xvfb.should_start_xvfb(env): |
| 47 xvfb_proc, openbox_proc, xcompmgr_proc = xvfb.start_xvfb(env=env, | 51 xvfb_proc, openbox_proc, xcompmgr_proc = xvfb.start_xvfb(env=env, |
| 48 build_dir='.') | 52 build_dir='.') |
| 49 assert xvfb_proc and openbox_proc and xcompmgr_proc, 'Failed to start xvfb' | 53 assert xvfb_proc and openbox_proc and xcompmgr_proc, 'Failed to start xvfb' |
| 50 # Compatibility with gtest-based sharding. | 54 # Compatibility with gtest-based sharding. |
| 51 total_shards = None | 55 total_shards = None |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 99 |
| 96 if __name__ == '__main__': | 100 if __name__ == '__main__': |
| 97 # Conform minimally to the protocol defined by ScriptTest. | 101 # Conform minimally to the protocol defined by ScriptTest. |
| 98 if 'compile_targets' in sys.argv: | 102 if 'compile_targets' in sys.argv: |
| 99 funcs = { | 103 funcs = { |
| 100 'run': None, | 104 'run': None, |
| 101 'compile_targets': main_compile_targets, | 105 'compile_targets': main_compile_targets, |
| 102 } | 106 } |
| 103 sys.exit(common.run_script(sys.argv[1:], funcs)) | 107 sys.exit(common.run_script(sys.argv[1:], funcs)) |
| 104 sys.exit(main()) | 108 sys.exit(main()) |
| OLD | NEW |