Chromium Code Reviews| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 return; | 294 return; |
| 295 } | 295 } |
| 296 | 296 |
| 297 doTest(testCase); | 297 doTest(testCase); |
| 298 } | 298 } |
| 299 | 299 |
| 300 String createGeneratedTestDirectoryHelper( | 300 String createGeneratedTestDirectoryHelper( |
| 301 String name, String dirname, Path testPath, String optionsName) { | 301 String name, String dirname, Path testPath, String optionsName) { |
| 302 Path relative = testPath.relativeTo(TestUtils.dartDir()); | 302 Path relative = testPath.relativeTo(TestUtils.dartDir()); |
| 303 relative = relative.directoryPath.append(relative.filenameWithoutExtension); | 303 relative = relative.directoryPath.append(relative.filenameWithoutExtension); |
| 304 String testUniqueName = relative.toString().replaceAll('/', '_'); | 304 String testUniqueName = TestUtils.getShortName(relative.toString()); |
| 305 if (!optionsName.isEmpty) { | 305 if (!optionsName.isEmpty) { |
| 306 testUniqueName = '$testUniqueName-$optionsName'; | 306 testUniqueName = '$testUniqueName-$optionsName'; |
| 307 } | 307 } |
| 308 | 308 |
| 309 Path generatedTestPath = new Path(buildDir) | 309 Path generatedTestPath = new Path(buildDir) |
| 310 .append('generated_$name') | 310 .append('generated_$name') |
| 311 .append(dirname) | 311 .append(dirname) |
| 312 .append(testUniqueName); | 312 .append(testUniqueName); |
| 313 | 313 |
| 314 TestUtils.mkdirRecursive(new Path('.'), generatedTestPath); | 314 TestUtils.mkdirRecursive(new Path('.'), generatedTestPath); |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1348 String packageRoot = packageRootArgument(optionsFromFile['packageRoot']); | 1348 String packageRoot = packageRootArgument(optionsFromFile['packageRoot']); |
| 1349 if (packageRoot != null) args.add(packageRoot); | 1349 if (packageRoot != null) args.add(packageRoot); |
| 1350 args..add('package:polymer/deploy.dart') | 1350 args..add('package:polymer/deploy.dart') |
| 1351 ..add('--test')..add(inputFile) | 1351 ..add('--test')..add(inputFile) |
| 1352 ..add('--out')..add(outputDir); | 1352 ..add('--out')..add(outputDir); |
| 1353 | 1353 |
| 1354 return CommandBuilder.instance.getProcessCommand( | 1354 return CommandBuilder.instance.getProcessCommand( |
| 1355 'polymer_deploy', dartVmBinaryFileName, args, environmentOverrides); | 1355 'polymer_deploy', dartVmBinaryFileName, args, environmentOverrides); |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 String createGeneratedTestDirectoryHelper( | |
| 1359 String name, String dirname, Path testPath, String optionsName) { | |
| 1360 Path relative = testPath.relativeTo(TestUtils.dartDir()); | |
| 1361 relative = relative.directoryPath.append(relative.filenameWithoutExtension); | |
| 1362 String testUniqueName = relative.toString().replaceAll('/', '_'); | |
| 1363 if (!optionsName.isEmpty) { | |
| 1364 testUniqueName = '$testUniqueName-$optionsName'; | |
| 1365 } | |
| 1366 | |
| 1367 Path generatedTestPath = new Path(buildDir) | |
| 1368 .append('generated_$name') | |
| 1369 .append(dirname) | |
| 1370 .append(testUniqueName); | |
| 1371 | |
| 1372 TestUtils.mkdirRecursive(new Path('.'), generatedTestPath); | |
| 1373 return new File(generatedTestPath.toNativePath()).absolute.path | |
| 1374 .replaceAll('\\', '/'); | |
| 1375 } | |
| 1376 | |
| 1377 String get scriptType { | 1358 String get scriptType { |
| 1378 switch (configuration['compiler']) { | 1359 switch (configuration['compiler']) { |
| 1379 case 'none': | 1360 case 'none': |
| 1380 case 'dart2dart': | 1361 case 'dart2dart': |
| 1381 return 'application/dart'; | 1362 return 'application/dart'; |
| 1382 case 'dart2js': | 1363 case 'dart2js': |
| 1383 case 'dartanalyzer': | 1364 case 'dartanalyzer': |
| 1384 case 'dart2analyzer': | 1365 case 'dart2analyzer': |
| 1385 return 'text/javascript'; | 1366 return 'text/javascript'; |
| 1386 default: | 1367 default: |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2127 * Gets extra vm options passed to the testing script. | 2108 * Gets extra vm options passed to the testing script. |
| 2128 */ | 2109 */ |
| 2129 static List<String> getExtraVmOptions(Map configuration) { | 2110 static List<String> getExtraVmOptions(Map configuration) { |
| 2130 var extraVmOptions = []; | 2111 var extraVmOptions = []; |
| 2131 if (configuration['vm_options'] != null) { | 2112 if (configuration['vm_options'] != null) { |
| 2132 extraVmOptions = configuration['vm_options'].split(" "); | 2113 extraVmOptions = configuration['vm_options'].split(" "); |
| 2133 extraVmOptions.removeWhere((s) => s.trim() == ""); | 2114 extraVmOptions.removeWhere((s) => s.trim() == ""); |
| 2134 } | 2115 } |
| 2135 return extraVmOptions; | 2116 return extraVmOptions; |
| 2136 } | 2117 } |
| 2118 | |
| 2119 static String getShortName(String path) { | |
| 2120 final PATH_REPLACEMENTS = const { | |
| 2121 "tests_co19_src_WebPlatformTest1_shadow-dom_shadow-trees_": | |
| 2122 "shadow-trees_", | |
| 2123 "tests_co19_src_WebPlatformTest1_shadow-dom_elements-and-dom-objects_": | |
| 2124 "shadowdom_", | |
| 2125 "tests_co19_src_WebPlatformTest1_html-templates_parsing-html-" | |
| 2126 "templates_additions-to-": "htmltemplates_add_", | |
| 2127 "tests_co19_src_WebPlatformTest1_html-templates_parsing-html-" | |
| 2128 "templates_appending-to-a-template_": "htmltemplates_append_", | |
| 2129 "tests_co19_src_WebPlatformTest1_html-templates_parsing-html-" | |
| 2130 "templates_clearing-the-stack-back-to-a-given-context_": | |
| 2131 "htmltemplates_clearstack_", | |
| 2132 "tests_co19_src_WebPlatformTest1_html-templates_parsing-html-" | |
| 2133 "templates_creating-an-element-for-the-token_": | |
| 2134 "htmltemplates_create_", | |
| 2135 "tests_co19_src_WebPlatformTest1_html-templates_additions-to-" | |
| 2136 "the-steps-to-clone-a-node_": "htmltemplates_clone_", | |
| 2137 "tests_co19_src_LayoutTests_fast_dom_Document_CaretRangeFromPoint_" | |
| 2138 "caretRangeFromPoint-": "caretrangefrompoint_", | |
| 2139 "pkg_polymer_example_canonicalization_test_canonicalization": "polycanon" | |
|
kustermann
2014/04/07 14:04:12
Would we hit the limit if you prefixed it with co1
Bill Hesse
2014/04/07 14:47:12
Done.
| |
| 2140 }; | |
| 2141 | |
| 2142 // Some tests are already in [build_dir]/generated_tests. | |
| 2143 String GEN_TESTS = 'generated_tests/'; | |
| 2144 if (path.contains(GEN_TESTS)) { | |
| 2145 int index = path.indexOf(GEN_TESTS) + GEN_TESTS.length; | |
| 2146 path = 'gen/${path.substring(index)}'; | |
|
kustermann
2014/04/07 14:04:12
Why not multitest as before?
[would make it obviou
Bill Hesse
2014/04/07 14:47:12
Done.
| |
| 2147 } | |
| 2148 path = path.replaceAll('/', '_'); | |
| 2149 final int WINDOWS_SHORTEN_PATH_LIMIT = 70; | |
| 2150 if (Platform.operatingSystem == 'windows' && | |
| 2151 path.length > WINDOWS_SHORTEN_PATH_LIMIT) { | |
| 2152 for (var key in PATH_REPLACEMENTS.keys) { | |
| 2153 if (path.startsWith(key)) { | |
| 2154 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); | |
| 2155 break; | |
| 2156 } | |
| 2157 } | |
| 2158 } | |
| 2159 return path; | |
| 2160 } | |
| 2137 } | 2161 } |
| 2138 | 2162 |
| 2139 class SummaryReport { | 2163 class SummaryReport { |
| 2140 static int total = 0; | 2164 static int total = 0; |
| 2141 static int skipped = 0; | 2165 static int skipped = 0; |
| 2142 static int skippedByDesign = 0; | 2166 static int skippedByDesign = 0; |
| 2143 static int noCrash = 0; | 2167 static int noCrash = 0; |
| 2144 static int pass = 0; | 2168 static int pass = 0; |
| 2145 static int failOk = 0; | 2169 static int failOk = 0; |
| 2146 static int fail = 0; | 2170 static int fail = 0; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2196 * $skipped tests will be skipped ($skippedByDesign skipped by design) | 2220 * $skipped tests will be skipped ($skippedByDesign skipped by design) |
| 2197 * $noCrash tests are expected to be flaky but not crash | 2221 * $noCrash tests are expected to be flaky but not crash |
| 2198 * $pass tests are expected to pass | 2222 * $pass tests are expected to pass |
| 2199 * $failOk tests are expected to fail that we won't fix | 2223 * $failOk tests are expected to fail that we won't fix |
| 2200 * $fail tests are expected to fail that we should fix | 2224 * $fail tests are expected to fail that we should fix |
| 2201 * $crash tests are expected to crash that we should fix | 2225 * $crash tests are expected to crash that we should fix |
| 2202 * $timeout tests are allowed to timeout | 2226 * $timeout tests are allowed to timeout |
| 2203 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 2227 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 2204 """; | 2228 """; |
| 2205 print(report); | 2229 print(report); |
| 2206 } | 2230 } |
| 2207 } | 2231 } |
| OLD | NEW |