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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 var isNegative = info.isNegative; | 347 var isNegative = info.isNegative; |
| 348 | 348 |
| 349 // Look up expectations in status files using a modified file path. | 349 // Look up expectations in status files using a modified file path. |
| 350 String testName; | 350 String testName; |
| 351 filename = filename.replaceAll('\\', '/'); | 351 filename = filename.replaceAll('\\', '/'); |
| 352 | 352 |
| 353 // See if there's a 'src' directory inside the 'tests' one. | 353 // See if there's a 'src' directory inside the 'tests' one. |
| 354 int testsStart = filename.lastIndexOf('tests/'); | 354 int testsStart = filename.lastIndexOf('tests/'); |
| 355 int start = filename.lastIndexOf('src/'); | 355 int start = filename.lastIndexOf('src/'); |
| 356 if (start > testsStart) { | 356 if (start > testsStart) { |
| 357 // TODO(sigmund): delete this branch once all tests stop using the src/ | |
| 358 // directoy | |
|
Bob Nystrom
2012/04/27 16:02:44
"directory".
Siggi Cherem (dart-lang)
2012/04/27 17:07:01
Done.
| |
| 357 testName = filename.substring(start + 4, filename.length - 5); | 359 testName = filename.substring(start + 4, filename.length - 5); |
| 358 } else if (optionsFromFile['isMultitest']) { | 360 } else if (optionsFromFile['isMultitest']) { |
| 359 start = filename.lastIndexOf('/'); | 361 start = filename.lastIndexOf('/'); |
| 360 int middle = filename.lastIndexOf('_'); | 362 int middle = filename.lastIndexOf('_'); |
| 361 testName = filename.substring(start + 1, middle) + '/' + | 363 testName = filename.substring(start + 1, middle) + '/' + |
| 362 filename.substring(middle + 1, filename.length - 5); | 364 filename.substring(middle + 1, filename.length - 5); |
| 363 } else { | 365 } else { |
| 364 // This case is hit by the dartc client compilation | 366 // This case is hit by the dartc client compilation |
| 365 // tests. These tests are pretty broken compared to the | 367 // tests. These tests are pretty broken compared to the |
| 366 // rest. They use the .dart suffix in the status files. They | 368 // rest. They use the .dart suffix in the status files. They |
| 367 // find tests in weird ways (testing that they contain "#"). | 369 // find tests in weird ways (testing that they contain "#"). |
| 368 // They need to be redone. | 370 // They need to be redone. |
| 369 // TODO(1058): This does not work on Windows. | 371 // TODO(1058): This does not work on Windows. |
| 370 start = filename.indexOf(directoryPath); | 372 start = filename.indexOf(directoryPath); |
| 371 if (start != -1) { | 373 if (start != -1) { |
| 372 testName = filename.substring(start + directoryPath.length + 1); | 374 testName = filename.substring(start + directoryPath.length + 1); |
| 373 } else { | 375 } else { |
| 374 testName = filename; | 376 testName = filename; |
| 375 } | 377 } |
| 376 | 378 |
| 377 if (configuration['compiler'] != 'dartc') { | 379 if (configuration['compiler'] != 'dartc' || |
| 380 testName.endsWith('_test.dart')) { | |
| 378 if (testName.endsWith('.dart')) { | 381 if (testName.endsWith('.dart')) { |
| 379 testName = testName.substring(0, testName.length - 5); | 382 testName = testName.substring(0, testName.length - 5); |
| 380 } | 383 } |
| 381 } | 384 } |
| 382 } | 385 } |
| 383 int shards = configuration['shards']; | 386 int shards = configuration['shards']; |
| 384 if (shards > 1) { | 387 if (shards > 1) { |
| 385 int shard = configuration['shard']; | 388 int shard = configuration['shard']; |
| 386 if (testName.hashCode() % shards != shard - 1) { | 389 if (testName.hashCode() % shards != shard - 1) { |
| 387 return; | 390 return; |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1387 * $noCrash tests are expected to be flaky but not crash | 1390 * $noCrash tests are expected to be flaky but not crash |
| 1388 * $pass tests are expected to pass | 1391 * $pass tests are expected to pass |
| 1389 * $failOk tests are expected to fail that we won't fix | 1392 * $failOk tests are expected to fail that we won't fix |
| 1390 * $fail tests are expected to fail that we should fix | 1393 * $fail tests are expected to fail that we should fix |
| 1391 * $crash tests are expected to crash that we should fix | 1394 * $crash tests are expected to crash that we should fix |
| 1392 * $timeout tests are allowed to timeout | 1395 * $timeout tests are allowed to timeout |
| 1393 """; | 1396 """; |
| 1394 print(report); | 1397 print(report); |
| 1395 } | 1398 } |
| 1396 } | 1399 } |
| OLD | NEW |