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