| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 del env['GTEST_SHARD_INDEX'] | 60 del env['GTEST_SHARD_INDEX'] |
| 61 sharding_args = [] | 61 sharding_args = [] |
| 62 if total_shards is not None and shard_index is not None: | 62 if total_shards is not None and shard_index is not None: |
| 63 sharding_args = [ | 63 sharding_args = [ |
| 64 '--total-shards=%d' % total_shards, | 64 '--total-shards=%d' % total_shards, |
| 65 '--shard-index=%d' % shard_index | 65 '--shard-index=%d' % shard_index |
| 66 ] | 66 ] |
| 67 cmd = [sys.executable] + rest_args + sharding_args + [ | 67 cmd = [sys.executable] + rest_args + sharding_args + [ |
| 68 '--write-full-results-to', args.isolated_script_test_output] | 68 '--write-full-results-to', args.isolated_script_test_output] |
| 69 if args.xvfb: | 69 if args.xvfb: |
| 70 return xvfb.run_executable(cmd, '.', env) | 70 return xvfb.run_executable(cmd, env) |
| 71 else: | 71 else: |
| 72 return common.run_command(cmd, env=env) | 72 return common.run_command(cmd, env=env) |
| 73 | 73 |
| 74 | 74 |
| 75 # This is not really a "script test" so does not need to manually add | 75 # This is not really a "script test" so does not need to manually add |
| 76 # any additional compile targets. | 76 # any additional compile targets. |
| 77 def main_compile_targets(args): | 77 def main_compile_targets(args): |
| 78 json.dump([], args.output) | 78 json.dump([], args.output) |
| 79 | 79 |
| 80 | 80 |
| 81 if __name__ == '__main__': | 81 if __name__ == '__main__': |
| 82 # Conform minimally to the protocol defined by ScriptTest. | 82 # Conform minimally to the protocol defined by ScriptTest. |
| 83 if 'compile_targets' in sys.argv: | 83 if 'compile_targets' in sys.argv: |
| 84 funcs = { | 84 funcs = { |
| 85 'run': None, | 85 'run': None, |
| 86 'compile_targets': main_compile_targets, | 86 'compile_targets': main_compile_targets, |
| 87 } | 87 } |
| 88 sys.exit(common.run_script(sys.argv[1:], funcs)) | 88 sys.exit(common.run_script(sys.argv[1:], funcs)) |
| 89 sys.exit(main()) | 89 sys.exit(main()) |
| OLD | NEW |