Chromium Code Reviews| Index: tools/testing/dart/test_runner.dart |
| diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart |
| index 6dbc8af170957ba9c3a8a838e3c077ed27c70d6d..6e5ebbbcca9a51d49c500cb5b37ccae056df0ccc 100644 |
| --- a/tools/testing/dart/test_runner.dart |
| +++ b/tools/testing/dart/test_runner.dart |
| @@ -722,28 +722,52 @@ class TestCase extends UniqueObject { |
| Map configuration; |
| String displayName; |
| - bool isNegative; |
| + static final int IS_NEGATIVE = 1 << 0; |
|
ricow1
2014/04/23 17:49:36
put all these in a seperate section instead of in
|
| + static final int HAS_RUNTIME_ERROR = 1 << 1; |
| + static final int HAS_STATIC_WARNING = 1 << 2; |
| + static final int IS_NEGATIVE_IF_CHECKED = 1 << 3; |
| + static final int HAS_COMPILE_ERROR = 1 << 4; |
| + static final int HAS_COMPILE_ERROR_IF_CHECKED = 1 << 5; |
| + static final int EXPECT_COMPILE_ERROR = 1 << 6; |
| + int _expectations = 0; |
| + int hash = 0; |
| Set<Expectation> expectedOutcomes; |
| - TestInformation info; |
| TestCase(this.displayName, |
| this.commands, |
| this.configuration, |
| this.expectedOutcomes, |
| - {this.isNegative: false, |
| - this.info: null}) { |
| - if (!isNegative) { |
| - this.isNegative = displayName.contains("negative_test"); |
| + {isNegative: false, |
| + TestInformation info: null}) { |
| + if (isNegative || displayName.contains("negative_test")) { |
| + _expectations |= IS_NEGATIVE; |
| + } |
| + // We don't want to keep the entire (large) TestInformation structure. |
| + if (info != null) { |
| + if (info.hasRuntimeError) _expectations |= HAS_RUNTIME_ERROR; |
| + if (info.hasStaticWarning) _expectations |= HAS_STATIC_WARNING; |
| + if (info.isNegativeIfChecked) _expectations |= IS_NEGATIVE_IF_CHECKED; |
| + if (info.hasCompileError) _expectations |= HAS_COMPILE_ERROR; |
| + if (info.hasCompileErrorIfChecked) { |
| + _expectations |= HAS_COMPILE_ERROR_IF_CHECKED; |
| + } |
| + if (info.hasCompileError || |
| + (configuration['checked'] && info.hasCompileErrorIfChecked)) { |
| + _expectations |= EXPECT_COMPILE_ERROR; |
| + } |
|
ricow1
2014/04/23 17:49:36
extract the above to a method, setExpectationsFrom
|
| + hash = info.originTestPath.relativeTo(TestUtils.dartDir) |
| + .toString().hashCode; |
| } |
| } |
| - /// Returns `true` if this test case should result in a compile-time error, |
| - /// either unconditionally or if the configuration is 'checked'. |
| - bool get expectCompileError { |
| - if (info == null) return false; |
| - return info.hasCompileError || |
| - (configuration['checked'] && info.hasCompileErrorIfChecked); |
| - } |
| + bool get isNegative => _expectations & IS_NEGATIVE != 0; |
| + bool get hasRuntimeError => _expectations & HAS_RUNTIME_ERROR != 0; |
| + bool get hasStaticWarning => _expectations & HAS_STATIC_WARNING != 0; |
| + bool get isNegativeIfChecked => _expectations & IS_NEGATIVE_IF_CHECKED != 0; |
| + bool get hasCompileError => _expectations & HAS_COMPILE_ERROR != 0; |
| + bool get hasCompileErrorIfChecked => |
| + _expectations & HAS_COMPILE_ERROR_IF_CHECKED != 0; |
| + bool get expectCompileError => _expectations & EXPECT_COMPILE_ERROR != 0; |
| bool get unexpectedOutput { |
| var outcome = lastCommandOutput.result(this); |
| @@ -1020,7 +1044,7 @@ class BrowserCommandOutputImpl extends CommandOutputImpl { |
| var outcome = _getOutcome(); |
| - if (testCase.info != null && testCase.info.hasRuntimeError) { |
| + if (testCase.hasRuntimeError) { |
| if (!outcome.canBeOutcomeOf(Expectation.RUNTIME_ERROR)) { |
| return Expectation.MISSING_RUNTIME_ERROR; |
| } |
| @@ -1363,11 +1387,9 @@ class BrowserControllerTestOutcome extends CommandOutputImpl |
| if (_result.didTimeout) return Expectation.TIMEOUT; |
| // Multitests are handled specially |
| - if (testCase.info != null) { |
| - if (testCase.info.hasRuntimeError) { |
| - if (_rawOutcome == Expectation.RUNTIME_ERROR) return Expectation.PASS; |
| - return Expectation.MISSING_RUNTIME_ERROR; |
| - } |
| + if (testCase.hasRuntimeError) { |
| + if (_rawOutcome == Expectation.RUNTIME_ERROR) return Expectation.PASS; |
| + return Expectation.MISSING_RUNTIME_ERROR; |
| } |
| return _negateOutcomeIfNegativeTest(_rawOutcome, testCase.isNegative); |
| @@ -1414,7 +1436,7 @@ class AnalysisCommandOutputImpl extends CommandOutputImpl { |
| parseAnalyzerOutput(errors, warnings); |
| // Handle errors / missing errors |
| - if (testCase.info.hasCompileError) { |
| + if (testCase.hasCompileError) { |
| // Don't use [TestCase.expectCompileError] since the analyzer does not |
| // (currently) report checked-mode only compile time errors. |
| if (errors.length > 0) { |
| @@ -1427,7 +1449,7 @@ class AnalysisCommandOutputImpl extends CommandOutputImpl { |
| } |
| // Handle static warnings / missing static warnings |
| - if (testCase.info.hasStaticWarning) { |
| + if (testCase.hasStaticWarning) { |
| if (warnings.length > 0) { |
| return Expectation.PASS; |
| } |
| @@ -1438,8 +1460,8 @@ class AnalysisCommandOutputImpl extends CommandOutputImpl { |
| } |
| assert (errors.length == 0 && warnings.length == 0); |
| - assert (!testCase.info.hasCompileError && |
| - !testCase.info.hasStaticWarning); |
| + assert (!testCase.hasCompileError && |
| + !testCase.hasStaticWarning); |
| return Expectation.PASS; |
| } |
| @@ -1502,22 +1524,19 @@ class VmCommandOutputImpl extends CommandOutputImpl |
| if (hasTimedOut) return Expectation.TIMEOUT; |
| // Multitests are handled specially |
| - if (testCase.info != null) { |
| - if (testCase.expectCompileError) { |
| - if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) { |
| - return Expectation.PASS; |
| - } |
| - |
| - return Expectation.MISSING_COMPILETIME_ERROR; |
| + if (testCase.expectCompileError) { |
| + if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) { |
| + return Expectation.PASS; |
| } |
| - if (testCase.info.hasRuntimeError) { |
| - // TODO(kustermann): Do we consider a "runtimeError" only an uncaught |
| - // exception or does any nonzero exit code fullfil this requirement? |
| - if (exitCode != 0) { |
| - return Expectation.PASS; |
| - } |
| - return Expectation.MISSING_RUNTIME_ERROR; |
| + return Expectation.MISSING_COMPILETIME_ERROR; |
| + } |
| + if (testCase.hasRuntimeError) { |
| + // TODO(kustermann): Do we consider a "runtimeError" only an uncaught |
| + // exception or does any nonzero exit code fullfil this requirement? |
| + if (exitCode != 0) { |
| + return Expectation.PASS; |
| } |
| + return Expectation.MISSING_RUNTIME_ERROR; |
| } |
| // The actual outcome depends on the exitCode |
| @@ -1559,23 +1578,21 @@ class CompilationCommandOutputImpl extends CommandOutputImpl { |
| } |
| // Multitests are handled specially |
| - if (testCase.info != null) { |
| if (testCase.expectCompileError) { |
| - // Nonzero exit code of the compiler means compilation failed |
| - // TODO(kustermann): Do we have a special exit code in that case??? |
| - if (exitCode != 0) { |
| - return Expectation.PASS; |
| - } |
| - return Expectation.MISSING_COMPILETIME_ERROR; |
| + // Nonzero exit code of the compiler means compilation failed |
| + // TODO(kustermann): Do we have a special exit code in that case??? |
| + if (exitCode != 0) { |
| + return Expectation.PASS; |
| } |
| + return Expectation.MISSING_COMPILETIME_ERROR; |
| + } |
| - // TODO(kustermann): This is a hack, remove it |
| - if (testCase.info.hasRuntimeError && testCase.commands.length > 1) { |
| - // We expected to run the test, but we got an compile time error. |
| - // If the compilation succeeded, we wouldn't be in here! |
| - assert(exitCode != 0); |
| - return Expectation.COMPILETIME_ERROR; |
| - } |
| + // TODO(kustermann): This is a hack, remove it |
| + if (testCase.hasRuntimeError && testCase.commands.length > 1) { |
| + // We expected to run the test, but we got an compile time error. |
| + // If the compilation succeeded, we wouldn't be in here! |
| + assert(exitCode != 0); |
| + return Expectation.COMPILETIME_ERROR; |
| } |
| Expectation outcome = |
| @@ -1595,7 +1612,7 @@ class JsCommandlineOutputImpl extends CommandOutputImpl |
| if (hasCrashed) return Expectation.CRASH; |
| if (hasTimedOut) return Expectation.TIMEOUT; |
| - if (testCase.info != null && testCase.info.hasRuntimeError) { |
| + if (testCase.hasRuntimeError) { |
| if (exitCode != 0) return Expectation.PASS; |
| return Expectation.MISSING_RUNTIME_ERROR; |
| } |