| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """A tool to run a chrome test executable directly, or in isolated mode.""" | 6 """A tool to run a chrome test executable directly, or in isolated mode.""" |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| 11 import sys | 11 import sys |
| 12 | 12 |
| 13 from common import chromium_utils | 13 from common import chromium_utils |
| 14 | 14 |
| 15 | 15 |
| 16 USAGE = ('%s [options] /full/path/to/test.exe -- [original test command]' % | 16 USAGE = ('%s [options] /full/path/to/test.exe -- [original test command]' % |
| 17 os.path.basename(sys.argv[0])) | 17 os.path.basename(sys.argv[0])) |
| 18 | 18 |
| 19 ISOLATE_ENABLED_TESTS = { | 19 ISOLATE_ENABLED_TESTS = { |
| 20 'Linux Tests': 'base_unittests', |
| 21 'linux_rel': 'base_unittests', |
| 22 'Vista Tests (2)': 'base_unittests', |
| 23 'Win 7 Tests x64 (2)': 'base_unittests', |
| 24 'win_rel': 'base_unittests', |
| 25 'Win7 Tests (2)': 'base_unittests', |
| 26 'XP Tests (2)': 'base_unittests', |
| 20 } | 27 } |
| 21 | 28 |
| 22 | 29 |
| 23 def should_run_as_isolated(builder_name, test_name): | 30 def should_run_as_isolated(builder_name, test_name): |
| 24 logging.info('should_run_as_isolated(%s, %s)' % (builder_name, test_name)) | 31 logging.info('should_run_as_isolated(%s, %s)' % (builder_name, test_name)) |
| 25 | 32 |
| 26 return test_name in ISOLATE_ENABLED_TESTS.get(builder_name, ()) | 33 return test_name in ISOLATE_ENABLED_TESTS.get(builder_name, ()) |
| 27 | 34 |
| 28 | 35 |
| 29 def run_test_isolated(isolate_script, test_exe, original_command): | 36 def run_test_isolated(isolate_script, test_exe, original_command): |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 isolate_script = os.path.join(options.tool_dir, 'swarm_client', | 91 isolate_script = os.path.join(options.tool_dir, 'swarm_client', |
| 85 'isolate.py') | 92 'isolate.py') |
| 86 return run_test_isolated(isolate_script, test_exe, original_command) | 93 return run_test_isolated(isolate_script, test_exe, original_command) |
| 87 else: | 94 else: |
| 88 logging.info('Running test normally') | 95 logging.info('Running test normally') |
| 89 return chromium_utils.RunCommand(original_command) | 96 return chromium_utils.RunCommand(original_command) |
| 90 | 97 |
| 91 | 98 |
| 92 if '__main__' == __name__: | 99 if '__main__' == __name__: |
| 93 sys.exit(main()) | 100 sys.exit(main()) |
| OLD | NEW |