| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 var isNegative = info.isNegative; | 353 var isNegative = info.isNegative; |
| 354 | 354 |
| 355 // Look up expectations in status files using a modified file path. | 355 // Look up expectations in status files using a modified file path. |
| 356 String testName; | 356 String testName; |
| 357 filename = filename.replaceAll('\\', '/'); | 357 filename = filename.replaceAll('\\', '/'); |
| 358 | 358 |
| 359 // See if there's a 'src' directory inside the 'tests' one. | 359 // See if there's a 'src' directory inside the 'tests' one. |
| 360 int testsStart = filename.lastIndexOf('tests/'); | 360 int testsStart = filename.lastIndexOf('tests/'); |
| 361 int start = filename.lastIndexOf('src/'); | 361 int start = filename.lastIndexOf('src/'); |
| 362 if (start > testsStart) { | 362 if (start > testsStart) { |
| 363 // Old-style test suites with tests in a 'src' subdirectory. |
| 363 // TODO(sigmund): delete this branch once all tests stop using the src/ | 364 // TODO(sigmund): delete this branch once all tests stop using the src/ |
| 364 // directory | 365 // directory |
| 365 testName = filename.substring(start + 4, filename.length - 5); | 366 testName = filename.substring(start + 4, filename.length - 5); |
| 366 } else if (optionsFromFile['isMultitest']) { | 367 } else if (optionsFromFile['isMultitest']) { |
| 367 start = filename.lastIndexOf('/'); | 368 start = filename.lastIndexOf('/'); |
| 368 int middle = filename.lastIndexOf('_'); | 369 int middle = filename.lastIndexOf('_'); |
| 369 var multitestBase = filename.substring(start + 1, middle); | 370 var multitestBase = filename.substring(start + 1, middle); |
| 370 var multitestKey = filename.substring(middle + 1, filename.length - 5); | 371 var multitestKey = filename.substring(middle + 1, filename.length - 5); |
| 371 testName = '$multitestBase/$multitestKey'; | 372 testName = '$multitestBase/$multitestKey'; |
| 372 } else { | 373 } else { |
| 373 // This branch is hit in two cases: standard test suites created with | 374 // New-style test suites created by StandardTestSuite.forDirectory(). |
| 374 // forDirectory and dartc code compilation tests. | |
| 375 | |
| 376 // Dartc compilation tests are pretty broken compared to the | |
| 377 // rest. They use the .dart suffix in the status files. They | |
| 378 // find tests in weird ways (testing that they contain "#"). | |
| 379 // They need to be redone. | |
| 380 // TODO(1058): This does not work on Windows. | |
| 381 start = filename.indexOf(directoryPath); | 375 start = filename.indexOf(directoryPath); |
| 382 if (start != -1) { | 376 if (start != -1) { |
| 383 testName = filename.substring(start + directoryPath.length + 1); | 377 testName = filename.substring(start + directoryPath.length + 1); |
| 384 } else { | 378 } else { |
| 385 testName = filename; | 379 testName = filename; |
| 386 } | 380 } |
| 387 String suffix = TestUtils.executableSuffix(configuration['compiler']); | 381 if (testName.endsWith('.dart')) { |
| 388 if (configuration['compiler'] != 'dart_analyzer$suffix' || | 382 testName = testName.substring(0, testName.length - 5); |
| 389 testName.endsWith('_test.dart')) { | |
| 390 if (testName.endsWith('.dart')) { | |
| 391 testName = testName.substring(0, testName.length - 5); | |
| 392 } | |
| 393 } | 383 } |
| 394 } | 384 } |
| 395 int shards = configuration['shards']; | 385 int shards = configuration['shards']; |
| 396 if (shards > 1) { | 386 if (shards > 1) { |
| 397 int shard = configuration['shard']; | 387 int shard = configuration['shard']; |
| 398 if (testName.hashCode() % shards != shard - 1) { | 388 if (testName.hashCode() % shards != shard - 1) { |
| 399 return; | 389 return; |
| 400 } | 390 } |
| 401 } | 391 } |
| 402 | 392 |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 * $noCrash tests are expected to be flaky but not crash | 1346 * $noCrash tests are expected to be flaky but not crash |
| 1357 * $pass tests are expected to pass | 1347 * $pass tests are expected to pass |
| 1358 * $failOk tests are expected to fail that we won't fix | 1348 * $failOk tests are expected to fail that we won't fix |
| 1359 * $fail tests are expected to fail that we should fix | 1349 * $fail tests are expected to fail that we should fix |
| 1360 * $crash tests are expected to crash that we should fix | 1350 * $crash tests are expected to crash that we should fix |
| 1361 * $timeout tests are allowed to timeout | 1351 * $timeout tests are allowed to timeout |
| 1362 """; | 1352 """; |
| 1363 print(report); | 1353 print(report); |
| 1364 } | 1354 } |
| 1365 } | 1355 } |
| OLD | NEW |