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

Unified Diff: lib/src/runner/engine.dart

Issue 1056733002: Run test tearDowns and clean up temporary directories when a signal is caught. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/runner/browser/server.dart ('k') | lib/src/runner/reporter/compact.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/engine.dart
diff --git a/lib/src/runner/engine.dart b/lib/src/runner/engine.dart
index 9d3c1bba30b60ea9d7af75f46898073211edb1f3..355686b0e01a5b66f3ac61edd748e9bc7c10c821 100644
--- a/lib/src/runner/engine.dart
+++ b/lib/src/runner/engine.dart
@@ -23,6 +23,9 @@ class Engine {
/// Whether [run] has been called yet.
var _runCalled = false;
+ /// Whether [close] has been called.
+ var _closed = false;
+
/// An unmodifiable list of tests to run.
///
/// These are [LiveTest]s, representing the in-progress state of each test.
@@ -54,6 +57,7 @@ class Engine {
_runCalled = true;
return Future.forEach(liveTests, (liveTest) {
+ if (_closed) return new Future.value();
_onTestStartedController.add(liveTest);
// First, schedule a microtask to ensure that [onTestStarted] fires before
@@ -67,6 +71,12 @@ class Engine {
/// Signals that the caller is done paying attention to test results and the
/// engine should release any resources it has allocated.
- Future close() =>
- Future.wait(liveTests.map((liveTest) => liveTest.close()));
+ ///
+ /// Any actively-running tests are also closed. VM tests are allowed to finish
+ /// running so that any modifications they've made to the filesystem can be
+ /// cleaned up.
+ Future close() {
+ _closed = true;
+ return Future.wait(liveTests.map((liveTest) => liveTest.close()));
+ }
}
« no previous file with comments | « lib/src/runner/browser/server.dart ('k') | lib/src/runner/reporter/compact.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698