| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2012 the V8 project authors. All rights reserved. | 3 # Copyright 2012 the V8 project authors. All rights reserved. |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 module = imp.load_module('testcfg', file, pathname, description) | 624 module = imp.load_module('testcfg', file, pathname, description) |
| 625 self.config = module.GetConfiguration(context, self.path) | 625 self.config = module.GetConfiguration(context, self.path) |
| 626 finally: | 626 finally: |
| 627 if file: | 627 if file: |
| 628 file.close() | 628 file.close() |
| 629 return self.config | 629 return self.config |
| 630 | 630 |
| 631 def GetBuildRequirements(self, path, context): | 631 def GetBuildRequirements(self, path, context): |
| 632 return self.GetConfiguration(context).GetBuildRequirements() | 632 return self.GetConfiguration(context).GetBuildRequirements() |
| 633 | 633 |
| 634 def DownloadData(self, context): |
| 635 config = self.GetConfiguration(context) |
| 636 if 'DownloadData' in dir(config): |
| 637 config.DownloadData() |
| 638 |
| 634 def AddTestsToList(self, result, current_path, path, context, mode): | 639 def AddTestsToList(self, result, current_path, path, context, mode): |
| 635 for v in self.GetConfiguration(context).VariantFlags(): | 640 config = self.GetConfiguration(context) |
| 636 tests = self.GetConfiguration(context).ListTests(current_path, path, mode,
v) | 641 for v in config.VariantFlags(): |
| 642 tests = config.ListTests(current_path, path, mode, v) |
| 637 for t in tests: t.variant_flags = v | 643 for t in tests: t.variant_flags = v |
| 638 result += tests | 644 result += tests |
| 639 | 645 |
| 640 def GetTestStatus(self, context, sections, defs): | 646 def GetTestStatus(self, context, sections, defs): |
| 641 self.GetConfiguration(context).GetTestStatus(sections, defs) | 647 self.GetConfiguration(context).GetTestStatus(sections, defs) |
| 642 | 648 |
| 643 | 649 |
| 644 class LiteralTestSuite(TestSuite): | 650 class LiteralTestSuite(TestSuite): |
| 645 | 651 |
| 646 def __init__(self, tests): | 652 def __init__(self, tests): |
| 647 super(LiteralTestSuite, self).__init__('root') | 653 super(LiteralTestSuite, self).__init__('root') |
| 648 self.tests = tests | 654 self.tests = tests |
| 649 | 655 |
| 650 def GetBuildRequirements(self, path, context): | 656 def GetBuildRequirements(self, path, context): |
| 651 (name, rest) = CarCdr(path) | 657 (name, rest) = CarCdr(path) |
| 652 result = [ ] | 658 result = [ ] |
| 653 for test in self.tests: | 659 for test in self.tests: |
| 654 if not name or name.match(test.GetName()): | 660 if not name or name.match(test.GetName()): |
| 655 result += test.GetBuildRequirements(rest, context) | 661 result += test.GetBuildRequirements(rest, context) |
| 656 return result | 662 return result |
| 657 | 663 |
| 664 def DownloadData(self, path, context): |
| 665 (name, rest) = CarCdr(path) |
| 666 for test in self.tests: |
| 667 if not name or name.match(test.GetName()): |
| 668 test.DownloadData(context) |
| 669 |
| 658 def ListTests(self, current_path, path, context, mode, variant_flags): | 670 def ListTests(self, current_path, path, context, mode, variant_flags): |
| 659 (name, rest) = CarCdr(path) | 671 (name, rest) = CarCdr(path) |
| 660 result = [ ] | 672 result = [ ] |
| 661 for test in self.tests: | 673 for test in self.tests: |
| 662 test_name = test.GetName() | 674 test_name = test.GetName() |
| 663 if not name or name.match(test_name): | 675 if not name or name.match(test_name): |
| 664 full_path = current_path + [test_name] | 676 full_path = current_path + [test_name] |
| 665 test.AddTestsToList(result, full_path, path, context, mode) | 677 test.AddTestsToList(result, full_path, path, context, mode) |
| 666 return result | 678 return result |
| 667 | 679 |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 help="The style of progress indicator (verbose, dots, color, mono)", | 1197 help="The style of progress indicator (verbose, dots, color, mono)", |
| 1186 choices=PROGRESS_INDICATORS.keys(), default="mono") | 1198 choices=PROGRESS_INDICATORS.keys(), default="mono") |
| 1187 result.add_option("--no-build", help="Don't build requirements", | 1199 result.add_option("--no-build", help="Don't build requirements", |
| 1188 default=False, action="store_true") | 1200 default=False, action="store_true") |
| 1189 result.add_option("--build-only", help="Only build requirements, don't run the
tests", | 1201 result.add_option("--build-only", help="Only build requirements, don't run the
tests", |
| 1190 default=False, action="store_true") | 1202 default=False, action="store_true") |
| 1191 result.add_option("--build-system", help="Build system in use (scons or gyp)", | 1203 result.add_option("--build-system", help="Build system in use (scons or gyp)", |
| 1192 default='scons') | 1204 default='scons') |
| 1193 result.add_option("--report", help="Print a summary of the tests to be run", | 1205 result.add_option("--report", help="Print a summary of the tests to be run", |
| 1194 default=False, action="store_true") | 1206 default=False, action="store_true") |
| 1207 result.add_option("--download-data", help="Download missing test suite dara", |
| 1208 default=False, action="store_true") |
| 1195 result.add_option("-s", "--suite", help="A test suite", | 1209 result.add_option("-s", "--suite", help="A test suite", |
| 1196 default=[], action="append") | 1210 default=[], action="append") |
| 1197 result.add_option("-t", "--timeout", help="Timeout in seconds", | 1211 result.add_option("-t", "--timeout", help="Timeout in seconds", |
| 1198 default=-1, type="int") | 1212 default=-1, type="int") |
| 1199 result.add_option("--arch", help='The architecture to run tests for', | 1213 result.add_option("--arch", help='The architecture to run tests for', |
| 1200 default='none') | 1214 default='none') |
| 1201 result.add_option("--snapshot", help="Run the tests with snapshot turned on", | 1215 result.add_option("--snapshot", help="Run the tests with snapshot turned on", |
| 1202 default=False, action="store_true") | 1216 default=False, action="store_true") |
| 1203 result.add_option("--simulator", help="Run tests with architecture simulator", | 1217 result.add_option("--simulator", help="Run tests with architecture simulator", |
| 1204 default='none') | 1218 default='none') |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 # Just return if we are only building the targets for running the tests. | 1469 # Just return if we are only building the targets for running the tests. |
| 1456 if options.build_only: | 1470 if options.build_only: |
| 1457 return 0 | 1471 return 0 |
| 1458 | 1472 |
| 1459 # Get status for tests | 1473 # Get status for tests |
| 1460 sections = [ ] | 1474 sections = [ ] |
| 1461 defs = { } | 1475 defs = { } |
| 1462 root.GetTestStatus(context, sections, defs) | 1476 root.GetTestStatus(context, sections, defs) |
| 1463 config = Configuration(sections, defs) | 1477 config = Configuration(sections, defs) |
| 1464 | 1478 |
| 1479 # Download missing test suite data if requested. |
| 1480 if options.download_data: |
| 1481 for path in paths: |
| 1482 root.DownloadData(path, context) |
| 1483 |
| 1465 # List the tests | 1484 # List the tests |
| 1466 all_cases = [ ] | 1485 all_cases = [ ] |
| 1467 all_unused = [ ] | 1486 all_unused = [ ] |
| 1468 unclassified_tests = [ ] | 1487 unclassified_tests = [ ] |
| 1469 globally_unused_rules = None | 1488 globally_unused_rules = None |
| 1470 for path in paths: | 1489 for path in paths: |
| 1471 for mode in options.mode: | 1490 for mode in options.mode: |
| 1472 env = { | 1491 env = { |
| 1473 'mode': mode, | 1492 'mode': mode, |
| 1474 'system': utils.GuessOS(), | 1493 'system': utils.GuessOS(), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 for entry in timed_tests[:20]: | 1557 for entry in timed_tests[:20]: |
| 1539 t = FormatTime(entry.duration) | 1558 t = FormatTime(entry.duration) |
| 1540 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) | 1559 sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) |
| 1541 index += 1 | 1560 index += 1 |
| 1542 | 1561 |
| 1543 return result | 1562 return result |
| 1544 | 1563 |
| 1545 | 1564 |
| 1546 if __name__ == '__main__': | 1565 if __name__ == '__main__': |
| 1547 sys.exit(Main()) | 1566 sys.exit(Main()) |
| OLD | NEW |