| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // - update SummaryReport | 253 // - update SummaryReport |
| 254 // - handle SKIP/SKIP_BY_DESIGN markers | 254 // - handle SKIP/SKIP_BY_DESIGN markers |
| 255 // - test if the selector matches | 255 // - test if the selector matches |
| 256 // and will enqueue the test (if necessary). | 256 // and will enqueue the test (if necessary). |
| 257 void enqueueNewTestCase(TestCase testCase) { | 257 void enqueueNewTestCase(TestCase testCase) { |
| 258 var expectations = testCase.expectedOutcomes; | 258 var expectations = testCase.expectedOutcomes; |
| 259 | 259 |
| 260 // Handle sharding based on the original test path (i.e. all multitests | 260 // Handle sharding based on the original test path (i.e. all multitests |
| 261 // of a given original test belong to the same shard) | 261 // of a given original test belong to the same shard) |
| 262 int shards = configuration['shards']; | 262 int shards = configuration['shards']; |
| 263 if (shards > 1) { | 263 if (shards > 1 && testCase.hash % shards != configuration['shard'] - 1) { |
| 264 int shard = configuration['shard']; | 264 return; |
| 265 var testPath = | |
| 266 testCase.info.originTestPath.relativeTo(TestUtils.dartDir); | |
| 267 if ("$testPath".hashCode % shards != shard - 1) { | |
| 268 return; | |
| 269 } | |
| 270 } | 265 } |
| 271 // Test if the selector includes this test. | 266 // Test if the selector includes this test. |
| 272 RegExp pattern = configuration['selectors'][suiteName]; | 267 RegExp pattern = configuration['selectors'][suiteName]; |
| 273 if (!pattern.hasMatch(testCase.displayName)) { | 268 if (!pattern.hasMatch(testCase.displayName)) { |
| 274 return; | 269 return; |
| 275 } | 270 } |
| 276 | 271 |
| 277 // Update Summary report | 272 // Update Summary report |
| 278 if (configuration['report']) { | 273 if (configuration['report']) { |
| 279 SummaryReport.add(expectations); | 274 SummaryReport.add(expectations); |
| 280 if (testCase.info != null && | 275 if (testCase.expectCompileError && |
| 281 testCase.expectCompileError && | |
| 282 TestUtils.isBrowserRuntime(configuration['runtime']) && | 276 TestUtils.isBrowserRuntime(configuration['runtime']) && |
| 283 new CompilerConfiguration(configuration).hasCompiler) { | 277 new CompilerConfiguration(configuration).hasCompiler) { |
| 284 SummaryReport.addCompileErrorSkipTest(); | 278 SummaryReport.addCompileErrorSkipTest(); |
| 285 return; | 279 return; |
| 286 } | 280 } |
| 287 } | 281 } |
| 288 | 282 |
| 289 // Handle skipped tests | 283 // Handle skipped tests |
| 290 if (expectations.contains(Expectation.SKIP) || | 284 if (expectations.contains(Expectation.SKIP) || |
| 291 expectations.contains(Expectation.SKIP_BY_DESIGN)) { | 285 expectations.contains(Expectation.SKIP_BY_DESIGN)) { |
| (...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2216 * $pass tests are expected to pass | 2210 * $pass tests are expected to pass |
| 2217 * $failOk tests are expected to fail that we won't fix | 2211 * $failOk tests are expected to fail that we won't fix |
| 2218 * $fail tests are expected to fail that we should fix | 2212 * $fail tests are expected to fail that we should fix |
| 2219 * $crash tests are expected to crash that we should fix | 2213 * $crash tests are expected to crash that we should fix |
| 2220 * $timeout tests are allowed to timeout | 2214 * $timeout tests are allowed to timeout |
| 2221 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 2215 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 2222 """; | 2216 """; |
| 2223 print(report); | 2217 print(report); |
| 2224 } | 2218 } |
| 2225 } | 2219 } |
| OLD | NEW |