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

Unified Diff: tools/testing/dart/test_runner.dart

Issue 8889016: Enable Dartium tests in tools/test.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: tools/testing/dart/test_runner.dart
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index 0237dbb6ae584a747f65a1ba6ff9fc01a6712894..392eccb6c644a299d81f35e9f6121b6650ee3ef0 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -68,7 +68,7 @@ class TestCase {
newArguments.addAll(arguments);
var suffixSplit = prefix.split(' ');
suffixSplit.forEach((e) {
- if (!e.isEmpty()) newArguments.add(e);
+ if (!e.isEmpty()) newArguments.add(e);
Mads Ager (google) 2011/12/09 09:21:12 Please undo. Two-space indent plese.
});
arguments = newArguments;
}
@@ -80,6 +80,31 @@ class TestCase {
}
+class CompilingTestCase extends TestCase {
Mads Ager (google) 2011/12/09 09:21:12 Should we call this a BrowserTestCase instead? Whe
+ String compilerPath;
+ List<String> compilerArguments;
+
+ CompilingTestCase(displayName,
+ this.compilerPath,
+ this.compilerArguments,
+ executablePath,
+ arguments,
+ configuration,
+ completedHandler,
+ expectedOutcomes,
+ [isNegative = false]) : super(displayName,
+ executablePath,
+ arguments,
+ configuration,
+ completedHandler,
+ expectedOutcomes,
+ isNegative);
+ // RunningProcess.start() handles CompilingTestCase specially, executing
Mads Ager (google) 2011/12/09 09:21:12 Could you put this comment on the class level inst
+ // the compilation command line first.
+}
+
+
+
class TestOutput {
// The TestCase this is the output from.
TestCase testCase;
@@ -100,7 +125,7 @@ class TestOutput {
bool get unexpectedOutput() => !testCase.expectedOutcomes.contains(result);
- // The Java dartc runner exits with code 253 in case of unhandles
+ // The Java dartc runner exits with code 253 in case of unhandled
// exceptions.
// The VM uses std::abort to terminate on asserts.
// std::abort terminates with exit code 3 on Windows.
@@ -121,7 +146,21 @@ class TestOutput {
bool get hasTimedOut() => timedOut;
- bool get didFail() => exitCode != 0 && !hasCrashed;
+ bool get didFail() {
+ if (exitCode != 0 && !hasCrashed) return true;
+
+ if (testCase is !CompilingTestCase) return false;
+ // Browser tests fail unless stdout contains
Mads Ager (google) 2011/12/09 09:21:12 I would add a blank line before this comment.
Bill Hesse 2011/12/09 12:33:29 Done.
+ // 'Content-Type: text/plain\nPASS'.
+ String previous_line = '';
+ for (String line in stdout) {
+ if (line == 'PASS' && previous_line == 'Content-Type: text/plain') {
+ return false;
+ }
+ previous_line = line;
+ }
+ return true;
+ }
// Reverse result of a negative test.
bool get hasFailed() => (testCase.isNegative ? !didFail : didFail);
@@ -161,15 +200,23 @@ class RunningProcess {
void start() {
Expect.isFalse(testCase.expectedOutcomes.contains(SKIP));
- process = new Process(testCase.executablePath, testCase.arguments);
+ stdout = new List<String>();
+ stderr = new List<String>();
+ if (testCase is CompilingTestCase) {
+
Mads Ager (google) 2011/12/09 09:21:12 ?
Bill Hesse 2011/12/09 12:33:29 Implementation added. On 2011/12/09 09:21:12, Mad
+ }
+ runCommand(testCase.executablePath, testCase.arguments, exitHandler);
+ }
+
+ void runCommand(String executable,
+ List<String> arguments,
+ Function exitHandler(int exitCode)) {
+ process = new Process(executable, arguments);
process.exitHandler = exitHandler;
startTime = new Date.now();
process.start();
-
InputStream stdoutStream = process.stdout;
InputStream stderrStream = process.stderr;
- stdout = new List<String>();
- stderr = new List<String>();
StringInputStream stdoutStringStream = new StringInputStream(stdoutStream);
StringInputStream stderrStringStream = new StringInputStream(stderrStream);
stdoutStringStream.dataHandler =
@@ -179,6 +226,8 @@ class RunningProcess {
timeoutTimer = new Timer(timeoutHandler, 1000 * testCase.timeout, false);
}
+
+
void timeoutHandler(Timer unusedTimer) {
timedOut = true;
process.kill();

Powered by Google App Engine
This is Rietveld 408576698