| 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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 963       if (pubspecYamlFile != null) { | 963       if (pubspecYamlFile != null) { | 
| 964         var result = buildSpecialPackageRoot(pubspecYamlFile); | 964         var result = buildSpecialPackageRoot(pubspecYamlFile); | 
| 965         baseCommands.addAll(result['commands']); | 965         baseCommands.addAll(result['commands']); | 
| 966         packageRoot = result['package-root']; | 966         packageRoot = result['package-root']; | 
| 967         if (optionsFromFile['packageRoot'] == null || | 967         if (optionsFromFile['packageRoot'] == null || | 
| 968             optionsFromFile['packageRoot'] == "") { | 968             optionsFromFile['packageRoot'] == "") { | 
| 969           optionsFromFile['packageRoot'] = packageRoot.toNativePath(); | 969           optionsFromFile['packageRoot'] = packageRoot.toNativePath(); | 
| 970         } | 970         } | 
| 971       } | 971       } | 
| 972     } | 972     } | 
| 973     if (configuration['package_root'] != null) { | 973     if (optionsFromFile['packageRoot'] == null && | 
| 974       packageRoot = new Path(configuration['package_root']); | 974         optionsFromFile['packages'] == null) { | 
| 975       optionsFromFile['packageRoot'] = packageRoot.toNativePath(); | 975       if (configuration['package_root'] != null) { | 
|  | 976         packageRoot = new Path(configuration['package_root']); | 
|  | 977         optionsFromFile['packageRoot'] = packageRoot.toNativePath(); | 
|  | 978       } | 
|  | 979       if (configuration['packages'] != null) { | 
|  | 980         Path packages = new Path(configuration['packages']); | 
|  | 981         optionsFromFile['packages'] = packages.toNativePath(); | 
|  | 982       } | 
| 976     } | 983     } | 
| 977     if (configuration['packages'] != null) { |  | 
| 978       Path packages = new Path(configuration['packages']); |  | 
| 979       optionsFromFile['packages'] = packages.toNativePath(); |  | 
| 980     } |  | 
| 981 |  | 
| 982     if (new CompilerConfiguration(configuration).hasCompiler && | 984     if (new CompilerConfiguration(configuration).hasCompiler && | 
| 983         expectCompileError(info)) { | 985         expectCompileError(info)) { | 
| 984       // If a compile-time error is expected, and we're testing a | 986       // If a compile-time error is expected, and we're testing a | 
| 985       // compiler, we never need to attempt to run the program (in a | 987       // compiler, we never need to attempt to run the program (in a | 
| 986       // browser or otherwise). | 988       // browser or otherwise). | 
| 987       enqueueStandardTest(baseCommands, info, testName, expectations); | 989       enqueueStandardTest(baseCommands, info, testName, expectations); | 
| 988     } else if (TestUtils.isBrowserRuntime(configuration['runtime'])) { | 990     } else if (TestUtils.isBrowserRuntime(configuration['runtime'])) { | 
| 989       if (info.optionsFromFile['isMultiHtmlTest']) { | 991       if (info.optionsFromFile['isMultiHtmlTest']) { | 
| 990         // A browser multi-test has multiple expectations for one test file. | 992         // A browser multi-test has multiple expectations for one test file. | 
| 991         // Find all the different sub-test expecations for one entire test file. | 993         // Find all the different sub-test expecations for one entire test file. | 
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1578     args.add(filePath.toNativePath()); | 1580     args.add(filePath.toNativePath()); | 
| 1579     if (dartOptions != null) { | 1581     if (dartOptions != null) { | 
| 1580       args.addAll(dartOptions); | 1582       args.addAll(dartOptions); | 
| 1581     } | 1583     } | 
| 1582 | 1584 | 
| 1583     return args; | 1585     return args; | 
| 1584   } | 1586   } | 
| 1585 | 1587 | 
| 1586   String packagesArgument(String packageRootFromFile, | 1588   String packagesArgument(String packageRootFromFile, | 
| 1587                              String packagesFromFile) { | 1589                              String packagesFromFile) { | 
| 1588     if (packagesFromFile != null) { | 1590     if (packageRootFromFile == 'none' || | 
|  | 1591         packagesFromFile == 'none') { | 
|  | 1592       return null; | 
|  | 1593     } else if (packagesFromFile != null) { | 
| 1589       return '--packages=$packagesFromFile'; | 1594       return '--packages=$packagesFromFile'; | 
| 1590     } else if (packageRootFromFile != null && packageRootFromFile != 'none') { | 1595     } else if (packageRootFromFile != null) { | 
| 1591       return '--package-root=$packageRootFromFile'; | 1596       return '--package-root=$packageRootFromFile'; | 
| 1592     } else { | 1597     } else { | 
| 1593     return null; | 1598     return null; | 
| 1594     } | 1599     } | 
| 1595   } | 1600   } | 
| 1596 | 1601 | 
| 1597   /** | 1602   /** | 
| 1598    * Special options for individual tests are currently specified in various | 1603    * Special options for individual tests are currently specified in various | 
| 1599    * ways: with comments directly in test files, by using certain imports, or by | 1604    * ways: with comments directly in test files, by using certain imports, or by | 
| 1600    * creating additional files in the test directories. | 1605    * creating additional files in the test directories. | 
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1705     for (var match in matches) { | 1710     for (var match in matches) { | 
| 1706       if (sharedOptions != null) { | 1711       if (sharedOptions != null) { | 
| 1707         throw new Exception( | 1712         throw new Exception( | 
| 1708             'More than one "// SharedOptions=" line in test $filePath'); | 1713             'More than one "// SharedOptions=" line in test $filePath'); | 
| 1709       } | 1714       } | 
| 1710       sharedOptions = match[1].split(' ').where((e) => e != '').toList(); | 1715       sharedOptions = match[1].split(' ').where((e) => e != '').toList(); | 
| 1711     } | 1716     } | 
| 1712 | 1717 | 
| 1713     matches = packageRootRegExp.allMatches(contents); | 1718     matches = packageRootRegExp.allMatches(contents); | 
| 1714     for (var match in matches) { | 1719     for (var match in matches) { | 
| 1715       if (packageRoot != null) { | 1720       if (packageRoot != null || packages != null) { | 
| 1716         throw new Exception( | 1721         throw new Exception( | 
| 1717             'More than one "// PackageRoot=" line in test $filePath'); | 1722             'More than one "// Package... line in test $filePath'); | 
| 1718       } | 1723       } | 
| 1719       packageRoot = match[1]; | 1724       packageRoot = match[1]; | 
| 1720       if (packageRoot != 'none') { | 1725       if (packageRoot != 'none') { | 
| 1721         // PackageRoot=none means that no package-root option should be given. | 1726         // PackageRoot=none means that no packages or package-root option | 
|  | 1727         // should be given. Any other value overrides package-root and | 
|  | 1728         // removes any packages option.  Don't use with // Packages=. | 
| 1722         packageRoot = '${filePath.directoryPath.join(new Path(packageRoot))}'; | 1729         packageRoot = '${filePath.directoryPath.join(new Path(packageRoot))}'; | 
| 1723       } | 1730       } | 
| 1724     } | 1731     } | 
| 1725 | 1732 | 
| 1726     matches = packagesRegExp.allMatches(contents); | 1733     matches = packagesRegExp.allMatches(contents); | 
| 1727     for (var match in matches) { | 1734     for (var match in matches) { | 
| 1728       if (packages != null) { | 1735       if (packages != null || packageRoot != null) { | 
| 1729         throw new Exception( | 1736         throw new Exception( | 
| 1730             'More than one "// Packages=" line in test $filePath'); | 1737             'More than one "// Package..." line in test $filePath'); | 
| 1731       } | 1738       } | 
| 1732       packages = match[1]; | 1739       packages = match[1]; | 
| 1733       if (packages != 'none') { | 1740       if (packages != 'none') { | 
| 1734         // Packages=none means that no packages option should be given. | 1741         // Packages=none means that no packages or package-root option | 
|  | 1742         // should be given. Any other value overrides packages and removes | 
|  | 1743         // any package-root option. Don't use with // PackageRoot=. | 
| 1735         packages = '${filePath.directoryPath.join(new Path(packages))}'; | 1744         packages = '${filePath.directoryPath.join(new Path(packages))}'; | 
| 1736       } | 1745       } | 
| 1737     } | 1746     } | 
| 1738 | 1747 | 
| 1739     List<String> otherScripts = new List<String>(); | 1748     List<String> otherScripts = new List<String>(); | 
| 1740     matches = otherScriptsRegExp.allMatches(contents); | 1749     matches = otherScriptsRegExp.allMatches(contents); | 
| 1741     for (var match in matches) { | 1750     for (var match in matches) { | 
| 1742       otherScripts.addAll(match[1].split(' ').where((e) => e != '').toList()); | 1751       otherScripts.addAll(match[1].split(' ').where((e) => e != '').toList()); | 
| 1743     } | 1752     } | 
| 1744 | 1753 | 
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2476       } | 2485       } | 
| 2477       if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) { | 2486       if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) { | 
| 2478         ++shortNameCounter; | 2487         ++shortNameCounter; | 
| 2479         var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH); | 2488         var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH); | 
| 2480         path = "short${shortNameCounter}_$pathEnd"; | 2489         path = "short${shortNameCounter}_$pathEnd"; | 
| 2481       } | 2490       } | 
| 2482     } | 2491     } | 
| 2483     return path; | 2492     return path; | 
| 2484   } | 2493   } | 
| 2485 } | 2494 } | 
| OLD | NEW | 
|---|