| 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 * | 667 * |
| 668 * instead of having to create a custom [StandardTestSuite] subclass. In | 668 * instead of having to create a custom [StandardTestSuite] subclass. In |
| 669 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] | 669 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] |
| 670 * in test.dart, this will all be set up for you. | 670 * in test.dart, this will all be set up for you. |
| 671 */ | 671 */ |
| 672 factory StandardTestSuite.forDirectory(Map configuration, Path directory) { | 672 factory StandardTestSuite.forDirectory(Map configuration, Path directory) { |
| 673 var name = directory.filename; | 673 var name = directory.filename; |
| 674 var status_paths = ['$directory/$name.status', | 674 var status_paths = ['$directory/$name.status', |
| 675 '$directory/.status', | 675 '$directory/.status', |
| 676 '$directory/${name}_dart2js.status', | 676 '$directory/${name}_dart2js.status', |
| 677 '$directory/${name}_analyzer.status', | |
| 678 '$directory/${name}_analyzer2.status']; | 677 '$directory/${name}_analyzer2.status']; |
| 679 | 678 |
| 680 return new StandardTestSuite(configuration, | 679 return new StandardTestSuite(configuration, |
| 681 name, directory, | 680 name, directory, |
| 682 status_paths, | 681 status_paths, |
| 683 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), | 682 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), |
| 684 recursive: true); | 683 recursive: true); |
| 685 } | 684 } |
| 686 | 685 |
| 687 List<Uri> get dart2JsBootstrapDependencies => _dart2JsBootstrapDependencies; | 686 List<Uri> get dart2JsBootstrapDependencies => _dart2JsBootstrapDependencies; |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 | 1494 |
| 1496 return CommandBuilder.instance.getProcessCommand( | 1495 return CommandBuilder.instance.getProcessCommand( |
| 1497 'polymer_deploy', dartVmBinaryFileName, args, environmentOverrides); | 1496 'polymer_deploy', dartVmBinaryFileName, args, environmentOverrides); |
| 1498 } | 1497 } |
| 1499 | 1498 |
| 1500 String get scriptType { | 1499 String get scriptType { |
| 1501 switch (configuration['compiler']) { | 1500 switch (configuration['compiler']) { |
| 1502 case 'none': | 1501 case 'none': |
| 1503 return 'application/dart'; | 1502 return 'application/dart'; |
| 1504 case 'dart2js': | 1503 case 'dart2js': |
| 1505 case 'dartanalyzer': | |
| 1506 case 'dart2analyzer': | 1504 case 'dart2analyzer': |
| 1507 return 'text/javascript'; | 1505 return 'text/javascript'; |
| 1508 default: | 1506 default: |
| 1509 print('Non-web runtime, so no scriptType for: ' | 1507 print('Non-web runtime, so no scriptType for: ' |
| 1510 '${configuration["compiler"]}'); | 1508 '${configuration["compiler"]}'); |
| 1511 exit(1); | 1509 exit(1); |
| 1512 return null; | 1510 return null; |
| 1513 } | 1511 } |
| 1514 } | 1512 } |
| 1515 | 1513 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1544 String packages = packagesArgument(optionsFromFile['packages']); | 1542 String packages = packagesArgument(optionsFromFile['packages']); |
| 1545 if (packages != null) { | 1543 if (packages != null) { |
| 1546 args.add(packages); | 1544 args.add(packages); |
| 1547 } | 1545 } |
| 1548 args.addAll(additionalOptions(filePath)); | 1546 args.addAll(additionalOptions(filePath)); |
| 1549 if (configuration['analyzer']) { | 1547 if (configuration['analyzer']) { |
| 1550 args.add('--machine'); | 1548 args.add('--machine'); |
| 1551 args.add('--no-hints'); | 1549 args.add('--no-hints'); |
| 1552 } | 1550 } |
| 1553 | 1551 |
| 1554 if ((configuration["compiler"] == "dartanalyzer" || | 1552 if (configuration["compiler"] == "dart2analyzer" && |
| 1555 configuration["compiler"] == "dart2analyzer") && | |
| 1556 (filePath.filename.contains("dart2js") || | 1553 (filePath.filename.contains("dart2js") || |
| 1557 filePath.directoryPath.segments().last.contains('html_common'))) { | 1554 filePath.directoryPath.segments().last.contains('html_common'))) { |
| 1558 args.add("--use-dart2js-libraries"); | 1555 args.add("--use-dart2js-libraries"); |
| 1559 } | 1556 } |
| 1560 | 1557 |
| 1561 bool isMultitest = optionsFromFile["isMultitest"]; | 1558 bool isMultitest = optionsFromFile["isMultitest"]; |
| 1562 List<String> dartOptions = optionsFromFile["dartOptions"]; | 1559 List<String> dartOptions = optionsFromFile["dartOptions"]; |
| 1563 | 1560 |
| 1564 assert(!isMultitest || dartOptions == null); | 1561 assert(!isMultitest || dartOptions == null); |
| 1565 args.add(filePath.toNativePath()); | 1562 args.add(filePath.toNativePath()); |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2240 if ((compiler == "dart2js") && | 2237 if ((compiler == "dart2js") && |
| 2241 configuration["minified"]) { | 2238 configuration["minified"]) { |
| 2242 args.add("--minify"); | 2239 args.add("--minify"); |
| 2243 } | 2240 } |
| 2244 if (compiler == "dart2js" && configuration["csp"]) { | 2241 if (compiler == "dart2js" && configuration["csp"]) { |
| 2245 args.add("--csp"); | 2242 args.add("--csp"); |
| 2246 } | 2243 } |
| 2247 if (compiler == "dart2js" && configuration["cps_ir"]) { | 2244 if (compiler == "dart2js" && configuration["cps_ir"]) { |
| 2248 args.add("--use-cps-ir"); | 2245 args.add("--use-cps-ir"); |
| 2249 } | 2246 } |
| 2250 if (compiler == "dartanalyzer" || compiler == "dart2analyzer") { | 2247 if (compiler == "dart2analyzer") { |
| 2251 args.add("--show-package-warnings"); | 2248 args.add("--show-package-warnings"); |
| 2252 args.add("--enable-async"); | 2249 args.add("--enable-async"); |
| 2253 } | 2250 } |
| 2254 return args; | 2251 return args; |
| 2255 } | 2252 } |
| 2256 | 2253 |
| 2257 static bool isBrowserRuntime(String runtime) { | 2254 static bool isBrowserRuntime(String runtime) { |
| 2258 const BROWSERS = const [ | 2255 const BROWSERS = const [ |
| 2259 'drt', | 2256 'drt', |
| 2260 'dartium', | 2257 'dartium', |
| 2261 'ie9', | 2258 'ie9', |
| 2262 'ie10', | 2259 'ie10', |
| 2263 'ie11', | 2260 'ie11', |
| 2264 'safari', | 2261 'safari', |
| 2265 'opera', | 2262 'opera', |
| 2266 'chrome', | 2263 'chrome', |
| 2267 'ff', | 2264 'ff', |
| 2268 'chromeOnAndroid', | 2265 'chromeOnAndroid', |
| 2269 'safarimobilesim', | 2266 'safarimobilesim', |
| 2270 'ContentShellOnAndroid', | 2267 'ContentShellOnAndroid', |
| 2271 'DartiumOnAndroid' | 2268 'DartiumOnAndroid' |
| 2272 ]; | 2269 ]; |
| 2273 return BROWSERS.contains(runtime); | 2270 return BROWSERS.contains(runtime); |
| 2274 } | 2271 } |
| 2275 | 2272 |
| 2276 static bool isJsCommandLineRuntime(String runtime) => | 2273 static bool isJsCommandLineRuntime(String runtime) => |
| 2277 const ['d8', 'jsshell'].contains(runtime); | 2274 const ['d8', 'jsshell'].contains(runtime); |
| 2278 | 2275 |
| 2279 static bool isCommandLineAnalyzer(String compiler) => | 2276 static bool isCommandLineAnalyzer(String compiler) => |
| 2280 compiler == 'dartanalyzer' || compiler == 'dart2analyzer'; | 2277 compiler == 'dart2analyzer'; |
| 2281 | 2278 |
| 2282 static String buildDir(Map configuration) { | 2279 static String buildDir(Map configuration) { |
| 2283 // FIXME(kustermann,ricow): Our code assumes that the returned 'buildDir' | 2280 // FIXME(kustermann,ricow): Our code assumes that the returned 'buildDir' |
| 2284 // is relative to the current working directory. | 2281 // is relative to the current working directory. |
| 2285 // Thus, if we pass in an absolute path (e.g. '--build-directory=/tmp/out') | 2282 // Thus, if we pass in an absolute path (e.g. '--build-directory=/tmp/out') |
| 2286 // we get into trouble. | 2283 // we get into trouble. |
| 2287 if (configuration['build_directory'] == '') { | 2284 if (configuration['build_directory'] == '') { |
| 2288 configuration['configuration_directory'] = | 2285 configuration['configuration_directory'] = |
| 2289 configurationDir(configuration); | 2286 configurationDir(configuration); |
| 2290 configuration['build_directory'] = | 2287 configuration['build_directory'] = |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2420 for (var key in PATH_REPLACEMENTS.keys) { | 2417 for (var key in PATH_REPLACEMENTS.keys) { |
| 2421 if (path.startsWith(key)) { | 2418 if (path.startsWith(key)) { |
| 2422 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); | 2419 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); |
| 2423 break; | 2420 break; |
| 2424 } | 2421 } |
| 2425 } | 2422 } |
| 2426 } | 2423 } |
| 2427 return path; | 2424 return path; |
| 2428 } | 2425 } |
| 2429 } | 2426 } |
| OLD | NEW |