Index: tools/testing/dart/test_runner.dart |
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart |
index 57c3cb758d78ff3870b788190d23a1f057cb531c..3dfcdafffacb9cd9bceef47596c4bbbdff1f4c5c 100644 |
--- a/tools/testing/dart/test_runner.dart |
+++ b/tools/testing/dart/test_runner.dart |
@@ -22,10 +22,10 @@ import "dart:math" as math; |
import 'android.dart'; |
import "browser_controller.dart"; |
import 'dependency_graph.dart' as dgraph; |
-import "expectation.dart"; |
import "path.dart"; |
import 'record_and_replay.dart'; |
import "runtime_configuration.dart"; |
+import "status_file_parser.dart"; |
import "test_progress.dart"; |
import "test_suite.dart"; |
import "utils.dart"; |
@@ -496,10 +496,10 @@ class CleanDirectoryCopyCommand extends ScriptCommand { |
}); |
}).then((_) { |
return new ScriptCommandOutputImpl( |
- this, Expectation.pass, "", watch.elapsed); |
+ this, Expectation.PASS, "", watch.elapsed); |
}).catchError((error) { |
return new ScriptCommandOutputImpl( |
- this, Expectation.fail, "An error occured: $error.", watch.elapsed); |
+ this, Expectation.FAIL, "An error occured: $error.", watch.elapsed); |
}); |
} |
@@ -541,10 +541,10 @@ class MakeSymlinkCommand extends ScriptCommand { |
}).then((_) => link.create(_target)); |
}).then((_) { |
return new ScriptCommandOutputImpl( |
- this, Expectation.pass, "", watch.elapsed); |
+ this, Expectation.PASS, "", watch.elapsed); |
}).catchError((error) { |
return new ScriptCommandOutputImpl( |
- this, Expectation.fail, "An error occured: $error.", watch.elapsed); |
+ this, Expectation.FAIL, "An error occured: $error.", watch.elapsed); |
}); |
} |
@@ -827,7 +827,7 @@ class TestCase extends UniqueObject { |
} |
int get timeout { |
- if (expectedOutcomes.contains(Expectation.slow)) { |
+ if (expectedOutcomes.contains(Expectation.SLOW)) { |
return configuration['timeout'] * SLOW_TIMEOUT_MULTIPLIER; |
} else { |
return configuration['timeout']; |
@@ -849,13 +849,13 @@ class TestCase extends UniqueObject { |
} |
bool get isFlaky { |
- if (expectedOutcomes.contains(Expectation.skip) || |
- expectedOutcomes.contains(Expectation.skipByDesign)) { |
+ if (expectedOutcomes.contains(Expectation.SKIP) || |
+ expectedOutcomes.contains(Expectation.SKIP_BY_DESIGN)) { |
return false; |
} |
return expectedOutcomes |
- .where((expectation) => expectation.isOutcome) |
+ .where((expectation) => !expectation.isMetaExpectation) |
.length > |
1; |
} |
@@ -903,9 +903,9 @@ class UnittestSuiteMessagesMixin { |
// If this is an asynchronous test and the asynchronous operation didn't |
// complete successfully, it's outcome is Expectation.FAIL. |
// TODO: maybe we should introduce a AsyncIncomplete marker or so |
- if (outcome == Expectation.pass) { |
+ if (outcome == Expectation.PASS) { |
if (_isAsyncTest(testOutput) && !_isAsyncTestSuccessful(testOutput)) { |
- return Expectation.fail; |
+ return Expectation.FAIL; |
} |
} |
return outcome; |
@@ -982,11 +982,11 @@ class CommandOutputImpl extends UniqueObject implements CommandOutput { |
} |
Expectation result(TestCase testCase) { |
- if (hasCrashed) return Expectation.crash; |
- if (hasTimedOut) return Expectation.timeout; |
- if (hasFailed(testCase)) return Expectation.fail; |
- if (hasNonUtf8) return Expectation.nonUtf8Error; |
- return Expectation.pass; |
+ if (hasCrashed) return Expectation.CRASH; |
+ if (hasTimedOut) return Expectation.TIMEOUT; |
+ if (hasFailed(testCase)) return Expectation.FAIL; |
+ if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
+ return Expectation.PASS; |
} |
bool get hasCrashed { |
@@ -1038,11 +1038,11 @@ class CommandOutputImpl extends UniqueObject implements CommandOutput { |
Expectation _negateOutcomeIfNegativeTest( |
Expectation outcome, bool isNegative) { |
if (!isNegative) return outcome; |
- if (outcome == Expectation.ignore) return outcome; |
- if (outcome.canBeOutcomeOf(Expectation.fail)) { |
- return Expectation.pass; |
+ if (outcome == Expectation.IGNORE) return outcome; |
+ if (outcome.canBeOutcomeOf(Expectation.FAIL)) { |
+ return Expectation.PASS; |
} |
- return Expectation.fail; |
+ return Expectation.FAIL; |
} |
} |
@@ -1050,7 +1050,6 @@ class BrowserCommandOutputImpl extends CommandOutputImpl { |
// Although tests are reported as passing, content shell sometimes exits with |
// a nonzero exitcode which makes our dartium builders extremely falky. |
// See: http://dartbug.com/15139. |
- // TODO(rnystrom): Is this still needed? The underlying bug is closed. |
static int WHITELISTED_CONTENTSHELL_EXITCODE = -1073740022; |
static bool isWindows = io.Platform.operatingSystem == 'windows'; |
static bool _failedBecauseOfFlakyInfrastructure( |
@@ -1104,24 +1103,23 @@ class BrowserCommandOutputImpl extends CommandOutputImpl { |
Expectation result(TestCase testCase) { |
if (_infraFailure) { |
- return Expectation.ignore; |
+ return Expectation.IGNORE; |
} |
- |
// Handle crashes and timeouts first |
- if (hasCrashed) return Expectation.crash; |
- if (hasTimedOut) return Expectation.timeout; |
- if (hasNonUtf8) return Expectation.nonUtf8Error; |
+ if (hasCrashed) return Expectation.CRASH; |
+ if (hasTimedOut) return Expectation.TIMEOUT; |
+ if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
var outcome = _getOutcome(); |
if (testCase.hasRuntimeError) { |
- if (!outcome.canBeOutcomeOf(Expectation.runtimeError)) { |
- return Expectation.missingRuntimeError; |
+ if (!outcome.canBeOutcomeOf(Expectation.RUNTIME_ERROR)) { |
+ return Expectation.MISSING_RUNTIME_ERROR; |
} |
} |
if (testCase.isNegative) { |
- if (outcome.canBeOutcomeOf(Expectation.fail)) return Expectation.pass; |
- return Expectation.fail; |
+ if (outcome.canBeOutcomeOf(Expectation.FAIL)) return Expectation.PASS; |
+ return Expectation.FAIL; |
} |
return outcome; |
} |
@@ -1140,9 +1138,9 @@ class BrowserCommandOutputImpl extends CommandOutputImpl { |
Expectation _getOutcome() { |
if (_browserTestFailure) { |
- return Expectation.runtimeError; |
+ return Expectation.RUNTIME_ERROR; |
} |
- return Expectation.pass; |
+ return Expectation.PASS; |
} |
bool get _rendererCrashed => |
@@ -1215,7 +1213,7 @@ class HTMLBrowserCommandOutputImpl extends BrowserCommandOutputImpl { |
compilationSkipped); |
bool didFail(TestCase testCase) { |
- return _getOutcome() != Expectation.pass; |
+ return _getOutcome() != Expectation.PASS; |
} |
bool get _browserTestFailure { |
@@ -1306,17 +1304,17 @@ class BrowserTestJsonResult { |
// test_controller.js: So far I haven't seen anything being reported on |
// "window.compilationerror" |
if (occured('window_compilationerror')) { |
- return Expectation.compileTimeError; |
+ return Expectation.COMPILETIME_ERROR; |
} |
if (occured('sync_exception') || |
occured('window_onerror') || |
occured('script_onerror')) { |
- return Expectation.runtimeError; |
+ return Expectation.RUNTIME_ERROR; |
} |
if (messagesByType['dom'][0].contains('FAIL')) { |
- return Expectation.runtimeError; |
+ return Expectation.RUNTIME_ERROR; |
} |
// We search for these messages in 'print' and 'message_received' because |
@@ -1331,9 +1329,9 @@ class BrowserTestJsonResult { |
if (isAsyncTest) { |
if (isAsyncSuccess) { |
- return Expectation.pass; |
+ return Expectation.PASS; |
} |
- return Expectation.runtimeError; |
+ return Expectation.RUNTIME_ERROR; |
} |
var mainStarted = |
@@ -1342,9 +1340,9 @@ class BrowserTestJsonResult { |
searchForMsg(['print', 'message_received'], 'dart-main-done'); |
if (mainStarted && mainDone) { |
- return Expectation.pass; |
+ return Expectation.PASS; |
} |
- return Expectation.fail; |
+ return Expectation.FAIL; |
} |
} |
@@ -1375,11 +1373,11 @@ class BrowserControllerTestOutcome extends CommandOutputImpl |
} else { |
// Old way of determining whether a test failed or passed. |
if (result.lastKnownMessage.contains("FAIL")) { |
- outcome = Expectation.runtimeError; |
+ outcome = Expectation.RUNTIME_ERROR; |
} else if (result.lastKnownMessage.contains("PASS")) { |
- outcome = Expectation.pass; |
+ outcome = Expectation.PASS; |
} else { |
- outcome = Expectation.runtimeError; |
+ outcome = Expectation.RUNTIME_ERROR; |
} |
} |
@@ -1422,13 +1420,13 @@ class BrowserControllerTestOutcome extends CommandOutputImpl |
Expectation result(TestCase testCase) { |
// Handle timeouts first |
- if (_result.didTimeout) return Expectation.timeout; |
- if (hasNonUtf8) return Expectation.nonUtf8Error; |
+ if (_result.didTimeout) return Expectation.TIMEOUT; |
+ if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
// Multitests are handled specially |
if (testCase.hasRuntimeError) { |
- if (_rawOutcome == Expectation.runtimeError) return Expectation.pass; |
- return Expectation.missingRuntimeError; |
+ if (_rawOutcome == Expectation.RUNTIME_ERROR) return Expectation.PASS; |
+ return Expectation.MISSING_RUNTIME_ERROR; |
} |
return _negateOutcomeIfNegativeTest(_rawOutcome, testCase.isNegative); |
@@ -1460,9 +1458,9 @@ class AnalysisCommandOutputImpl extends CommandOutputImpl { |
// no errors) |
// Handle crashes and timeouts first |
- if (hasCrashed) return Expectation.crash; |
- if (hasTimedOut) return Expectation.timeout; |
- if (hasNonUtf8) return Expectation.nonUtf8Error; |
+ if (hasCrashed) return Expectation.CRASH; |
+ if (hasTimedOut) return Expectation.TIMEOUT; |
+ if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
// Get the errors/warnings from the analyzer |
List<String> errors = []; |
@@ -1472,28 +1470,28 @@ class AnalysisCommandOutputImpl extends CommandOutputImpl { |
// Handle errors / missing errors |
if (testCase.expectCompileError) { |
if (errors.length > 0) { |
- return Expectation.pass; |
+ return Expectation.PASS; |
} |
- return Expectation.missingCompileTimeError; |
+ return Expectation.MISSING_COMPILETIME_ERROR; |
} |
if (errors.length > 0) { |
- return Expectation.compileTimeError; |
+ return Expectation.COMPILETIME_ERROR; |
} |
// Handle static warnings / missing static warnings |
if (testCase.hasStaticWarning) { |
if (warnings.length > 0) { |
- return Expectation.pass; |
+ return Expectation.PASS; |
} |
- return Expectation.missingStaticWarning; |
+ return Expectation.MISSING_STATIC_WARNING; |
} |
if (warnings.length > 0) { |
- return Expectation.staticWarning; |
+ return Expectation.STATIC_WARNING; |
} |
assert(errors.length == 0 && warnings.length == 0); |
assert(!testCase.hasCompileError && !testCase.hasStaticWarning); |
- return Expectation.pass; |
+ return Expectation.PASS; |
} |
void parseAnalyzerOutput(List<String> outErrors, List<String> outWarnings) { |
@@ -1549,38 +1547,38 @@ class VmCommandOutputImpl extends CommandOutputImpl |
Expectation result(TestCase testCase) { |
// Handle crashes and timeouts first |
- if (exitCode == DART_VM_EXITCODE_DFE_ERROR) return Expectation.dartkCrash; |
- if (hasCrashed) return Expectation.crash; |
- if (hasTimedOut) return Expectation.timeout; |
- if (hasNonUtf8) return Expectation.nonUtf8Error; |
+ if (exitCode == DART_VM_EXITCODE_DFE_ERROR) return Expectation.DARTK_CRASH; |
+ if (hasCrashed) return Expectation.CRASH; |
+ if (hasTimedOut) return Expectation.TIMEOUT; |
+ if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
// Multitests are handled specially |
if (testCase.expectCompileError) { |
if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) { |
- return Expectation.pass; |
+ return Expectation.PASS; |
} |
- return Expectation.missingCompileTimeError; |
+ 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.PASS; |
} |
- return Expectation.missingRuntimeError; |
+ return Expectation.MISSING_RUNTIME_ERROR; |
} |
// The actual outcome depends on the exitCode |
Expectation outcome; |
if (exitCode == DART_VM_EXITCODE_COMPILE_TIME_ERROR) { |
- outcome = Expectation.compileTimeError; |
+ outcome = Expectation.COMPILETIME_ERROR; |
} else if (exitCode == DART_VM_EXITCODE_UNCAUGHT_EXCEPTION) { |
- outcome = Expectation.runtimeError; |
+ outcome = Expectation.RUNTIME_ERROR; |
} else if (exitCode != 0) { |
// This is a general fail, in case we get an unknown nonzero exitcode. |
- outcome = Expectation.fail; |
+ outcome = Expectation.FAIL; |
} else { |
- outcome = Expectation.pass; |
+ outcome = Expectation.PASS; |
} |
outcome = _negateOutcomeIfIncompleteAsyncTest(outcome, decodeUtf8(stdout)); |
return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative); |
@@ -1603,23 +1601,23 @@ class CompilationCommandOutputImpl extends CommandOutputImpl { |
Expectation result(TestCase testCase) { |
// Handle general crash/timeout detection. |
- if (hasCrashed) return Expectation.crash; |
+ if (hasCrashed) return Expectation.CRASH; |
if (hasTimedOut) { |
bool isWindows = io.Platform.operatingSystem == 'windows'; |
bool isBrowserTestCase = |
testCase.commands.any((command) => command is BrowserTestCommand); |
// TODO(26060) Dart2js batch mode hangs on Windows under heavy load. |
return (isWindows && isBrowserTestCase) |
- ? Expectation.ignore |
- : Expectation.timeout; |
+ ? Expectation.IGNORE |
+ : Expectation.TIMEOUT; |
} |
- if (hasNonUtf8) return Expectation.nonUtf8Error; |
+ if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
// Handle dart2js specific crash detection |
if (exitCode == DART2JS_EXITCODE_CRASH || |
exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_COMPILE_TIME_ERROR || |
exitCode == VmCommandOutputImpl.DART_VM_EXITCODE_UNCAUGHT_EXCEPTION) { |
- return Expectation.crash; |
+ return Expectation.CRASH; |
} |
// Multitests are handled specially |
@@ -1627,9 +1625,9 @@ class CompilationCommandOutputImpl extends CommandOutputImpl { |
// 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.PASS; |
} |
- return Expectation.missingCompileTimeError; |
+ return Expectation.MISSING_COMPILETIME_ERROR; |
} |
// TODO(kustermann): This is a hack, remove it |
@@ -1637,11 +1635,11 @@ class CompilationCommandOutputImpl extends CommandOutputImpl { |
// 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.compileTimeError; |
+ return Expectation.COMPILETIME_ERROR; |
} |
Expectation outcome = |
- exitCode == 0 ? Expectation.pass : Expectation.compileTimeError; |
+ exitCode == 0 ? Expectation.PASS : Expectation.COMPILETIME_ERROR; |
return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative); |
} |
} |
@@ -1667,12 +1665,12 @@ class KernelCompilationCommandOutputImpl extends CompilationCommandOutputImpl { |
Expectation result(TestCase testCase) { |
Expectation result = super.result(testCase); |
- if (result.canBeOutcomeOf(Expectation.crash)) { |
- return Expectation.dartkCrash; |
- } else if (result.canBeOutcomeOf(Expectation.timeout)) { |
- return Expectation.dartkTimeout; |
- } else if (result.canBeOutcomeOf(Expectation.compileTimeError)) { |
- return Expectation.dartkCompileTimeError; |
+ if (result.canBeOutcomeOf(Expectation.CRASH)) { |
+ return Expectation.DARTK_CRASH; |
+ } else if (result.canBeOutcomeOf(Expectation.TIMEOUT)) { |
+ return Expectation.DARTK_TIMEOUT; |
+ } else if (result.canBeOutcomeOf(Expectation.COMPILETIME_ERROR)) { |
+ return Expectation.DARTK_COMPILETIME_ERROR; |
} |
return result; |
} |
@@ -1693,16 +1691,16 @@ class JsCommandlineOutputImpl extends CommandOutputImpl |
Expectation result(TestCase testCase) { |
// Handle crashes and timeouts first |
- if (hasCrashed) return Expectation.crash; |
- if (hasTimedOut) return Expectation.timeout; |
- if (hasNonUtf8) return Expectation.nonUtf8Error; |
+ if (hasCrashed) return Expectation.CRASH; |
+ if (hasTimedOut) return Expectation.TIMEOUT; |
+ if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
if (testCase.hasRuntimeError) { |
- if (exitCode != 0) return Expectation.pass; |
- return Expectation.missingRuntimeError; |
+ if (exitCode != 0) return Expectation.PASS; |
+ return Expectation.MISSING_RUNTIME_ERROR; |
} |
- var outcome = exitCode == 0 ? Expectation.pass : Expectation.runtimeError; |
+ var outcome = exitCode == 0 ? Expectation.PASS : Expectation.RUNTIME_ERROR; |
outcome = _negateOutcomeIfIncompleteAsyncTest(outcome, decodeUtf8(stdout)); |
return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative); |
} |
@@ -1715,16 +1713,16 @@ class PubCommandOutputImpl extends CommandOutputImpl { |
Expectation result(TestCase testCase) { |
// Handle crashes and timeouts first |
- if (hasCrashed) return Expectation.crash; |
- if (hasTimedOut) return Expectation.timeout; |
- if (hasNonUtf8) return Expectation.nonUtf8Error; |
+ if (hasCrashed) return Expectation.CRASH; |
+ if (hasTimedOut) return Expectation.TIMEOUT; |
+ if (hasNonUtf8) return Expectation.NON_UTF8_ERROR; |
if (exitCode == 0) { |
- return Expectation.pass; |
+ return Expectation.PASS; |
} else if ((command as PubCommand).command == 'get') { |
- return Expectation.pubGetError; |
+ return Expectation.PUB_GET_ERROR; |
} else { |
- return Expectation.fail; |
+ return Expectation.FAIL; |
} |
} |
} |
@@ -1741,9 +1739,9 @@ class ScriptCommandOutputImpl extends CommandOutputImpl { |
Expectation result(TestCase testCase) => _result; |
- bool get canRunDependendCommands => _result == Expectation.pass; |
+ bool get canRunDependendCommands => _result == Expectation.PASS; |
- bool get successful => _result == Expectation.pass; |
+ bool get successful => _result == Expectation.PASS; |
} |
CommandOutput createCommandOutput(Command command, int exitCode, bool timedOut, |