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

Unified Diff: test/io.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 | « pubspec.yaml ('k') | test/runner/browser/compact_reporter_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/io.dart
diff --git a/test/io.dart b/test/io.dart
index 9dccdaef5772d4ed5f3c1430ca33f7ea67b2d504..68b6b52e5b39c5ff78fb101d594c9073b9d3b635 100644
--- a/test/io.dart
+++ b/test/io.dart
@@ -4,6 +4,7 @@
library test.test.io;
+import 'dart:async';
import 'dart:io';
import 'package:path/path.dart' as p;
@@ -37,3 +38,28 @@ ProcessResult runDart(List<String> args, {String workingDirectory,
return Process.runSync(Platform.executable, allArgs,
workingDirectory: workingDirectory, environment: environment);
}
+
+/// Starts the test executable with the package root set properly.
+Future<Process> startUnittest(List<String> args, {String workingDirectory,
+ Map<String, String> environment}) {
+ var allArgs = [
+ p.absolute(p.join(packageDir, 'bin/test.dart')),
+ "--package-root=${p.join(packageDir, 'packages')}"
+ ]..addAll(args);
+
+ if (environment == null) environment = {};
+ environment.putIfAbsent("_UNITTEST_USE_COLOR", () => "false");
+
+ return startDart(allArgs, workingDirectory: workingDirectory,
+ environment: environment);
+}
+
+/// Starts Dart.
+Future<Process> startDart(List<String> args, {String workingDirectory,
+ Map<String, String> environment}) {
+ var allArgs = Platform.executableArguments.toList()..addAll(args);
+
+ // TODO(nweiz): Use ScheduledProcess once it's compatible.
+ return Process.start(Platform.executable, allArgs,
+ workingDirectory: workingDirectory, environment: environment);
+}
« no previous file with comments | « pubspec.yaml ('k') | test/runner/browser/compact_reporter_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698