| 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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 */ | 640 */ |
| 641 factory StandardTestSuite.forDirectory( | 641 factory StandardTestSuite.forDirectory( |
| 642 Map configuration, Path directory, {List<String> statusFilePaths}) { | 642 Map configuration, Path directory, {List<String> statusFilePaths}) { |
| 643 var name = directory.filename; | 643 var name = directory.filename; |
| 644 if (statusFilePaths == null) { | 644 if (statusFilePaths == null) { |
| 645 statusFilePaths = ['$directory/$name.status', | 645 statusFilePaths = ['$directory/$name.status', |
| 646 '$directory/.status', | 646 '$directory/.status', |
| 647 '$directory/${name}_dart2js.status', | 647 '$directory/${name}_dart2js.status', |
| 648 '$directory/${name}_analyzer.status', | 648 '$directory/${name}_analyzer.status', |
| 649 '$directory/${name}_analyzer2.status', | 649 '$directory/${name}_analyzer2.status', |
| 650 '$directory/${name}_fletchc.status']; | 650 '$directory/${name}_dartino_compiler.status']; |
| 651 } | 651 } |
| 652 | 652 |
| 653 return new StandardTestSuite(configuration, | 653 return new StandardTestSuite(configuration, |
| 654 name, directory, | 654 name, directory, |
| 655 statusFilePaths, | 655 statusFilePaths, |
| 656 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), | 656 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), |
| 657 recursive: true); | 657 recursive: true); |
| 658 } | 658 } |
| 659 | 659 |
| 660 List<Uri> get dart2JsBootstrapDependencies { | 660 List<Uri> get dart2JsBootstrapDependencies { |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 | 987 |
| 988 CommandArtifact compilationArtifact = | 988 CommandArtifact compilationArtifact = |
| 989 compilerConfiguration.computeCompilationArtifact( | 989 compilerConfiguration.computeCompilationArtifact( |
| 990 buildDir, | 990 buildDir, |
| 991 tempDir, | 991 tempDir, |
| 992 CommandBuilder.instance, | 992 CommandBuilder.instance, |
| 993 compileTimeArguments, | 993 compileTimeArguments, |
| 994 environmentOverrides); | 994 environmentOverrides); |
| 995 commands.addAll(compilationArtifact.commands); | 995 commands.addAll(compilationArtifact.commands); |
| 996 | 996 |
| 997 // NOTE: Since fletchc does not report compile time errors at compile time, | 997 // NOTE: Since dartino_compiler does not report compile time errors at compi
le time, |
| 998 // but rather generates code to call 'lib/system/system.dart:compileError()` | 998 // but rather generates code to call 'lib/system/system.dart:compileError()` |
| 999 // We need to enqueue running the snapshot. | 999 // We need to enqueue running the snapshot. |
| 1000 // | 1000 // |
| 1001 // if (expectCompileError(info) && compilerConfiguration.hasCompiler) { | 1001 // if (expectCompileError(info) && compilerConfiguration.hasCompiler) { |
| 1002 // // Do not attempt to run the compiled result. A compilation | 1002 // // Do not attempt to run the compiled result. A compilation |
| 1003 // // error should be reported by the compilation command. | 1003 // // error should be reported by the compilation command. |
| 1004 // return commands; | 1004 // return commands; |
| 1005 // } | 1005 // } |
| 1006 | 1006 |
| 1007 RuntimeConfiguration runtimeConfiguration = | 1007 RuntimeConfiguration runtimeConfiguration = |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 * executing the copy command printed by the test script. | 1523 * executing the copy command printed by the test script. |
| 1524 * | 1524 * |
| 1525 * This method is static as the map is cached and shared amongst | 1525 * This method is static as the map is cached and shared amongst |
| 1526 * configurations, so it may not use [configuration]. | 1526 * configurations, so it may not use [configuration]. |
| 1527 */ | 1527 */ |
| 1528 Map readOptionsFromFile(Path filePath) { | 1528 Map readOptionsFromFile(Path filePath) { |
| 1529 if (filePath.segments().contains('co19')) { | 1529 if (filePath.segments().contains('co19')) { |
| 1530 return readOptionsFromCo19File(filePath); | 1530 return readOptionsFromCo19File(filePath); |
| 1531 } | 1531 } |
| 1532 RegExp testOptionsRegExp = new RegExp(r"// VMOptions=(.*)"); | 1532 RegExp testOptionsRegExp = new RegExp(r"// VMOptions=(.*)"); |
| 1533 RegExp fletchOptionsRegExp = new RegExp(r"// FletchOptions=(.*)"); | 1533 RegExp dartinoOptionsRegExp = new RegExp(r"// DartinoOptions=(.*)"); |
| 1534 RegExp fletchSnapshotRegExp | 1534 RegExp dartinoSnapshotRegExp |
| 1535 = new RegExp(r"// FletchSnapshotOptions=(.*)"); | 1535 = new RegExp(r"// DartinoSnapshotOptions=(.*)"); |
| 1536 RegExp fletchCCRegExp = new RegExp(r"// FletchCCOptions=(.*)"); | 1536 RegExp dartinoCCRegExp = new RegExp(r"// DartinoCCOptions=(.*)"); |
| 1537 RegExp sharedOptionsRegExp = new RegExp(r"// SharedOptions=(.*)"); | 1537 RegExp sharedOptionsRegExp = new RegExp(r"// SharedOptions=(.*)"); |
| 1538 RegExp dartOptionsRegExp = new RegExp(r"// DartOptions=(.*)"); | 1538 RegExp dartOptionsRegExp = new RegExp(r"// DartOptions=(.*)"); |
| 1539 RegExp otherScriptsRegExp = new RegExp(r"// OtherScripts=(.*)"); | 1539 RegExp otherScriptsRegExp = new RegExp(r"// OtherScripts=(.*)"); |
| 1540 RegExp packageRootRegExp = new RegExp(r"// PackageRoot=(.*)"); | 1540 RegExp packageRootRegExp = new RegExp(r"// PackageRoot=(.*)"); |
| 1541 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); | 1541 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); |
| 1542 // TODO(gram) Clean these up once the old directives are not supported. | 1542 // TODO(gram) Clean these up once the old directives are not supported. |
| 1543 RegExp domImportRegExp = | 1543 RegExp domImportRegExp = |
| 1544 new RegExp(r"^[#]?import.*dart:(html|web_audio|indexed_db|svg|web_sql)", | 1544 new RegExp(r"^[#]?import.*dart:(html|web_audio|indexed_db|svg|web_sql)", |
| 1545 multiLine: true); | 1545 multiLine: true); |
| 1546 | 1546 |
| 1547 var bytes = new File(filePath.toNativePath()).readAsBytesSync(); | 1547 var bytes = new File(filePath.toNativePath()).readAsBytesSync(); |
| 1548 String contents = decodeUtf8(bytes); | 1548 String contents = decodeUtf8(bytes); |
| 1549 bytes = null; | 1549 bytes = null; |
| 1550 | 1550 |
| 1551 // Find the options in the file. | 1551 // Find the options in the file. |
| 1552 List<List> result = new List<List>(); | 1552 List<List> result = new List<List>(); |
| 1553 List<List> fletchOptions = new List<List>(); | 1553 List<List> dartinoOptions = new List<List>(); |
| 1554 List<String> fletchSnapshotOptions; | 1554 List<String> dartinoSnapshotOptions; |
| 1555 List<String> dartOptions; | 1555 List<String> dartOptions; |
| 1556 List<String> sharedOptions; | 1556 List<String> sharedOptions; |
| 1557 List<String> fletchCCOptions; | 1557 List<String> dartinoCCOptions; |
| 1558 String packageRoot; | 1558 String packageRoot; |
| 1559 | 1559 |
| 1560 Iterable<Match> matches = testOptionsRegExp.allMatches(contents); | 1560 Iterable<Match> matches = testOptionsRegExp.allMatches(contents); |
| 1561 for (var match in matches) { | 1561 for (var match in matches) { |
| 1562 result.add(match[1].split(' ').where((e) => e != '').toList()); | 1562 result.add(match[1].split(' ').where((e) => e != '').toList()); |
| 1563 } | 1563 } |
| 1564 if (result.isEmpty) result.add([]); | 1564 if (result.isEmpty) result.add([]); |
| 1565 | 1565 |
| 1566 matches = fletchOptionsRegExp.allMatches(contents); | 1566 matches = dartinoOptionsRegExp.allMatches(contents); |
| 1567 for (var match in matches) { | 1567 for (var match in matches) { |
| 1568 fletchOptions.add(match[1].split(' ').where((e) => e != '').toList()); | 1568 dartinoOptions.add(match[1].split(' ').where((e) => e != '').toList()); |
| 1569 } | 1569 } |
| 1570 if (fletchOptions.isEmpty) fletchOptions.add([]); | 1570 if (dartinoOptions.isEmpty) dartinoOptions.add([]); |
| 1571 | 1571 |
| 1572 matches = dartOptionsRegExp.allMatches(contents); | 1572 matches = dartOptionsRegExp.allMatches(contents); |
| 1573 for (var match in matches) { | 1573 for (var match in matches) { |
| 1574 if (dartOptions != null) { | 1574 if (dartOptions != null) { |
| 1575 throw new Exception( | 1575 throw new Exception( |
| 1576 'More than one "// DartOptions=" line in test $filePath'); | 1576 'More than one "// DartOptions=" line in test $filePath'); |
| 1577 } | 1577 } |
| 1578 dartOptions = match[1].split(' ').where((e) => e != '').toList(); | 1578 dartOptions = match[1].split(' ').where((e) => e != '').toList(); |
| 1579 } | 1579 } |
| 1580 | 1580 |
| 1581 matches = fletchCCRegExp.allMatches(contents); | 1581 matches = dartinoCCRegExp.allMatches(contents); |
| 1582 for (var match in matches) { | 1582 for (var match in matches) { |
| 1583 if (fletchCCOptions != null) { | 1583 if (dartinoCCOptions != null) { |
| 1584 throw new Exception( | 1584 throw new Exception( |
| 1585 'More than one "// FletchCCOptions=" line in test $filePath'); | 1585 'More than one "// DartinoCCOptions=" line in test $filePath'); |
| 1586 } | 1586 } |
| 1587 fletchCCOptions = match[1].split(' ').where((e) => e != '').toList(); | 1587 dartinoCCOptions = match[1].split(' ').where((e) => e != '').toList(); |
| 1588 } | 1588 } |
| 1589 | 1589 |
| 1590 matches = fletchSnapshotRegExp.allMatches(contents); | 1590 matches = dartinoSnapshotRegExp.allMatches(contents); |
| 1591 for (var match in matches) { | 1591 for (var match in matches) { |
| 1592 if (fletchSnapshotOptions != null) { | 1592 if (dartinoSnapshotOptions != null) { |
| 1593 throw new Exception( | 1593 throw new Exception( |
| 1594 'More than one "// FletchSnapshotOptions=" line in test $filePath'); | 1594 'More than one "// DartinoSnapshotOptions=" line in test $filePath')
; |
| 1595 } | 1595 } |
| 1596 fletchSnapshotOptions = | 1596 dartinoSnapshotOptions = |
| 1597 match[1].split(' ').where((e) => e != '').toList(); | 1597 match[1].split(' ').where((e) => e != '').toList(); |
| 1598 if (fletchSnapshotOptions.length != 2) { | 1598 if (dartinoSnapshotOptions.length != 2) { |
| 1599 throw new Exception( | 1599 throw new Exception( |
| 1600 '// "FletchSnapshotOptions=" takes two arguments in $filePath'); | 1600 '// "DartinoSnapshotOptions=" takes two arguments in $filePath'); |
| 1601 } | 1601 } |
| 1602 } | 1602 } |
| 1603 | 1603 |
| 1604 matches = sharedOptionsRegExp.allMatches(contents); | 1604 matches = sharedOptionsRegExp.allMatches(contents); |
| 1605 for (var match in matches) { | 1605 for (var match in matches) { |
| 1606 if (sharedOptions != null) { | 1606 if (sharedOptions != null) { |
| 1607 throw new Exception( | 1607 throw new Exception( |
| 1608 'More than one "// SharedOptions=" line in test $filePath'); | 1608 'More than one "// SharedOptions=" line in test $filePath'); |
| 1609 } | 1609 } |
| 1610 sharedOptions = match[1].split(' ').where((e) => e != '').toList(); | 1610 sharedOptions = match[1].split(' ').where((e) => e != '').toList(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1637 | 1637 |
| 1638 List<String> subtestNames = []; | 1638 List<String> subtestNames = []; |
| 1639 Iterator matchesIter = | 1639 Iterator matchesIter = |
| 1640 multiHtmlTestGroupRegExp.allMatches(contents).iterator; | 1640 multiHtmlTestGroupRegExp.allMatches(contents).iterator; |
| 1641 while(matchesIter.moveNext() && isMultiHtmlTest) { | 1641 while(matchesIter.moveNext() && isMultiHtmlTest) { |
| 1642 String fullMatch = matchesIter.current.group(0); | 1642 String fullMatch = matchesIter.current.group(0); |
| 1643 subtestNames.add(fullMatch.substring(fullMatch.indexOf("'") + 1)); | 1643 subtestNames.add(fullMatch.substring(fullMatch.indexOf("'") + 1)); |
| 1644 } | 1644 } |
| 1645 | 1645 |
| 1646 return { "vmOptions": result, | 1646 return { "vmOptions": result, |
| 1647 "fletchOptions": fletchOptions, | 1647 "dartinoOptions": dartinoOptions, |
| 1648 "fletchSnapshotOptions": fletchSnapshotOptions, | 1648 "dartinoSnapshotOptions": dartinoSnapshotOptions, |
| 1649 "fletchCCOptions": fletchCCOptions, | 1649 "dartinoCCOptions": dartinoCCOptions, |
| 1650 "sharedOptions": sharedOptions == null ? [] : sharedOptions, | 1650 "sharedOptions": sharedOptions == null ? [] : sharedOptions, |
| 1651 "dartOptions": dartOptions, | 1651 "dartOptions": dartOptions, |
| 1652 "packageRoot": packageRoot, | 1652 "packageRoot": packageRoot, |
| 1653 "hasCompileError": false, | 1653 "hasCompileError": false, |
| 1654 "hasRuntimeError": false, | 1654 "hasRuntimeError": false, |
| 1655 "hasStaticWarning" : false, | 1655 "hasStaticWarning" : false, |
| 1656 "otherScripts": otherScripts, | 1656 "otherScripts": otherScripts, |
| 1657 "isMultitest": isMultitest, | 1657 "isMultitest": isMultitest, |
| 1658 "isMultiHtmlTest": isMultiHtmlTest, | 1658 "isMultiHtmlTest": isMultiHtmlTest, |
| 1659 "subtestNames": subtestNames, | 1659 "subtestNames": subtestNames, |
| 1660 "isolateStubs": isolateStubs, | 1660 "isolateStubs": isolateStubs, |
| 1661 "containsDomImport": containsDomImport }; | 1661 "containsDomImport": containsDomImport }; |
| 1662 } | 1662 } |
| 1663 | 1663 |
| 1664 List<List<String>> getVmOptions(Map optionsFromFile) { | 1664 List<List<String>> getVmOptions(Map optionsFromFile) { |
| 1665 if (['fletchc', 'fletchvm'].contains(configuration['runtime'])) { | 1665 if (['dartino_compiler', 'dartinovm'].contains(configuration['runtime'])) { |
| 1666 return optionsFromFile['fletchOptions']; | 1666 return optionsFromFile['dartinoOptions']; |
| 1667 } | 1667 } |
| 1668 | 1668 |
| 1669 var vmOptions = optionsFromFile['vmOptiosn']; | 1669 var vmOptions = optionsFromFile['vmOptiosn']; |
| 1670 var COMPILERS = const ['none', 'dart2dart']; | 1670 var COMPILERS = const ['none', 'dart2dart']; |
| 1671 var RUNTIMES = const ['none', 'vm', 'drt', 'dartium', | 1671 var RUNTIMES = const ['none', 'vm', 'drt', 'dartium', |
| 1672 'ContentShellOnAndroid', 'DartiumOnAndroid']; | 1672 'ContentShellOnAndroid', 'DartiumOnAndroid']; |
| 1673 var needsVmOptions = COMPILERS.contains(configuration['compiler']) && | 1673 var needsVmOptions = COMPILERS.contains(configuration['compiler']) && |
| 1674 RUNTIMES.contains(configuration['runtime']); | 1674 RUNTIMES.contains(configuration['runtime']); |
| 1675 if (!needsVmOptions) return [[]]; | 1675 if (!needsVmOptions) return [[]]; |
| 1676 if (configuration['compiler'] != 'dart2dart') return vmOptions; | 1676 if (configuration['compiler'] != 'dart2dart') return vmOptions; |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2342 * $pass tests are expected to pass | 2342 * $pass tests are expected to pass |
| 2343 * $failOk tests are expected to fail that we won't fix | 2343 * $failOk tests are expected to fail that we won't fix |
| 2344 * $fail tests are expected to fail that we should fix | 2344 * $fail tests are expected to fail that we should fix |
| 2345 * $crash tests are expected to crash that we should fix | 2345 * $crash tests are expected to crash that we should fix |
| 2346 * $timeout tests are allowed to timeout | 2346 * $timeout tests are allowed to timeout |
| 2347 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 2347 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 2348 """; | 2348 """; |
| 2349 print(report); | 2349 print(report); |
| 2350 } | 2350 } |
| 2351 } | 2351 } |
| OLD | NEW |