Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 # A script which makes it easy to execute common DOM-related tasks | 7 # A script which makes it easy to execute common DOM-related tasks |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 import subprocess | 10 import subprocess |
| 11 import sys | 11 import sys |
| 12 from sys import argv | |
|
Jennifer Messerly
2013/04/27 01:06:58
making sure argv is defined for all the commands
a
| |
| 12 | 13 |
| 13 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 14 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
| 14 import utils | 15 import utils |
| 15 | 16 |
| 16 dart_out_dir = utils.GetBuildRoot(utils.GuessOS(), 'release', 'ia32') | 17 dart_out_dir = utils.GetBuildRoot(utils.GuessOS(), 'release', 'ia32') |
| 17 if utils.IsWindows(): | 18 if utils.IsWindows(): |
| 18 dart_bin = os.path.join(dart_out_dir, 'dart.exe') | 19 dart_bin = os.path.join(dart_out_dir, 'dart.exe') |
| 19 else: | 20 else: |
| 20 dart_bin = os.path.join(dart_out_dir, 'dart') | 21 dart_bin = os.path.join(dart_out_dir, 'dart') |
| 21 | 22 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 '-o%s' % out_file | 91 '-o%s' % out_file |
| 91 ] | 92 ] |
| 92 if checked: | 93 if checked: |
| 93 args.append('--checked') | 94 args.append('--checked') |
| 94 | 95 |
| 95 call(args) | 96 call(args) |
| 96 return out_file | 97 return out_file |
| 97 | 98 |
| 98 def gen(): | 99 def gen(): |
| 99 os.chdir(os.path.join('tools', 'dom', 'scripts')) | 100 os.chdir(os.path.join('tools', 'dom', 'scripts')) |
| 100 return call(os.path.join(os.getcwd(), 'go.sh')) | 101 return call([os.path.join(os.getcwd(), 'dartdomgenerator.py'), |
|
Jennifer Messerly
2013/04/27 01:06:58
the "reset" in go.sh fails for me because it doesn
| |
| 102 '--rebuild', '--parallel', '--systems=htmldart2js,htmldartium']) | |
| 101 | 103 |
| 102 def http_server(): | 104 def http_server(): |
| 103 print('Browse tests at ' | 105 print('Browse tests at ' |
| 104 '\033[94mhttp://localhost:5400/root_build/generated_tests/\033[0m') | 106 '\033[94mhttp://localhost:5400/root_build/generated_tests/\033[0m') |
| 105 return call([ | 107 return call([ |
| 106 utils.DartBinary(), | 108 utils.DartBinary(), |
| 107 os.path.join('tools', 'testing', 'dart', 'http_server.dart'), | 109 os.path.join('tools', 'testing', 'dart', 'http_server.dart'), |
| 108 '--port=5400', | 110 '--port=5400', |
| 109 '--crossOriginPort=5401', | 111 '--crossOriginPort=5401', |
| 110 '--network=0.0.0.0', | 112 '--network=0.0.0.0', |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 'test_chrome': [test_chrome, 'Run tests in checked mode in Chrome.\n' | 185 'test_chrome': [test_chrome, 'Run tests in checked mode in Chrome.\n' |
| 184 '\t\tOptionally provide name of test to run.'], | 186 '\t\tOptionally provide name of test to run.'], |
| 185 'test_drt': [test_drt, 'Run tests in checked mode in DumpRenderTree.\n' | 187 'test_drt': [test_drt, 'Run tests in checked mode in DumpRenderTree.\n' |
| 186 '\t\tOptionally provide name of test to run.'], | 188 '\t\tOptionally provide name of test to run.'], |
| 187 'test_ff': [test_ff, 'Run tests in checked mode in Firefox.\n' | 189 'test_ff': [test_ff, 'Run tests in checked mode in Firefox.\n' |
| 188 '\t\tOptionally provide name of test to run.'], | 190 '\t\tOptionally provide name of test to run.'], |
| 189 'http_server': [http_server, 'Starts the testing server for manually ' | 191 'http_server': [http_server, 'Starts the testing server for manually ' |
| 190 'running browser tests.'], | 192 'running browser tests.'], |
| 191 } | 193 } |
| 192 | 194 |
| 193 def main(argv): | 195 def main(): |
| 194 success = True | 196 success = True |
| 195 argv.pop(0) | 197 argv.pop(0) |
| 196 | 198 |
| 197 if not argv: | 199 if not argv: |
| 198 help() | 200 help() |
| 199 success = False | 201 success = False |
| 200 | 202 |
| 201 while (argv): | 203 while (argv): |
| 202 init_dir() | 204 init_dir() |
| 203 command = argv.pop(0) | 205 command = argv.pop(0) |
| 204 | 206 |
| 205 if not command in commands: | 207 if not command in commands: |
| 206 help(); | 208 help(); |
| 207 success = False | 209 success = False |
| 208 break | 210 break |
| 209 returncode = commands[command][0]() | 211 returncode = commands[command][0]() |
| 210 success = success and not bool(returncode) | 212 success = success and not bool(returncode) |
| 211 | 213 |
| 212 sys.exit(not success) | 214 sys.exit(not success) |
| 213 | 215 |
| 214 if __name__ == '__main__': | 216 if __name__ == '__main__': |
| 215 main(sys.argv) | 217 main() |
| OLD | NEW |