OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, 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 | 7 |
8 """Test driver for the Dart project used by continuous build and developers.""" | 8 """Test driver for the Dart project used by continuous build and developers.""" |
9 | 9 |
10 | 10 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 if cleanup: self.Cleanup() | 471 if cleanup: self.Cleanup() |
472 return test_output | 472 return test_output |
473 | 473 |
474 def BeforeRun(self): | 474 def BeforeRun(self): |
475 pass | 475 pass |
476 | 476 |
477 def AfterRun(self): | 477 def AfterRun(self): |
478 pass | 478 pass |
479 | 479 |
480 def Run(self): | 480 def Run(self): |
481 self.BeforeRun() | 481 errorCode = self.BeforeRun() |
| 482 if errorCode: |
| 483 return errorCode |
482 cmd = self.GetCommand() | 484 cmd = self.GetCommand() |
483 try: | 485 try: |
484 result = self.RunCommand(cmd) | 486 result = self.RunCommand(cmd) |
485 finally: | 487 finally: |
486 self.AfterRun() | 488 self.AfterRun() |
487 return result | 489 return result |
488 | 490 |
489 def Cleanup(self): | 491 def Cleanup(self): |
490 return | 492 return |
491 | 493 |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 default='true', | 1214 default='true', |
1213 type='choice') | 1215 type='choice') |
1214 result.add_option( | 1216 result.add_option( |
1215 '--optimize', | 1217 '--optimize', |
1216 help='Invoke dart compiler with --optimize flag', | 1218 help='Invoke dart compiler with --optimize flag', |
1217 default=False, | 1219 default=False, |
1218 action='store_true') | 1220 action='store_true') |
1219 result.add_option( | 1221 result.add_option( |
1220 '-c', '--component', | 1222 '-c', '--component', |
1221 help='The component to test against ' | 1223 help='The component to test against ' |
1222 '(most, vm, dartc, frog, frogsh, leg, chromium, dartium)', | 1224 '(most, vm, dartc, frog, frogsh, leg, chromium, dartium, ' |
| 1225 'webdriver)', |
1223 metavar='[most,vm,dartc,chromium,dartium]', | 1226 metavar='[most,vm,dartc,chromium,dartium]', |
1224 default='vm') | 1227 default='vm') |
1225 return result | 1228 return result |
1226 | 1229 |
1227 | 1230 |
1228 def ProcessOptions(options): | 1231 def ProcessOptions(options): |
1229 """Process command line options.""" | 1232 """Process command line options.""" |
1230 if options.arch == 'all': | 1233 if options.arch == 'all': |
1231 options.arch = 'ia32,x64,simarm' | 1234 options.arch = 'ia32,x64,simarm' |
1232 if options.mode == 'all': | 1235 if options.mode == 'all': |
(...skipping 19 matching lines...) Expand all Loading... |
1252 for mode in options.mode: | 1255 for mode in options.mode: |
1253 if not mode in ['debug', 'release']: | 1256 if not mode in ['debug', 'release']: |
1254 print 'Unknown mode %s' % mode | 1257 print 'Unknown mode %s' % mode |
1255 return False | 1258 return False |
1256 for arch in options.arch: | 1259 for arch in options.arch: |
1257 if not arch in ['ia32', 'x64', 'simarm', 'arm']: | 1260 if not arch in ['ia32', 'x64', 'simarm', 'arm']: |
1258 print 'Unknown arch %s' % arch | 1261 print 'Unknown arch %s' % arch |
1259 return False | 1262 return False |
1260 for component in options.component: | 1263 for component in options.component: |
1261 if not component in ['vm', 'dartc', 'frog', 'frogsh', 'leg', | 1264 if not component in ['vm', 'dartc', 'frog', 'frogsh', 'leg', |
1262 'chromium', 'dartium']: | 1265 'chromium', 'dartium', 'webdriver']: |
1263 print 'Unknown component %s' % component | 1266 print 'Unknown component %s' % component |
1264 return False | 1267 return False |
1265 options.flags = [] | 1268 options.flags = [] |
1266 options.flags.append('--ignore-unrecognized-flags') | 1269 options.flags.append('--ignore-unrecognized-flags') |
1267 if options.checked: | 1270 if options.checked: |
1268 options.flags.append('--enable_asserts') | 1271 options.flags.append('--enable_asserts') |
1269 options.flags.append('--enable_type_checks') | 1272 options.flags.append('--enable_type_checks') |
1270 if options.optimize: | 1273 if options.optimize: |
1271 options.flags.append('--optimize') | 1274 options.flags.append('--optimize') |
1272 for flag in options.flag: | 1275 for flag in options.flag: |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 for entry in timed_tests[:20]: | 1525 for entry in timed_tests[:20]: |
1523 t = FormatTime(entry.duration) | 1526 t = FormatTime(entry.duration) |
1524 print '%4i (%s) %s' % (index, t, entry.GetLabel()) | 1527 print '%4i (%s) %s' % (index, t, entry.GetLabel()) |
1525 index += 1 | 1528 index += 1 |
1526 | 1529 |
1527 return result | 1530 return result |
1528 | 1531 |
1529 | 1532 |
1530 if __name__ == '__main__': | 1533 if __name__ == '__main__': |
1531 sys.exit(Main()) | 1534 sys.exit(Main()) |
OLD | NEW |