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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 var isNegative = info.hasCompileError; | 620 var isNegative = info.hasCompileError; |
621 if (info.hasRuntimeError && hasRuntime) { | 621 if (info.hasRuntimeError && hasRuntime) { |
622 isNegative = true; | 622 isNegative = true; |
623 } | 623 } |
624 | 624 |
625 // Look up expectations in status files using a test name generated | 625 // Look up expectations in status files using a test name generated |
626 // from the test file's path. | 626 // from the test file's path. |
627 String testName; | 627 String testName; |
628 | 628 |
629 if (optionsFromFile['isMultitest']) { | 629 if (optionsFromFile['isMultitest']) { |
630 // Multitests do not run on browsers. | |
631 if (TestUtils.isBrowserRuntime(configuration['runtime'])) return; | |
632 // Multitests are in [build directory]/generated_tests/... . | 630 // Multitests are in [build directory]/generated_tests/... . |
633 // The test name will be '[test filename (no extension)]/[multitest key]. | 631 // The test name will be '[test filename (no extension)]/[multitest key]. |
634 String name = filePath.filenameWithoutExtension; | 632 String name = filePath.filenameWithoutExtension; |
635 int middle = name.lastIndexOf('_'); | 633 int middle = name.lastIndexOf('_'); |
636 testName = '${name.substring(0, middle)}/${name.substring(middle + 1)}'; | 634 testName = '${name.substring(0, middle)}/${name.substring(middle + 1)}'; |
637 } else { | 635 } else { |
638 // The test name is the relative path from the test suite directory to | 636 // The test name is the relative path from the test suite directory to |
639 // the test, with the .dart extension removed. | 637 // the test, with the .dart extension removed. |
640 Expect.isTrue(filePath.toNativePath().startsWith( | 638 Expect.isTrue(filePath.toNativePath().startsWith( |
641 suiteDir.toNativePath())); | 639 suiteDir.toNativePath())); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 Object expectations, | 826 Object expectations, |
829 bool isWrappingRequired) { | 827 bool isWrappingRequired) { |
830 // TODO(kustermann/ricow): This method should be refactored. | 828 // TODO(kustermann/ricow): This method should be refactored. |
831 Map optionsFromFile = info.optionsFromFile; | 829 Map optionsFromFile = info.optionsFromFile; |
832 Path filePath = info.filePath; | 830 Path filePath = info.filePath; |
833 String filename = filePath.toString(); | 831 String filename = filePath.toString(); |
834 bool isWebTest = optionsFromFile['containsDomImport']; | 832 bool isWebTest = optionsFromFile['containsDomImport']; |
835 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition']; | 833 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition']; |
836 if (isWrappingRequired | 834 if (isWrappingRequired |
837 && !isLibraryDefinition && optionsFromFile['containsSourceOrImport']) { | 835 && !isLibraryDefinition && optionsFromFile['containsSourceOrImport']) { |
838 print('Warning for $filename: Browser tests require #library ' | 836 print('Warning for $filename: Browser tests require "library" ' |
839 'in any file that uses #import, #source, or #resource'); | 837 'in any file that uses "import" or "source". ' |
| 838 'Please mark this test as failing in the status file. ' |
| 839 '(see http://dartbug.com/2264)'); |
840 } | 840 } |
841 | 841 |
842 final String compiler = configuration['compiler']; | 842 final String compiler = configuration['compiler']; |
843 final String runtime = configuration['runtime']; | 843 final String runtime = configuration['runtime']; |
844 | 844 |
845 for (var vmOptions in getVmOptions(optionsFromFile)) { | 845 for (var vmOptions in getVmOptions(optionsFromFile)) { |
846 // Create a unique temporary directory for each set of vmOptions. | 846 // Create a unique temporary directory for each set of vmOptions. |
847 // TODO(dart:429): Replace separate replaceAlls with a RegExp when | 847 // TODO(dart:429): Replace separate replaceAlls with a RegExp when |
848 // replaceAll(RegExp, String) is implemented. | 848 // replaceAll(RegExp, String) is implemented. |
849 String optionsName = ''; | 849 String optionsName = ''; |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 new RegExp(r"/// ([0-9][0-9]:){0,1}\s*compile-time error"); | 1303 new RegExp(r"/// ([0-9][0-9]:){0,1}\s*compile-time error"); |
1304 RegExp staticCleanRegExp = new RegExp(r"// @static-clean"); | 1304 RegExp staticCleanRegExp = new RegExp(r"// @static-clean"); |
1305 RegExp leadingHashRegExp = new RegExp(r"^#", multiLine: true); | 1305 RegExp leadingHashRegExp = new RegExp(r"^#", multiLine: true); |
1306 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); | 1306 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); |
1307 // TODO(gram) Clean these up once the old directives are not supported. | 1307 // TODO(gram) Clean these up once the old directives are not supported. |
1308 RegExp domImportRegExp = | 1308 RegExp domImportRegExp = |
1309 new RegExp(r"^[#]?import.*dart:html", multiLine: true); | 1309 new RegExp(r"^[#]?import.*dart:html", multiLine: true); |
1310 RegExp libraryDefinitionRegExp = | 1310 RegExp libraryDefinitionRegExp = |
1311 new RegExp(r"^[#]?library[\( ]", multiLine: true); | 1311 new RegExp(r"^[#]?library[\( ]", multiLine: true); |
1312 RegExp sourceOrImportRegExp = | 1312 RegExp sourceOrImportRegExp = |
1313 new RegExp("^(#source|#import|part)[ \t]+[\('\"]", multiLine: true); | 1313 new RegExp("^(#?source|#?import|part)[ \t]+[\('\"]", multiLine: true); |
1314 | 1314 |
1315 var bytes = new File.fromPath(filePath).readAsBytesSync(); | 1315 var bytes = new File.fromPath(filePath).readAsBytesSync(); |
1316 String contents = decodeUtf8(bytes); | 1316 String contents = decodeUtf8(bytes); |
1317 bytes = null; | 1317 bytes = null; |
1318 | 1318 |
1319 // Find the options in the file. | 1319 // Find the options in the file. |
1320 List<List> result = new List<List>(); | 1320 List<List> result = new List<List>(); |
1321 List<String> dartOptions; | 1321 List<String> dartOptions; |
1322 String packageRoot; | 1322 String packageRoot; |
1323 bool hasCompileError = contents.contains("@compile-error"); | 1323 bool hasCompileError = contents.contains("@compile-error"); |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 * $pass tests are expected to pass | 1833 * $pass tests are expected to pass |
1834 * $failOk tests are expected to fail that we won't fix | 1834 * $failOk tests are expected to fail that we won't fix |
1835 * $fail tests are expected to fail that we should fix | 1835 * $fail tests are expected to fail that we should fix |
1836 * $crash tests are expected to crash that we should fix | 1836 * $crash tests are expected to crash that we should fix |
1837 * $timeout tests are allowed to timeout | 1837 * $timeout tests are allowed to timeout |
1838 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1838 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
1839 """; | 1839 """; |
1840 print(report); | 1840 print(report); |
1841 } | 1841 } |
1842 } | 1842 } |
OLD | NEW |