| OLD | NEW |
| 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
| 3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 # This file contains a set of utilities functions used by other Python-based | 5 # This file contains a set of utilities functions used by other Python-based |
| 6 # scripts. | 6 # scripts. |
| 7 | 7 |
| 8 import commands | 8 import commands |
| 9 import os | 9 import os |
| 10 import platform | 10 import platform |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 for arg in parser.rargs: | 103 for arg in parser.rargs: |
| 104 if arg[:2].startswith('--') or arg[0] != '-': | 104 if arg[:2].startswith('--') or arg[0] != '-': |
| 105 break | 105 break |
| 106 value.append(arg) | 106 value.append(arg) |
| 107 | 107 |
| 108 del parser.rargs[:len(value)] | 108 del parser.rargs[:len(value)] |
| 109 setattr(parser.values, option.dest, value) | 109 setattr(parser.values, option.dest, value) |
| 110 | 110 |
| 111 | 111 |
| 112 # Returns the path to the Dart test runner (executes the .dart file). | |
| 113 def GetDartRunner(mode, arch, component): | |
| 114 build_root = GetBuildRoot(GuessOS(), mode, arch) | |
| 115 if component == 'dartc': | |
| 116 return os.path.join(build_root, 'compiler', 'bin', 'dartc_test') | |
| 117 elif component == 'frog': | |
| 118 return os.path.join(build_root, 'frog', 'bin', 'frog') | |
| 119 elif component == 'frogsh': | |
| 120 return os.path.join(build_root, 'frog', 'bin', 'frogsh') | |
| 121 else: | |
| 122 suffix = '' | |
| 123 if IsWindows(): | |
| 124 suffix = '.exe' | |
| 125 return os.path.join(build_root, 'dart') + suffix | |
| 126 | |
| 127 | |
| 128 # Mapping table between build mode and build configuration. | 112 # Mapping table between build mode and build configuration. |
| 129 BUILD_MODES = { | 113 BUILD_MODES = { |
| 130 'debug': 'Debug', | 114 'debug': 'Debug', |
| 131 'release': 'Release', | 115 'release': 'Release', |
| 132 } | 116 } |
| 133 | 117 |
| 134 | 118 |
| 135 # Mapping table between OS and build output location. | 119 # Mapping table between OS and build output location. |
| 136 BUILD_ROOT = { | 120 BUILD_ROOT = { |
| 137 'win32': os.path.join(''), | 121 'win32': os.path.join(''), |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 266 |
| 283 def DiagnoseExitCode(exit_code, command): | 267 def DiagnoseExitCode(exit_code, command): |
| 284 if IsCrashExitCode(exit_code): | 268 if IsCrashExitCode(exit_code): |
| 285 sys.stderr.write('Command: %s\nCRASHED with exit code %d (0x%x)\n' % ( | 269 sys.stderr.write('Command: %s\nCRASHED with exit code %d (0x%x)\n' % ( |
| 286 ' '.join(command), exit_code, exit_code & 0xffffffff)) | 270 ' '.join(command), exit_code, exit_code & 0xffffffff)) |
| 287 | 271 |
| 288 | 272 |
| 289 if __name__ == "__main__": | 273 if __name__ == "__main__": |
| 290 import sys | 274 import sys |
| 291 Main(sys.argv) | 275 Main(sys.argv) |
| OLD | NEW |