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' | |
722 ]; | 721 ]; |
723 | 722 |
724 return new StandardTestSuite(configuration, name, directory, status_paths, | 723 return new StandardTestSuite(configuration, name, directory, status_paths, |
725 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), | 724 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), |
726 recursive: true); | 725 recursive: true); |
727 } | 726 } |
728 | 727 |
729 List<Uri> get dart2JsBootstrapDependencies => _dart2JsBootstrapDependencies; | 728 List<Uri> get dart2JsBootstrapDependencies => _dart2JsBootstrapDependencies; |
730 | 729 |
731 /** | 730 /** |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 * snapshot to the expectation file. When tests fail, 'test.dart' saves the | 1668 * snapshot to the expectation file. When tests fail, 'test.dart' saves the |
1670 * new snapshot into a file so it can be visualized or copied over. | 1669 * new snapshot into a file so it can be visualized or copied over. |
1671 * Expectations can be recorded for the first time by creating an empty file | 1670 * Expectations can be recorded for the first time by creating an empty file |
1672 * with the right name (touch test_name_test.png), running the test, and | 1671 * with the right name (touch test_name_test.png), running the test, and |
1673 * executing the copy command printed by the test script. | 1672 * executing the copy command printed by the test script. |
1674 * | 1673 * |
1675 * This method is static as the map is cached and shared amongst | 1674 * This method is static as the map is cached and shared amongst |
1676 * configurations, so it may not use [configuration]. | 1675 * configurations, so it may not use [configuration]. |
1677 */ | 1676 */ |
1678 Map readOptionsFromFile(Path filePath) { | 1677 Map readOptionsFromFile(Path filePath) { |
1679 if (filePath.filename.endsWith('.dill')) { | 1678 if (filePath.segments().contains('co19')) { |
1680 return optionsFromKernelFile(); | |
1681 } else if (filePath.segments().contains('co19')) { | |
1682 return readOptionsFromCo19File(filePath); | 1679 return readOptionsFromCo19File(filePath); |
1683 } | 1680 } |
1684 RegExp testOptionsRegExp = new RegExp(r"// VMOptions=(.*)"); | 1681 RegExp testOptionsRegExp = new RegExp(r"// VMOptions=(.*)"); |
1685 RegExp sharedOptionsRegExp = new RegExp(r"// SharedOptions=(.*)"); | 1682 RegExp sharedOptionsRegExp = new RegExp(r"// SharedOptions=(.*)"); |
1686 RegExp dartOptionsRegExp = new RegExp(r"// DartOptions=(.*)"); | 1683 RegExp dartOptionsRegExp = new RegExp(r"// DartOptions=(.*)"); |
1687 RegExp otherScriptsRegExp = new RegExp(r"// OtherScripts=(.*)"); | 1684 RegExp otherScriptsRegExp = new RegExp(r"// OtherScripts=(.*)"); |
1688 RegExp otherResourcesRegExp = new RegExp(r"// OtherResources=(.*)"); | 1685 RegExp otherResourcesRegExp = new RegExp(r"// OtherResources=(.*)"); |
1689 RegExp packageRootRegExp = new RegExp(r"// PackageRoot=(.*)"); | 1686 RegExp packageRootRegExp = new RegExp(r"// PackageRoot=(.*)"); |
1690 RegExp packagesRegExp = new RegExp(r"// Packages=(.*)"); | 1687 RegExp packagesRegExp = new RegExp(r"// Packages=(.*)"); |
1691 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); | 1688 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 "otherScripts": otherScripts, | 1794 "otherScripts": otherScripts, |
1798 "otherResources": otherResources, | 1795 "otherResources": otherResources, |
1799 "isMultitest": isMultitest, | 1796 "isMultitest": isMultitest, |
1800 "isMultiHtmlTest": isMultiHtmlTest, | 1797 "isMultiHtmlTest": isMultiHtmlTest, |
1801 "subtestNames": subtestNames, | 1798 "subtestNames": subtestNames, |
1802 "isolateStubs": isolateStubs, | 1799 "isolateStubs": isolateStubs, |
1803 "containsDomImport": containsDomImport | 1800 "containsDomImport": containsDomImport |
1804 }; | 1801 }; |
1805 } | 1802 } |
1806 | 1803 |
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 | |
1826 List<List<String>> getVmOptions(Map optionsFromFile) { | 1804 List<List<String>> getVmOptions(Map optionsFromFile) { |
1827 var COMPILERS = const ['none', 'precompiler', 'dart2app', 'dart2appjit']; | 1805 var COMPILERS = const ['none', 'precompiler', 'dart2app', 'dart2appjit']; |
1828 var RUNTIMES = const [ | 1806 var RUNTIMES = const [ |
1829 'none', | 1807 'none', |
1830 'dart_precompiled', | 1808 'dart_precompiled', |
1831 'dart_app', | 1809 'dart_app', |
1832 'vm', | 1810 'vm', |
1833 'drt', | 1811 'drt', |
1834 'dartium', | 1812 'dartium', |
1835 'ContentShellOnAndroid', | 1813 'ContentShellOnAndroid', |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2526 } | 2504 } |
2527 if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) { | 2505 if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) { |
2528 ++shortNameCounter; | 2506 ++shortNameCounter; |
2529 var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH); | 2507 var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH); |
2530 path = "short${shortNameCounter}_$pathEnd"; | 2508 path = "short${shortNameCounter}_$pathEnd"; |
2531 } | 2509 } |
2532 } | 2510 } |
2533 return path; | 2511 return path; |
2534 } | 2512 } |
2535 } | 2513 } |
OLD | NEW |