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 testPathString = relative.toString(); |
| 305 if (testPathString.startsWith('$buildDir/generated_tests')) { | |
| 306 testPathString = | |
| 307 testPathString.replaceFirst('$buildDir/generated_tests', 'multitest'); | |
| 308 } | |
| 309 String testUniqueName = testPathString.replaceAll('/', '_'); | |
| 305 if (!optionsName.isEmpty) { | 310 if (!optionsName.isEmpty) { |
| 306 testUniqueName = '$testUniqueName-$optionsName'; | 311 testUniqueName = '$testUniqueName-$optionsName'; |
| 307 } | 312 } |
| 313 final int WINDOWS_SHORTEN_PATH_LIMIT = 70; | |
| 314 if (Platform.operatingSystem == 'windows' && | |
| 315 testUniqueName.length > WINDOWS_SHORTEN_PATH_LIMIT) { | |
| 316 testUniqueName = TestUtils.getPersistentWindowsShortPath(testUniqueName); | |
| 317 } | |
|
kustermann
2014/04/07 09:02:23
Just call the function always. I'd encapsulate all
| |
| 308 | 318 |
| 309 Path generatedTestPath = new Path(buildDir) | 319 Path generatedTestPath = new Path(buildDir) |
| 310 .append('generated_$name') | 320 .append('generated_$name') |
| 311 .append(dirname) | 321 .append(dirname) |
| 312 .append(testUniqueName); | 322 .append(testUniqueName); |
| 313 | 323 |
| 314 TestUtils.mkdirRecursive(new Path('.'), generatedTestPath); | 324 TestUtils.mkdirRecursive(new Path('.'), generatedTestPath); |
| 315 return new File(generatedTestPath.toNativePath()).absolute.path | 325 return new File(generatedTestPath.toNativePath()).absolute.path |
| 316 .replaceAll('\\', '/'); | 326 .replaceAll('\\', '/'); |
| 317 } | 327 } |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1348 String packageRoot = packageRootArgument(optionsFromFile['packageRoot']); | 1358 String packageRoot = packageRootArgument(optionsFromFile['packageRoot']); |
| 1349 if (packageRoot != null) args.add(packageRoot); | 1359 if (packageRoot != null) args.add(packageRoot); |
| 1350 args..add('package:polymer/deploy.dart') | 1360 args..add('package:polymer/deploy.dart') |
| 1351 ..add('--test')..add(inputFile) | 1361 ..add('--test')..add(inputFile) |
| 1352 ..add('--out')..add(outputDir); | 1362 ..add('--out')..add(outputDir); |
| 1353 | 1363 |
| 1354 return CommandBuilder.instance.getProcessCommand( | 1364 return CommandBuilder.instance.getProcessCommand( |
| 1355 'polymer_deploy', dartVmBinaryFileName, args, environmentOverrides); | 1365 'polymer_deploy', dartVmBinaryFileName, args, environmentOverrides); |
| 1356 } | 1366 } |
| 1357 | 1367 |
| 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 { | 1368 String get scriptType { |
| 1378 switch (configuration['compiler']) { | 1369 switch (configuration['compiler']) { |
| 1379 case 'none': | 1370 case 'none': |
| 1380 case 'dart2dart': | 1371 case 'dart2dart': |
| 1381 return 'application/dart'; | 1372 return 'application/dart'; |
| 1382 case 'dart2js': | 1373 case 'dart2js': |
| 1383 case 'dartanalyzer': | 1374 case 'dartanalyzer': |
| 1384 case 'dart2analyzer': | 1375 case 'dart2analyzer': |
| 1385 return 'text/javascript'; | 1376 return 'text/javascript'; |
| 1386 default: | 1377 default: |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2127 * Gets extra vm options passed to the testing script. | 2118 * Gets extra vm options passed to the testing script. |
| 2128 */ | 2119 */ |
| 2129 static List<String> getExtraVmOptions(Map configuration) { | 2120 static List<String> getExtraVmOptions(Map configuration) { |
| 2130 var extraVmOptions = []; | 2121 var extraVmOptions = []; |
| 2131 if (configuration['vm_options'] != null) { | 2122 if (configuration['vm_options'] != null) { |
| 2132 extraVmOptions = configuration['vm_options'].split(" "); | 2123 extraVmOptions = configuration['vm_options'].split(" "); |
| 2133 extraVmOptions.removeWhere((s) => s.trim() == ""); | 2124 extraVmOptions.removeWhere((s) => s.trim() == ""); |
| 2134 } | 2125 } |
| 2135 return extraVmOptions; | 2126 return extraVmOptions; |
| 2136 } | 2127 } |
| 2128 | |
| 2129 static String getPersistentWindowsShortPath(String path) { | |
| 2130 final replacements = const { | |
| 2131 "tests_co19_src_WebPlatformTest1_shadow-dom_shadow-trees_": | |
| 2132 "shadow-trees_", | |
| 2133 "tests_co19_src_WebPlatformTest1_shadow-dom_elements-and-dom-objects_": | |
| 2134 "shadowdom_", | |
| 2135 "tests_co19_src_WebPlatformTest1_html-templates_parsing-html-templates_add itions-to-": | |
| 2136 "htmltemplates_add_", | |
| 2137 "tests_co19_src_WebPlatformTest1_html-templates_parsing-html-templates_app ending-to-a-template_": | |
| 2138 "htmltemplates_append_", | |
| 2139 "tests_co19_src_WebPlatformTest1_html-templates_parsing-html-templates_cle aring-the-stack-back-to-a-given-context_": | |
| 2140 "htmltemplates_clearstack_", | |
| 2141 "tests_co19_src_WebPlatformTest1_html-templates_parsing-html-templates_cre ating-an-element-for-the-token_": | |
| 2142 "htmltemplates_create_", | |
| 2143 "tests_co19_src_WebPlatformTest1_html-templates_additions-to-the-steps-to- clone-a-node_": | |
| 2144 "htmltemplates_clone_", | |
| 2145 "tests_co19_src_LayoutTests_fast_dom_Document_CaretRangeFromPoint_caretRan geFromPoint-": | |
| 2146 "caretrangefrompoint_" | |
| 2147 }; | |
| 2148 | |
| 2149 for (var key in replacements.keys) { | |
| 2150 if (path.startsWith(key)) { | |
| 2151 return path.replaceFirst(key, replacements[key]); | |
| 2152 } | |
| 2153 } | |
| 2154 return path; | |
| 2155 } | |
| 2137 } | 2156 } |
| 2138 | 2157 |
| 2139 class SummaryReport { | 2158 class SummaryReport { |
| 2140 static int total = 0; | 2159 static int total = 0; |
| 2141 static int skipped = 0; | 2160 static int skipped = 0; |
| 2142 static int skippedByDesign = 0; | 2161 static int skippedByDesign = 0; |
| 2143 static int noCrash = 0; | 2162 static int noCrash = 0; |
| 2144 static int pass = 0; | 2163 static int pass = 0; |
| 2145 static int failOk = 0; | 2164 static int failOk = 0; |
| 2146 static int fail = 0; | 2165 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) | 2215 * $skipped tests will be skipped ($skippedByDesign skipped by design) |
| 2197 * $noCrash tests are expected to be flaky but not crash | 2216 * $noCrash tests are expected to be flaky but not crash |
| 2198 * $pass tests are expected to pass | 2217 * $pass tests are expected to pass |
| 2199 * $failOk tests are expected to fail that we won't fix | 2218 * $failOk tests are expected to fail that we won't fix |
| 2200 * $fail tests are expected to fail that we should fix | 2219 * $fail tests are expected to fail that we should fix |
| 2201 * $crash tests are expected to crash that we should fix | 2220 * $crash tests are expected to crash that we should fix |
| 2202 * $timeout tests are allowed to timeout | 2221 * $timeout tests are allowed to timeout |
| 2203 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 2222 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 2204 """; | 2223 """; |
| 2205 print(report); | 2224 print(report); |
| 2206 } | 2225 } |
| 2207 } | 2226 } |
| OLD | NEW |