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

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

Issue 8771007: tools/test.dart: Add summary report of the number of tests with each expectation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 9 years 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
« no previous file with comments | « tools/testing/dart/test_progress.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #library("test_suite"); 5 #library("test_suite");
6 6
7 #import("status_file_parser.dart"); 7 #import("status_file_parser.dart");
8 #import("test_runner.dart"); 8 #import("test_runner.dart");
9 #import("multitest.dart"); 9 #import("multitest.dart");
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // If patterns are given only list the files that match one of the 72 // If patterns are given only list the files that match one of the
73 // patterns. Use the name "suiteName/testName" for cc tests. 73 // patterns. Use the name "suiteName/testName" for cc tests.
74 var patterns = configuration['patterns']; 74 var patterns = configuration['patterns'];
75 if (!patterns.isEmpty()) { 75 if (!patterns.isEmpty()) {
76 var constructedName = '$suiteName/$testName'; 76 var constructedName = '$suiteName/$testName';
77 if (!patterns.some((re) => re.hasMatch(constructedName))) return; 77 if (!patterns.some((re) => re.hasMatch(constructedName))) return;
78 } 78 }
79 79
80 var expectations = testExpectations.expectations(testName); 80 var expectations = testExpectations.expectations(testName);
81 81
82 if (configuration["report"]) {
83 SummaryReport.add(expectations);
84 }
85
82 if (expectations.contains(SKIP)) return; 86 if (expectations.contains(SKIP)) return;
83 87
84 // The cc test runner takes options after the name of the test 88 // The cc test runner takes options after the name of the test
85 // to run. 89 // to run.
86 var args = [testName]; 90 var args = [testName];
87 args.addAll(TestUtils.standardOptions(configuration)); 91 args.addAll(TestUtils.standardOptions(configuration));
88 var timeout = configuration['timeout']; 92 var timeout = configuration['timeout'];
89 93
90 doTest(new TestCase(testName, 94 doTest(new TestCase(testName,
91 runnerPath, 95 runnerPath,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (start != -1) { 204 if (start != -1) {
201 testName = filename.substring(start + 4, filename.length - 5); 205 testName = filename.substring(start + 4, filename.length - 5);
202 } else { 206 } else {
203 // Only multitests in a temporary directory should reach here. 207 // Only multitests in a temporary directory should reach here.
204 start = filename.lastIndexOf(pathSeparator); 208 start = filename.lastIndexOf(pathSeparator);
205 int middle = filename.lastIndexOf('_'); 209 int middle = filename.lastIndexOf('_');
206 testName = filename.substring(start + 1, middle) + pathSeparator + 210 testName = filename.substring(start + 1, middle) + pathSeparator +
207 filename.substring(middle + 1, filename.length - 5); 211 filename.substring(middle + 1, filename.length - 5);
208 } 212 }
209 Set<String> expectations = testExpectations.expectations(testName); 213 Set<String> expectations = testExpectations.expectations(testName);
210 214 if (configuration["report"]) {
215 // Tests with multiple VMOptions are counted more than once.
216 for (var dummy in optionsFromFile["vmOptions"]) {
217 SummaryReport.add(expectations);
218 }
219 }
211 if (expectations.contains(SKIP)) return; 220 if (expectations.contains(SKIP)) return;
212 221
213 isNegative = isNegative || 222 isNegative = isNegative ||
214 (configuration['checked'] && isNegativeIfChecked); 223 (configuration['checked'] && isNegativeIfChecked);
215 var argumentLists = argumentListsFromFile(filename, optionsFromFile); 224 var argumentLists = argumentListsFromFile(filename, optionsFromFile);
216 for (var args in argumentLists) { 225 for (var args in argumentLists) {
217 doTest(new TestCase(testName, 226 doTest(new TestCase(testName,
218 shellPath, 227 shellPath,
219 args, 228 args,
220 timeout, 229 timeout,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 args.add("--enable_leg"); 407 args.add("--enable_leg");
399 } 408 }
400 if (configuration["component"] == "dartc") { 409 if (configuration["component"] == "dartc") {
401 if (configuration["mode"] == "release") { 410 if (configuration["mode"] == "release") {
402 args.add("--optimize"); 411 args.add("--optimize");
403 } 412 }
404 } 413 }
405 return args; 414 return args;
406 } 415 }
407 } 416 }
417
418 class SummaryReport {
419 static int total = 0;
420 static int skipped = 0;
421 static int noCrash = 0;
422 static int pass = 0;
423 static int failOk = 0;
424 static int fail = 0;
425 static int crash = 0;
426 static int timeout = 0;
427
428 static void add(Set<String> expectations) {
429 ++total;
430 if (expectations.contains(SKIP)) {
431 ++skipped;
432 } else {
433 if (expectations.contains(PASS) && expectations.contains(FAIL) &&
434 !expectations.contains(CRASH) && !expectations.contains(OK)) {
435 ++noCrash;
436 }
437 if (expectations.contains(PASS) && expectations.length == 1) {
438 ++pass;
439 }
440 if (expectations.containsAll([FAIL, OK]) && expectations.length == 2) {
441 ++failOk;
442 }
443 if (expectations.contains(FAIL) && expectations.length == 1) {
444 ++fail;
445 }
446 if (expectations.contains(CRASH) && expectations.length == 1) {
447 ++crash;
448 }
449 if (expectations.contains(TIMEOUT)) {
450 ++timeout;
451 }
452 }
453 }
454
455 static void printReport() {
456 if (total == 0) return;
457 String report = """\
458 Total: $total tests
459 * $skipped tests will be skipped
460 * $noCrash tests are expected to be flaky but not crash
461 * $pass tests are expected to pass
462 * $failOk tests are expected to fail that we won't fix
463 * $fail tests are expected to fail that we should fix
464 * $crash tests are expected to crash that we should fix
465 * $timeout tests are allowed to timeout\
466 """;
467 print(report);
468 }
469 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_progress.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698