| 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 604 |
| 605 def GetBuildRoot(self, mode, arch): | 605 def GetBuildRoot(self, mode, arch): |
| 606 """The top level directory containing compiler, runtime, tools...""" | 606 """The top level directory containing compiler, runtime, tools...""" |
| 607 result = utils.GetBuildRoot(self.os, mode, arch) | 607 result = utils.GetBuildRoot(self.os, mode, arch) |
| 608 return result | 608 return result |
| 609 | 609 |
| 610 def GetBuildConf(self, mode, arch): | 610 def GetBuildConf(self, mode, arch): |
| 611 result = utils.GetBuildConf(mode, arch) | 611 result = utils.GetBuildConf(mode, arch) |
| 612 return result | 612 return result |
| 613 | 613 |
| 614 def GetExecutable(self, mode, arch, name): | 614 def GetExecutable(self, mode, arch, path): |
| 615 """Returns the name of the executable used to run the test.""" | 615 """Returns the name of the executable used to run the test.""" |
| 616 if self.executable is not None: | 616 if self.executable is not None: |
| 617 return self.executable | 617 return self.executable |
| 618 path = os.path.abspath(os.path.join(self.GetBuildRoot(mode, arch), name)) | |
| 619 if utils.IsWindows() and not path.endswith('.exe'): | 618 if utils.IsWindows() and not path.endswith('.exe'): |
| 620 return path + '.exe' | 619 return path + '.exe' |
| 621 else: | 620 else: |
| 622 return path | 621 return path |
| 623 | 622 |
| 624 def GetDart(self, mode, arch, component): | 623 def GetDart(self, mode, arch, component): |
| 625 """Returns the path to the Dart test runner (executes the .dart file).""" | 624 dart = utils.GetDart(mode, arch, component) |
| 626 if component == 'dartc': | 625 return [self.GetExecutable(mode, arch, dart)] |
| 627 command = [os.path.abspath( | |
| 628 os.path.join(self.GetBuildRoot(mode, arch), | |
| 629 'compiler', 'bin', 'dartc_test'))] | |
| 630 else: | |
| 631 command = [self.GetExecutable(mode, arch, 'dart_bin')] | |
| 632 | |
| 633 return command | |
| 634 | 626 |
| 635 def GetDartC(self, mode, arch): | 627 def GetDartC(self, mode, arch): |
| 636 """Returns the path to the Dart --> JS compiler.""" | 628 """Returns the path to the Dart --> JS compiler.""" |
| 637 dartc = os.path.abspath(os.path.join( | 629 dartc = os.path.abspath(os.path.join( |
| 638 self.GetBuildRoot(mode, arch), 'compiler', 'bin', 'dartc')) | 630 self.GetBuildRoot(mode, arch), 'compiler', 'bin', 'dartc')) |
| 639 if utils.IsWindows(): dartc += '.exe' | 631 if utils.IsWindows(): dartc += '.exe' |
| 640 command = [dartc] | 632 command = [dartc] |
| 641 | 633 |
| 642 # Add the flags from the context to the command line. | 634 # Add the flags from the context to the command line. |
| 643 command += self.flags | 635 command += self.flags |
| 644 return command | 636 return command |
| 645 | 637 |
| 646 def GetRunTests(self, mode, arch): | 638 def GetRunTests(self, mode, arch): |
| 647 return [self.GetExecutable(mode, arch, 'run_vm_tests')] | 639 path = os.path.join(self.GetBuildRoot(mode, arch), 'run_vm_tests') |
| 640 return [self.GetExecutable(mode, arch, path)] |
| 648 | 641 |
| 649 | 642 |
| 650 def RunTestCases(cases_to_run, progress, tasks, context): | 643 def RunTestCases(cases_to_run, progress, tasks, context): |
| 651 """Chooses a progress indicator and then starts the tests.""" | 644 """Chooses a progress indicator and then starts the tests.""" |
| 652 progress = PROGRESS_INDICATORS[progress](cases_to_run, context) | 645 progress = PROGRESS_INDICATORS[progress](cases_to_run, context) |
| 653 return progress.Run(tasks) | 646 return progress.Run(tasks) |
| 654 | 647 |
| 655 | 648 |
| 656 # ------------------------------------------- | 649 # ------------------------------------------- |
| 657 # --- T e s t C o n f i g u r a t i o n --- | 650 # --- T e s t C o n f i g u r a t i o n --- |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 default='true', | 1206 default='true', |
| 1214 type='choice') | 1207 type='choice') |
| 1215 result.add_option( | 1208 result.add_option( |
| 1216 '--optimize', | 1209 '--optimize', |
| 1217 help='Invoke dart compiler with --optimize flag', | 1210 help='Invoke dart compiler with --optimize flag', |
| 1218 default=False, | 1211 default=False, |
| 1219 action='store_true') | 1212 action='store_true') |
| 1220 result.add_option( | 1213 result.add_option( |
| 1221 '-c', '--component', | 1214 '-c', '--component', |
| 1222 help='The component to test against ' | 1215 help='The component to test against ' |
| 1223 '(most, vm, dartc, chromium, dartium)', | 1216 '(most, vm, dartc, frog, frogsh, chromium, dartium)', |
| 1224 metavar='[most,vm,dartc,chromium,dartium]', | 1217 metavar='[most,vm,dartc,chromium,dartium]', |
| 1225 default='vm') | 1218 default='vm') |
| 1226 return result | 1219 return result |
| 1227 | 1220 |
| 1228 | 1221 |
| 1229 def ProcessOptions(options): | 1222 def ProcessOptions(options): |
| 1230 """Process command line options.""" | 1223 """Process command line options.""" |
| 1231 if options.arch == 'all': | 1224 if options.arch == 'all': |
| 1232 options.arch = 'ia32,x64,simarm' | 1225 options.arch = 'ia32,x64,simarm' |
| 1233 if options.mode == 'all': | 1226 if options.mode == 'all': |
| 1234 options.mode = 'debug,release' | 1227 options.mode = 'debug,release' |
| 1235 if options.component == 'most': | 1228 if options.component == 'most': |
| 1236 options.component = 'vm,dartc' | 1229 options.component = 'vm,dartc' |
| 1237 | 1230 |
| 1238 if 'dartc' in options.arch: | |
| 1239 options.component = 'dartc' | |
| 1240 if 'dartium' in options.arch: | |
| 1241 options.component = 'dartium' | |
| 1242 if 'chromium' in options.arch: | |
| 1243 options.component = 'chromium' | |
| 1244 | |
| 1245 # By default we run with a higher timeout setting in when running on | 1231 # By default we run with a higher timeout setting in when running on |
| 1246 # a simulated architecture and in debug mode. | 1232 # a simulated architecture and in debug mode. |
| 1247 if not options.timeout: | 1233 if not options.timeout: |
| 1248 options.timeout = TIMEOUT_SECS | 1234 options.timeout = TIMEOUT_SECS |
| 1249 if 'dartc' in options.component: | 1235 if 'dartc' in options.component: |
| 1250 options.timeout *= 4 | 1236 options.timeout *= 4 |
| 1251 elif 'chromium' in options.component: | 1237 elif 'chromium' in options.component: |
| 1252 options.timeout *= 4 | 1238 options.timeout *= 4 |
| 1253 elif 'dartium' in options.component: | 1239 elif 'dartium' in options.component: |
| 1254 options.timeout *= 4 | 1240 options.timeout *= 4 |
| 1255 elif 'debug' in options.mode: | 1241 elif 'debug' in options.mode: |
| 1256 options.timeout *= 2 | 1242 options.timeout *= 2 |
| 1257 options.mode = options.mode.split(',') | 1243 options.mode = options.mode.split(',') |
| 1258 options.arch = options.arch.split(',') | 1244 options.arch = options.arch.split(',') |
| 1259 options.component = options.component.split(',') | 1245 options.component = options.component.split(',') |
| 1260 for mode in options.mode: | 1246 for mode in options.mode: |
| 1261 if not mode in ['debug', 'release']: | 1247 if not mode in ['debug', 'release']: |
| 1262 print 'Unknown mode %s' % mode | 1248 print 'Unknown mode %s' % mode |
| 1263 return False | 1249 return False |
| 1264 for arch in options.arch: | 1250 for arch in options.arch: |
| 1265 if not arch in ['ia32', 'x64', 'simarm', 'arm']: | 1251 if not arch in ['ia32', 'x64', 'simarm', 'arm']: |
| 1266 print 'Unknown arch %s' % arch | 1252 print 'Unknown arch %s' % arch |
| 1267 return False | 1253 return False |
| 1268 for component in options.component: | 1254 for component in options.component: |
| 1269 if not component in ['vm', 'dartc', 'chromium', 'dartium']: | 1255 if not component in ['vm', 'dartc', 'frog', 'frogsh', |
| 1256 'chromium', 'dartium']: |
| 1270 print 'Unknown component %s' % component | 1257 print 'Unknown component %s' % component |
| 1271 return False | 1258 return False |
| 1272 options.flags = [] | 1259 options.flags = [] |
| 1273 options.flags.append('--ignore-unrecognized-flags') | 1260 options.flags.append('--ignore-unrecognized-flags') |
| 1274 if options.checked: | 1261 if options.checked: |
| 1275 options.flags.append('--enable_asserts') | 1262 options.flags.append('--enable_asserts') |
| 1276 options.flags.append('--enable_type_checks') | 1263 options.flags.append('--enable_type_checks') |
| 1277 if options.optimize: | 1264 if options.optimize: |
| 1278 options.flags.append('--optimize') | 1265 options.flags.append('--optimize') |
| 1279 for flag in options.flag: | 1266 for flag in options.flag: |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 for entry in timed_tests[:20]: | 1515 for entry in timed_tests[:20]: |
| 1529 t = FormatTime(entry.duration) | 1516 t = FormatTime(entry.duration) |
| 1530 print '%4i (%s) %s' % (index, t, entry.GetLabel()) | 1517 print '%4i (%s) %s' % (index, t, entry.GetLabel()) |
| 1531 index += 1 | 1518 index += 1 |
| 1532 | 1519 |
| 1533 return result | 1520 return result |
| 1534 | 1521 |
| 1535 | 1522 |
| 1536 if __name__ == '__main__': | 1523 if __name__ == '__main__': |
| 1537 sys.exit(Main()) | 1524 sys.exit(Main()) |
| OLD | NEW |