| 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; |
| 630 // Multitests are in [build directory]/generated_tests/... . | 632 // Multitests are in [build directory]/generated_tests/... . |
| 631 // The test name will be '[test filename (no extension)]/[multitest key]. | 633 // The test name will be '[test filename (no extension)]/[multitest key]. |
| 632 String name = filePath.filenameWithoutExtension; | 634 String name = filePath.filenameWithoutExtension; |
| 633 int middle = name.lastIndexOf('_'); | 635 int middle = name.lastIndexOf('_'); |
| 634 testName = '${name.substring(0, middle)}/${name.substring(middle + 1)}'; | 636 testName = '${name.substring(0, middle)}/${name.substring(middle + 1)}'; |
| 635 } else { | 637 } else { |
| 636 // The test name is the relative path from the test suite directory to | 638 // The test name is the relative path from the test suite directory to |
| 637 // the test, with the .dart extension removed. | 639 // the test, with the .dart extension removed. |
| 638 Expect.isTrue(filePath.toNativePath().startsWith( | 640 Expect.isTrue(filePath.toNativePath().startsWith( |
| 639 suiteDir.toNativePath())); | 641 suiteDir.toNativePath())); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 Object expectations, | 828 Object expectations, |
| 827 bool isWrappingRequired) { | 829 bool isWrappingRequired) { |
| 828 // TODO(kustermann/ricow): This method should be refactored. | 830 // TODO(kustermann/ricow): This method should be refactored. |
| 829 Map optionsFromFile = info.optionsFromFile; | 831 Map optionsFromFile = info.optionsFromFile; |
| 830 Path filePath = info.filePath; | 832 Path filePath = info.filePath; |
| 831 String filename = filePath.toString(); | 833 String filename = filePath.toString(); |
| 832 bool isWebTest = optionsFromFile['containsDomImport']; | 834 bool isWebTest = optionsFromFile['containsDomImport']; |
| 833 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition']; | 835 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition']; |
| 834 if (isWrappingRequired | 836 if (isWrappingRequired |
| 835 && !isLibraryDefinition && optionsFromFile['containsSourceOrImport']) { | 837 && !isLibraryDefinition && optionsFromFile['containsSourceOrImport']) { |
| 836 print('Warning for $filename: Browser tests require "library" ' | 838 print('Warning for $filename: Browser tests require #library ' |
| 837 'in any file that uses "import" or "source". ' | 839 'in any file that uses #import, #source, or #resource'); |
| 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 |