OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Classes and methods for enumerating and preparing tests. | 6 * Classes and methods for enumerating and preparing tests. |
7 * | 7 * |
8 * This library includes: | 8 * This library includes: |
9 * | 9 * |
10 * - Creating tests by listing all the Dart files in certain directories, | 10 * - Creating tests by listing all the Dart files in certain directories, |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 * instead of having to create a custom [StandardTestSuite] subclass. In | 710 * instead of having to create a custom [StandardTestSuite] subclass. In |
711 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] | 711 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] |
712 * in test.dart, this will all be set up for you. | 712 * in test.dart, this will all be set up for you. |
713 */ | 713 */ |
714 factory StandardTestSuite.forDirectory(Map configuration, Path directory) { | 714 factory StandardTestSuite.forDirectory(Map configuration, Path directory) { |
715 var name = directory.filename; | 715 var name = directory.filename; |
716 var status_paths = [ | 716 var status_paths = [ |
717 '$directory/$name.status', | 717 '$directory/$name.status', |
718 '$directory/.status', | 718 '$directory/.status', |
719 '$directory/${name}_dart2js.status', | 719 '$directory/${name}_dart2js.status', |
720 '$directory/${name}_analyzer2.status' | 720 '$directory/${name}_analyzer2.status', |
| 721 '$directory/${name}_kernel.status' |
721 ]; | 722 ]; |
722 | 723 |
723 return new StandardTestSuite(configuration, name, directory, status_paths, | 724 return new StandardTestSuite(configuration, name, directory, status_paths, |
724 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), | 725 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), |
725 recursive: true); | 726 recursive: true); |
726 } | 727 } |
727 | 728 |
728 List<Uri> get dart2JsBootstrapDependencies => _dart2JsBootstrapDependencies; | 729 List<Uri> get dart2JsBootstrapDependencies => _dart2JsBootstrapDependencies; |
729 | 730 |
730 /** | 731 /** |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 * snapshot to the expectation file. When tests fail, 'test.dart' saves the | 1669 * snapshot to the expectation file. When tests fail, 'test.dart' saves the |
1669 * new snapshot into a file so it can be visualized or copied over. | 1670 * new snapshot into a file so it can be visualized or copied over. |
1670 * Expectations can be recorded for the first time by creating an empty file | 1671 * Expectations can be recorded for the first time by creating an empty file |
1671 * with the right name (touch test_name_test.png), running the test, and | 1672 * with the right name (touch test_name_test.png), running the test, and |
1672 * executing the copy command printed by the test script. | 1673 * executing the copy command printed by the test script. |
1673 * | 1674 * |
1674 * This method is static as the map is cached and shared amongst | 1675 * This method is static as the map is cached and shared amongst |
1675 * configurations, so it may not use [configuration]. | 1676 * configurations, so it may not use [configuration]. |
1676 */ | 1677 */ |
1677 Map readOptionsFromFile(Path filePath) { | 1678 Map readOptionsFromFile(Path filePath) { |
1678 if (filePath.segments().contains('co19')) { | 1679 if (filePath.filename.endsWith('.dill')) { |
| 1680 return optionsFromKernelFile(); |
| 1681 } else if (filePath.segments().contains('co19')) { |
1679 return readOptionsFromCo19File(filePath); | 1682 return readOptionsFromCo19File(filePath); |
1680 } | 1683 } |
1681 RegExp testOptionsRegExp = new RegExp(r"// VMOptions=(.*)"); | 1684 RegExp testOptionsRegExp = new RegExp(r"// VMOptions=(.*)"); |
1682 RegExp sharedOptionsRegExp = new RegExp(r"// SharedOptions=(.*)"); | 1685 RegExp sharedOptionsRegExp = new RegExp(r"// SharedOptions=(.*)"); |
1683 RegExp dartOptionsRegExp = new RegExp(r"// DartOptions=(.*)"); | 1686 RegExp dartOptionsRegExp = new RegExp(r"// DartOptions=(.*)"); |
1684 RegExp otherScriptsRegExp = new RegExp(r"// OtherScripts=(.*)"); | 1687 RegExp otherScriptsRegExp = new RegExp(r"// OtherScripts=(.*)"); |
1685 RegExp otherResourcesRegExp = new RegExp(r"// OtherResources=(.*)"); | 1688 RegExp otherResourcesRegExp = new RegExp(r"// OtherResources=(.*)"); |
1686 RegExp packageRootRegExp = new RegExp(r"// PackageRoot=(.*)"); | 1689 RegExp packageRootRegExp = new RegExp(r"// PackageRoot=(.*)"); |
1687 RegExp packagesRegExp = new RegExp(r"// Packages=(.*)"); | 1690 RegExp packagesRegExp = new RegExp(r"// Packages=(.*)"); |
1688 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); | 1691 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 "otherScripts": otherScripts, | 1797 "otherScripts": otherScripts, |
1795 "otherResources": otherResources, | 1798 "otherResources": otherResources, |
1796 "isMultitest": isMultitest, | 1799 "isMultitest": isMultitest, |
1797 "isMultiHtmlTest": isMultiHtmlTest, | 1800 "isMultiHtmlTest": isMultiHtmlTest, |
1798 "subtestNames": subtestNames, | 1801 "subtestNames": subtestNames, |
1799 "isolateStubs": isolateStubs, | 1802 "isolateStubs": isolateStubs, |
1800 "containsDomImport": containsDomImport | 1803 "containsDomImport": containsDomImport |
1801 }; | 1804 }; |
1802 } | 1805 } |
1803 | 1806 |
| 1807 Map optionsFromKernelFile() { |
| 1808 return const { |
| 1809 "vmOptions": const [ const []], |
| 1810 "sharedOptions": const [], |
| 1811 "dartOptions": null, |
| 1812 "packageRoot": null, |
| 1813 "packages": null, |
| 1814 "hasCompileError": false, |
| 1815 "hasRuntimeError": false, |
| 1816 "hasStaticWarning": false, |
| 1817 "otherScripts": const [], |
| 1818 "isMultitest": false, |
| 1819 "isMultiHtmlTest": false, |
| 1820 "subtestNames": const [], |
| 1821 "isolateStubs": '', |
| 1822 "containsDomImport": false, |
| 1823 }; |
| 1824 } |
| 1825 |
1804 List<List<String>> getVmOptions(Map optionsFromFile) { | 1826 List<List<String>> getVmOptions(Map optionsFromFile) { |
1805 var COMPILERS = const ['none', 'precompiler', 'dart2app', 'dart2appjit']; | 1827 var COMPILERS = const ['none', 'precompiler', 'dart2app', 'dart2appjit']; |
1806 var RUNTIMES = const [ | 1828 var RUNTIMES = const [ |
1807 'none', | 1829 'none', |
1808 'dart_precompiled', | 1830 'dart_precompiled', |
1809 'dart_app', | 1831 'dart_app', |
1810 'vm', | 1832 'vm', |
1811 'drt', | 1833 'drt', |
1812 'dartium', | 1834 'dartium', |
1813 'ContentShellOnAndroid', | 1835 'ContentShellOnAndroid', |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 } | 2526 } |
2505 if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) { | 2527 if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) { |
2506 ++shortNameCounter; | 2528 ++shortNameCounter; |
2507 var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH); | 2529 var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH); |
2508 path = "short${shortNameCounter}_$pathEnd"; | 2530 path = "short${shortNameCounter}_$pathEnd"; |
2509 } | 2531 } |
2510 } | 2532 } |
2511 return path; | 2533 return path; |
2512 } | 2534 } |
2513 } | 2535 } |
OLD | NEW |