| 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 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 * the main script using 'test_suite.dart' is not there, the main | 1496 * the main script using 'test_suite.dart' is not there, the main |
| 1497 * script must set this to '.../dart/tools/test.dart'. | 1497 * script must set this to '.../dart/tools/test.dart'. |
| 1498 */ | 1498 */ |
| 1499 static String testScriptPath = new Options().script; | 1499 static String testScriptPath = new Options().script; |
| 1500 | 1500 |
| 1501 /** | 1501 /** |
| 1502 * Creates a directory using a [relativePath] to an existing | 1502 * Creates a directory using a [relativePath] to an existing |
| 1503 * [base] directory if that [relativePath] does not already exist. | 1503 * [base] directory if that [relativePath] does not already exist. |
| 1504 */ | 1504 */ |
| 1505 static Directory mkdirRecursive(Path base, Path relativePath) { | 1505 static Directory mkdirRecursive(Path base, Path relativePath) { |
| 1506 if (relativePath.isAbsolute) { |
| 1507 base = new Path('/'); |
| 1508 } |
| 1506 Directory dir = new Directory.fromPath(base); | 1509 Directory dir = new Directory.fromPath(base); |
| 1507 Expect.isTrue(dir.existsSync(), | 1510 Expect.isTrue(dir.existsSync(), |
| 1508 "Expected ${dir} to already exist"); | 1511 "Expected ${dir} to already exist"); |
| 1509 var segments = relativePath.segments(); | 1512 var segments = relativePath.segments(); |
| 1510 for (String segment in segments) { | 1513 for (String segment in segments) { |
| 1511 base = base.append(segment); | 1514 base = base.append(segment); |
| 1512 dir = new Directory.fromPath(base); | 1515 dir = new Directory.fromPath(base); |
| 1513 if (!dir.existsSync()) { | 1516 if (!dir.existsSync()) { |
| 1514 dir.createSync(); | 1517 dir.createSync(); |
| 1515 } | 1518 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1538 // waterfall UI. | 1541 // waterfall UI. |
| 1539 return ".flaky.log"; | 1542 return ".flaky.log"; |
| 1540 } | 1543 } |
| 1541 | 1544 |
| 1542 static void ensureExists(String filename, Map configuration) { | 1545 static void ensureExists(String filename, Map configuration) { |
| 1543 if (!configuration['list'] && !(new File(filename).existsSync())) { | 1546 if (!configuration['list'] && !(new File(filename).existsSync())) { |
| 1544 throw "Executable '$filename' does not exist"; | 1547 throw "Executable '$filename' does not exist"; |
| 1545 } | 1548 } |
| 1546 } | 1549 } |
| 1547 | 1550 |
| 1548 static String outputDir(Map configuration) { | |
| 1549 var result = ''; | |
| 1550 var system = configuration['system']; | |
| 1551 if (system == 'linux') { | |
| 1552 result = 'out/'; | |
| 1553 } else if (system == 'macos') { | |
| 1554 result = 'xcodebuild/'; | |
| 1555 } else if (system == 'windows') { | |
| 1556 result = 'build/'; | |
| 1557 } | |
| 1558 return result; | |
| 1559 } | |
| 1560 | |
| 1561 static Path dartDir() { | 1551 static Path dartDir() { |
| 1562 File scriptFile = new File(testScriptPath); | 1552 File scriptFile = new File(testScriptPath); |
| 1563 Path scriptPath = new Path.fromNative(scriptFile.fullPathSync()); | 1553 Path scriptPath = new Path.fromNative(scriptFile.fullPathSync()); |
| 1564 return scriptPath.directoryPath.directoryPath; | 1554 return scriptPath.directoryPath.directoryPath; |
| 1565 } | 1555 } |
| 1566 | 1556 |
| 1567 static List<String> standardOptions(Map configuration) { | 1557 static List<String> standardOptions(Map configuration) { |
| 1568 List args = ["--ignore-unrecognized-flags"]; | 1558 List args = ["--ignore-unrecognized-flags"]; |
| 1569 if (configuration["checked"]) { | 1559 if (configuration["checked"]) { |
| 1570 args.add('--enable_asserts'); | 1560 args.add('--enable_asserts'); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1601 return BROWSERS.contains(runtime); | 1591 return BROWSERS.contains(runtime); |
| 1602 } | 1592 } |
| 1603 | 1593 |
| 1604 static bool isBrowserRuntime(String runtime) => | 1594 static bool isBrowserRuntime(String runtime) => |
| 1605 runtime == 'drt' || TestUtils.usesWebDriver(runtime); | 1595 runtime == 'drt' || TestUtils.usesWebDriver(runtime); |
| 1606 | 1596 |
| 1607 static bool isJsCommandLineRuntime(String runtime) => | 1597 static bool isJsCommandLineRuntime(String runtime) => |
| 1608 const ['d8', 'jsshell'].contains(runtime); | 1598 const ['d8', 'jsshell'].contains(runtime); |
| 1609 | 1599 |
| 1610 static String buildDir(Map configuration) { | 1600 static String buildDir(Map configuration) { |
| 1601 if (configuration['build_directory'] != '') { |
| 1602 return configuration['build_directory']; |
| 1603 } |
| 1604 var outputDir = ''; |
| 1605 var system = configuration['system']; |
| 1606 if (system == 'linux') { |
| 1607 outputDir = 'out/'; |
| 1608 } else if (system == 'macos') { |
| 1609 outputDir = 'xcodebuild/'; |
| 1610 } else if (system == 'windows') { |
| 1611 outputDir = 'build/'; |
| 1612 } |
| 1611 var mode = (configuration['mode'] == 'debug') ? 'Debug' : 'Release'; | 1613 var mode = (configuration['mode'] == 'debug') ? 'Debug' : 'Release'; |
| 1612 var arch = configuration['arch'].toUpperCase(); | 1614 var arch = configuration['arch'].toUpperCase(); |
| 1613 return "${TestUtils.outputDir(configuration)}$mode$arch"; | 1615 return "$outputDir$mode$arch"; |
| 1614 } | 1616 } |
| 1615 } | 1617 } |
| 1616 | 1618 |
| 1617 class SummaryReport { | 1619 class SummaryReport { |
| 1618 static int total = 0; | 1620 static int total = 0; |
| 1619 static int skipped = 0; | 1621 static int skipped = 0; |
| 1620 static int noCrash = 0; | 1622 static int noCrash = 0; |
| 1621 static int pass = 0; | 1623 static int pass = 0; |
| 1622 static int failOk = 0; | 1624 static int failOk = 0; |
| 1623 static int fail = 0; | 1625 static int fail = 0; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 * $pass tests are expected to pass | 1667 * $pass tests are expected to pass |
| 1666 * $failOk tests are expected to fail that we won't fix | 1668 * $failOk tests are expected to fail that we won't fix |
| 1667 * $fail tests are expected to fail that we should fix | 1669 * $fail tests are expected to fail that we should fix |
| 1668 * $crash tests are expected to crash that we should fix | 1670 * $crash tests are expected to crash that we should fix |
| 1669 * $timeout tests are allowed to timeout | 1671 * $timeout tests are allowed to timeout |
| 1670 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1672 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 1671 """; | 1673 """; |
| 1672 print(report); | 1674 print(report); |
| 1673 } | 1675 } |
| 1674 } | 1676 } |
| OLD | NEW |