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

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

Issue 150223002: Add 'static type error' tags to multitests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename 'static type error' to 'checked mode compile-time error'. Created 6 years, 8 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
« no previous file with comments | « tools/testing/dart/test_progress.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | 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) 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 executing tests. 6 * Classes and methods for executing tests.
7 * 7 *
8 * This module includes: 8 * This module includes:
9 * - Managing parallel execution of tests, including timeout checks. 9 * - Managing parallel execution of tests, including timeout checks.
10 * - Evaluating the output of each test as pass/fail/crash/timeout. 10 * - Evaluating the output of each test as pass/fail/crash/timeout.
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 this.commands, 719 this.commands,
720 this.configuration, 720 this.configuration,
721 this.expectedOutcomes, 721 this.expectedOutcomes,
722 {this.isNegative: false, 722 {this.isNegative: false,
723 this.info: null}) { 723 this.info: null}) {
724 if (!isNegative) { 724 if (!isNegative) {
725 this.isNegative = displayName.contains("negative_test"); 725 this.isNegative = displayName.contains("negative_test");
726 } 726 }
727 } 727 }
728 728
729 /// Returns `true` if this test case should result in a compile-time error,
730 /// either unconditionally or if the configuration is 'checked'.
731 bool get expectCompileError {
732 if (info == null) return false;
733 return info.hasCompileError ||
734 (configuration['checked'] && info.hasCompileErrorIfChecked);
735 }
736
729 bool get unexpectedOutput { 737 bool get unexpectedOutput {
730 var outcome = lastCommandOutput.result(this); 738 var outcome = lastCommandOutput.result(this);
731 return !expectedOutcomes.any((expectation) { 739 return !expectedOutcomes.any((expectation) {
732 return outcome.canBeOutcomeOf(expectation); 740 return outcome.canBeOutcomeOf(expectation);
733 }); 741 });
734 } 742 }
735 743
736 Expectation get result => lastCommandOutput.result(this); 744 Expectation get result => lastCommandOutput.result(this);
737 745
738 CommandOutput get lastCommandOutput { 746 CommandOutput get lastCommandOutput {
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 if (hasCrashed) return Expectation.CRASH; 1397 if (hasCrashed) return Expectation.CRASH;
1390 if (hasTimedOut) return Expectation.TIMEOUT; 1398 if (hasTimedOut) return Expectation.TIMEOUT;
1391 1399
1392 // Get the errors/warnings from the analyzer 1400 // Get the errors/warnings from the analyzer
1393 List<String> errors = []; 1401 List<String> errors = [];
1394 List<String> warnings = []; 1402 List<String> warnings = [];
1395 parseAnalyzerOutput(errors, warnings); 1403 parseAnalyzerOutput(errors, warnings);
1396 1404
1397 // Handle errors / missing errors 1405 // Handle errors / missing errors
1398 if (testCase.info.hasCompileError) { 1406 if (testCase.info.hasCompileError) {
1407 // Don't use [TestCase.expectCompileError] since the analyzer does not
1408 // (currently) report checked-mode only compile time errors.
1399 if (errors.length > 0) { 1409 if (errors.length > 0) {
1400 return Expectation.PASS; 1410 return Expectation.PASS;
1401 } 1411 }
1402 return Expectation.MISSING_COMPILETIME_ERROR; 1412 return Expectation.MISSING_COMPILETIME_ERROR;
1403 } 1413 }
1404 if (errors.length > 0) { 1414 if (errors.length > 0) {
1405 return Expectation.COMPILETIME_ERROR; 1415 return Expectation.COMPILETIME_ERROR;
1406 } 1416 }
1407 1417
1408 // Handle static warnings / missing static warnings 1418 // Handle static warnings / missing static warnings
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 int pid) 1485 int pid)
1476 : super(command, exitCode, timedOut, stdout, stderr, time, false, pid); 1486 : super(command, exitCode, timedOut, stdout, stderr, time, false, pid);
1477 1487
1478 Expectation result(TestCase testCase) { 1488 Expectation result(TestCase testCase) {
1479 // Handle crashes and timeouts first 1489 // Handle crashes and timeouts first
1480 if (hasCrashed) return Expectation.CRASH; 1490 if (hasCrashed) return Expectation.CRASH;
1481 if (hasTimedOut) return Expectation.TIMEOUT; 1491 if (hasTimedOut) return Expectation.TIMEOUT;
1482 1492
1483 // Multitests are handled specially 1493 // Multitests are handled specially
1484 if (testCase.info != null) { 1494 if (testCase.info != null) {
1485 if (testCase.info.hasCompileError) { 1495 if (testCase.expectCompileError) {
1486 if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) { 1496 if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) {
1487 return Expectation.PASS; 1497 return Expectation.PASS;
1488 } 1498 }
1489 1499
1490 return Expectation.MISSING_COMPILETIME_ERROR; 1500 return Expectation.MISSING_COMPILETIME_ERROR;
1491 } 1501 }
1492 if (testCase.info.hasRuntimeError) { 1502 if (testCase.info.hasRuntimeError) {
1493 // TODO(kustermann): Do we consider a "runtimeError" only an uncaught 1503 // TODO(kustermann): Do we consider a "runtimeError" only an uncaught
1494 // exception or does any nonzero exit code fullfil this requirement? 1504 // exception or does any nonzero exit code fullfil this requirement?
1495 if (exitCode != 0) { 1505 if (exitCode != 0) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 1542
1533 // Handle dart2js/dart2dart specific crash detection 1543 // Handle dart2js/dart2dart specific crash detection
1534 if (exitCode == DART2JS_EXITCODE_CRASH || 1544 if (exitCode == DART2JS_EXITCODE_CRASH ||
1535 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_COMPILE_TIME_ERROR || 1545 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_COMPILE_TIME_ERROR ||
1536 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_UNCAUGHT_EXCEPTION) { 1546 exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_UNCAUGHT_EXCEPTION) {
1537 return Expectation.CRASH; 1547 return Expectation.CRASH;
1538 } 1548 }
1539 1549
1540 // Multitests are handled specially 1550 // Multitests are handled specially
1541 if (testCase.info != null) { 1551 if (testCase.info != null) {
1542 if (testCase.info.hasCompileError) { 1552 if (testCase.expectCompileError) {
1543 // Nonzero exit code of the compiler means compilation failed 1553 // Nonzero exit code of the compiler means compilation failed
1544 // TODO(kustermann): Do we have a special exit code in that case??? 1554 // TODO(kustermann): Do we have a special exit code in that case???
1545 if (exitCode != 0) { 1555 if (exitCode != 0) {
1546 return Expectation.PASS; 1556 return Expectation.PASS;
1547 } 1557 }
1548 return Expectation.MISSING_COMPILETIME_ERROR; 1558 return Expectation.MISSING_COMPILETIME_ERROR;
1549 } 1559 }
1550 1560
1551 // TODO(kustermann): This is a hack, remove it 1561 // TODO(kustermann): This is a hack, remove it
1552 if (testCase.info.hasRuntimeError && testCase.commands.length > 1) { 1562 if (testCase.info.hasRuntimeError && testCase.commands.length > 1) {
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 } 2867 }
2858 } 2868 }
2859 2869
2860 void eventAllTestsDone() { 2870 void eventAllTestsDone() {
2861 for (var listener in _eventListener) { 2871 for (var listener in _eventListener) {
2862 listener.allDone(); 2872 listener.allDone();
2863 } 2873 }
2864 _allDone(); 2874 _allDone();
2865 } 2875 }
2866 } 2876 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_progress.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698