| 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } | 400 } |
| 401 int shards = configuration['shards']; | 401 int shards = configuration['shards']; |
| 402 if (shards > 1) { | 402 if (shards > 1) { |
| 403 int shard = configuration['shard']; | 403 int shard = configuration['shard']; |
| 404 if (testName.hashCode % shards != shard - 1) { | 404 if (testName.hashCode % shards != shard - 1) { |
| 405 return; | 405 return; |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 | 408 |
| 409 Set<String> expectations = testExpectations.expectations(testName); | 409 Set<String> expectations = testExpectations.expectations(testName); |
| 410 if (info.hasCompileError && |
| 411 TestUtils.isBrowserRuntime(configuration['runtime'])) { |
| 412 SummaryReport.addCompileErrorSkipTest(); |
| 413 return; |
| 414 } |
| 410 if (configuration['report']) { | 415 if (configuration['report']) { |
| 411 // Tests with multiple VMOptions are counted more than once. | 416 // Tests with multiple VMOptions are counted more than once. |
| 412 for (var dummy in getVmOptions(optionsFromFile)) { | 417 for (var dummy in getVmOptions(optionsFromFile)) { |
| 413 SummaryReport.add(expectations); | 418 SummaryReport.add(expectations); |
| 414 } | 419 } |
| 415 } | 420 } |
| 416 if (expectations.contains(SKIP)) return; | 421 if (expectations.contains(SKIP)) return; |
| 417 | 422 |
| 418 if (configuration['compiler'] != 'none' && info.hasCompileError) { | 423 if (configuration['compiler'] != 'none' && info.hasCompileError) { |
| 419 // If a compile-time error is expected, and we're testing a | 424 // If a compile-time error is expected, and we're testing a |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 | 1444 |
| 1440 class SummaryReport { | 1445 class SummaryReport { |
| 1441 static int total = 0; | 1446 static int total = 0; |
| 1442 static int skipped = 0; | 1447 static int skipped = 0; |
| 1443 static int noCrash = 0; | 1448 static int noCrash = 0; |
| 1444 static int pass = 0; | 1449 static int pass = 0; |
| 1445 static int failOk = 0; | 1450 static int failOk = 0; |
| 1446 static int fail = 0; | 1451 static int fail = 0; |
| 1447 static int crash = 0; | 1452 static int crash = 0; |
| 1448 static int timeout = 0; | 1453 static int timeout = 0; |
| 1454 static int compileErrorSkip = 0; |
| 1449 | 1455 |
| 1450 static void add(Set<String> expectations) { | 1456 static void add(Set<String> expectations) { |
| 1451 ++total; | 1457 ++total; |
| 1452 if (expectations.contains(SKIP)) { | 1458 if (expectations.contains(SKIP)) { |
| 1453 ++skipped; | 1459 ++skipped; |
| 1454 } else { | 1460 } else { |
| 1455 if (expectations.contains(PASS) && expectations.contains(FAIL) && | 1461 if (expectations.contains(PASS) && expectations.contains(FAIL) && |
| 1456 !expectations.contains(CRASH) && !expectations.contains(OK)) { | 1462 !expectations.contains(CRASH) && !expectations.contains(OK)) { |
| 1457 ++noCrash; | 1463 ++noCrash; |
| 1458 } | 1464 } |
| 1459 if (expectations.contains(PASS) && expectations.length == 1) { | 1465 if (expectations.contains(PASS) && expectations.length == 1) { |
| 1460 ++pass; | 1466 ++pass; |
| 1461 } | 1467 } |
| 1462 if (expectations.containsAll([FAIL, OK]) && expectations.length == 2) { | 1468 if (expectations.containsAll([FAIL, OK]) && expectations.length == 2) { |
| 1463 ++failOk; | 1469 ++failOk; |
| 1464 } | 1470 } |
| 1465 if (expectations.contains(FAIL) && expectations.length == 1) { | 1471 if (expectations.contains(FAIL) && expectations.length == 1) { |
| 1466 ++fail; | 1472 ++fail; |
| 1467 } | 1473 } |
| 1468 if (expectations.contains(CRASH) && expectations.length == 1) { | 1474 if (expectations.contains(CRASH) && expectations.length == 1) { |
| 1469 ++crash; | 1475 ++crash; |
| 1470 } | 1476 } |
| 1471 if (expectations.contains(TIMEOUT)) { | 1477 if (expectations.contains(TIMEOUT)) { |
| 1472 ++timeout; | 1478 ++timeout; |
| 1473 } | 1479 } |
| 1474 } | 1480 } |
| 1475 } | 1481 } |
| 1476 | 1482 |
| 1483 static void addCompileErrorSkipTest() { |
| 1484 total++; |
| 1485 compileErrorSkip++; |
| 1486 } |
| 1487 |
| 1477 static void printReport() { | 1488 static void printReport() { |
| 1478 if (total == 0) return; | 1489 if (total == 0) return; |
| 1479 String report = """Total: $total tests | 1490 String report = """Total: $total tests |
| 1480 * $skipped tests will be skipped | 1491 * $skipped tests will be skipped |
| 1481 * $noCrash tests are expected to be flaky but not crash | 1492 * $noCrash tests are expected to be flaky but not crash |
| 1482 * $pass tests are expected to pass | 1493 * $pass tests are expected to pass |
| 1483 * $failOk tests are expected to fail that we won't fix | 1494 * $failOk tests are expected to fail that we won't fix |
| 1484 * $fail tests are expected to fail that we should fix | 1495 * $fail tests are expected to fail that we should fix |
| 1485 * $crash tests are expected to crash that we should fix | 1496 * $crash tests are expected to crash that we should fix |
| 1486 * $timeout tests are allowed to timeout | 1497 * $timeout tests are allowed to timeout |
| 1498 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 1487 """; | 1499 """; |
| 1488 print(report); | 1500 print(report); |
| 1489 } | 1501 } |
| 1490 } | 1502 } |
| OLD | NEW |