Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: tools/testing/dart/test_suite.dart

Issue 847873004: Outputing comma-separated report with percentages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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,
11 * and creating [TestCase]s for those files that meet the relevant criteria. 11 * and creating [TestCase]s for those files that meet the relevant criteria.
12 * - Preparing tests, including copying files and frameworks to temporary 12 * - Preparing tests, including copying files and frameworks to temporary
13 * directories, and computing the command line and arguments to be run. 13 * directories, and computing the command line and arguments to be run.
14 */ 14 */
15 library test_suite; 15 library test_suite;
16 16
17 import "dart:async"; 17 import "dart:async";
18 import "dart:io"; 18 import "dart:io";
19 import "drt_updater.dart"; 19 import "drt_updater.dart";
20 import "html_test.dart" as htmlTest; 20 import "html_test.dart" as htmlTest;
21 import "path.dart"; 21 import "path.dart";
22 import "multitest.dart"; 22 import "multitest.dart";
23 import "status_file_parser.dart"; 23 import "status_file_parser.dart";
24 import "summary_report.dart";
24 import "test_runner.dart"; 25 import "test_runner.dart";
25 import "utils.dart"; 26 import "utils.dart";
26 import "http_server.dart" show PREFIX_BUILDDIR, PREFIX_DARTDIR; 27 import "http_server.dart" show PREFIX_BUILDDIR, PREFIX_DARTDIR;
27 28
28 import "compiler_configuration.dart" show 29 import "compiler_configuration.dart" show
29 CommandArtifact, 30 CommandArtifact,
30 CompilerConfiguration; 31 CompilerConfiguration;
31 32
32 import "runtime_configuration.dart" show 33 import "runtime_configuration.dart" show
33 RuntimeConfiguration; 34 RuntimeConfiguration;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 RegExp pattern = configuration['selectors'][suiteName]; 273 RegExp pattern = configuration['selectors'][suiteName];
273 if (!pattern.hasMatch(testCase.displayName)) { 274 if (!pattern.hasMatch(testCase.displayName)) {
274 return; 275 return;
275 } 276 }
276 277
277 // Update Summary report 278 // Update Summary report
278 if (configuration['report']) { 279 if (configuration['report']) {
279 if (testCase.expectCompileError && 280 if (testCase.expectCompileError &&
280 TestUtils.isBrowserRuntime(configuration['runtime']) && 281 TestUtils.isBrowserRuntime(configuration['runtime']) &&
281 new CompilerConfiguration(configuration).hasCompiler) { 282 new CompilerConfiguration(configuration).hasCompiler) {
282 SummaryReport.addCompileErrorSkipTest(); 283 summaryReport.addCompileErrorSkipTest();
283 return; 284 return;
284 } else { 285 } else {
285 SummaryReport.add(testCase); 286 summaryReport.add(testCase);
286 } 287 }
287 } 288 }
288 289
289 // Handle skipped tests 290 // Handle skipped tests
290 if (expectations.contains(Expectation.SKIP) || 291 if (expectations.contains(Expectation.SKIP) ||
291 expectations.contains(Expectation.SKIP_BY_DESIGN)) { 292 expectations.contains(Expectation.SKIP_BY_DESIGN)) {
292 return; 293 return;
293 } 294 }
294 295
295 doTest(testCase); 296 doTest(testCase);
(...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2399 for (var key in PATH_REPLACEMENTS.keys) { 2400 for (var key in PATH_REPLACEMENTS.keys) {
2400 if (path.startsWith(key)) { 2401 if (path.startsWith(key)) {
2401 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); 2402 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]);
2402 break; 2403 break;
2403 } 2404 }
2404 } 2405 }
2405 } 2406 }
2406 return path; 2407 return path;
2407 } 2408 }
2408 } 2409 }
2409
2410
2411 class SummaryReport {
2412 static int total = 0;
2413 static int skipped = 0;
2414 static int skippedByDesign = 0;
2415 static int noCrash = 0;
2416 static int flakyCrash = 0;
2417 static int pass = 0;
2418 static int failOk = 0;
2419 static int fail = 0;
2420 static int crash = 0;
2421 static int timeout = 0;
2422 static int compileErrorSkip = 0;
2423
2424 static List<TestCase> nonStandardTestCases = [];
2425
2426 static void add(TestCase testCase) {
2427 var expectations = testCase.expectedOutcomes;
2428
2429 bool containsFail = expectations.any(
2430 (expectation) => expectation.canBeOutcomeOf(Expectation.FAIL));
2431 bool containsPass = expectations.contains(Expectation.PASS);
2432 bool containsSkip = expectations.contains(Expectation.SKIP);
2433 bool containsSkipByDesign =
2434 expectations.contains(Expectation.SKIP_BY_DESIGN);
2435 bool containsCrash = expectations.contains(Expectation.CRASH);
2436 bool containsOK = expectations.contains(Expectation.OK);
2437 bool containsSlow = expectations.contains(Expectation.SLOW);
2438 bool containsTimeout = expectations.contains(Expectation.TIMEOUT);
2439
2440 ++total;
2441 if (containsSkip) {
2442 ++skipped;
2443 } else if (containsSkipByDesign) {
2444 ++skipped;
2445 ++skippedByDesign;
2446 } else {
2447 // We don't do if-else below because the buckets should be exclusive.
2448 // We keep a count around to guarantee that
2449 int markers = 0;
2450
2451 // Counts the number of flaky tests.
2452 if (containsFail && containsPass && !containsCrash && !containsOK) {
2453 ++noCrash;
2454 ++markers;
2455 }
2456 if (containsCrash && !containsOK && expectations.length > 1) {
2457 ++flakyCrash;
2458 ++markers;
2459 }
2460 if ((containsPass && expectations.length == 1) ||
2461 (containsPass && containsSlow && expectations.length == 2)) {
2462 ++pass;
2463 ++markers;
2464 }
2465 if (containsFail && containsOK) {
2466 ++failOk;
2467 ++markers;
2468 }
2469 if ((containsFail && expectations.length == 1) ||
2470 (containsFail && containsSlow && expectations.length == 2)) {
2471 ++fail;
2472 ++markers;
2473 }
2474 if ((containsCrash && expectations.length == 1) ||
2475 (containsCrash && containsSlow && expectations.length == 2)) {
2476 ++crash;
2477 ++markers;
2478 }
2479 if (containsTimeout && expectations.length == 1) {
2480 ++timeout;
2481 ++markers;
2482 }
2483 if (markers != 1) {
2484 nonStandardTestCases.add(testCase);
2485 }
2486 }
2487 }
2488
2489 static void addCompileErrorSkipTest() {
2490 total++;
2491 compileErrorSkip++;
2492 }
2493
2494 static void printReport() {
2495 if (total == 0) return;
2496 var bogus = nonStandardTestCases.length;
2497 String report = """Total: $total tests
2498 * $skipped tests will be skipped ($skippedByDesign skipped by design)
2499 * $noCrash tests are expected to be flaky but not crash
2500 * $flakyCrash tests are expected to flaky crash
2501 * $pass tests are expected to pass
2502 * $failOk tests are expected to fail that we won't fix
2503 * $fail tests are expected to fail that we should fix
2504 * $crash tests are expected to crash that we should fix
2505 * $timeout tests are allowed to timeout
2506 * $compileErrorSkip tests are skipped on browsers due to compile-time error
2507 * $bogus could not be categorized or are in multiple categories
2508 """;
2509 print(report);
2510 }
2511 }
OLDNEW
« tools/testing/dart/test_options.dart ('K') | « tools/testing/dart/test_progress.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698