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

Side by Side 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, 8 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 unified diff | Download patch
« no previous file with comments | « pubspec.yaml ('k') | test/runner/browser/compact_reporter_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.test.io; 5 library test.test.io;
6 6
7 import 'dart:async';
7 import 'dart:io'; 8 import 'dart:io';
8 9
9 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
10 import 'package:test/src/util/io.dart'; 11 import 'package:test/src/util/io.dart';
11 12
12 /// The path to the root directory of the `test` package. 13 /// The path to the root directory of the `test` package.
13 final String packageDir = p.dirname(p.dirname(libraryPath(#test.test.io))); 14 final String packageDir = p.dirname(p.dirname(libraryPath(#test.test.io)));
14 15
15 /// Runs the test executable with the package root set properly. 16 /// Runs the test executable with the package root set properly.
16 ProcessResult runUnittest(List<String> args, {String workingDirectory, 17 ProcessResult runUnittest(List<String> args, {String workingDirectory,
(...skipping 13 matching lines...) Expand all
30 31
31 /// Runs Dart. 32 /// Runs Dart.
32 ProcessResult runDart(List<String> args, {String workingDirectory, 33 ProcessResult runDart(List<String> args, {String workingDirectory,
33 Map<String, String> environment}) { 34 Map<String, String> environment}) {
34 var allArgs = Platform.executableArguments.toList()..addAll(args); 35 var allArgs = Platform.executableArguments.toList()..addAll(args);
35 36
36 // TODO(nweiz): Use ScheduledProcess once it's compatible. 37 // TODO(nweiz): Use ScheduledProcess once it's compatible.
37 return Process.runSync(Platform.executable, allArgs, 38 return Process.runSync(Platform.executable, allArgs,
38 workingDirectory: workingDirectory, environment: environment); 39 workingDirectory: workingDirectory, environment: environment);
39 } 40 }
41
42 /// Starts the test executable with the package root set properly.
43 Future<Process> startUnittest(List<String> args, {String workingDirectory,
44 Map<String, String> environment}) {
45 var allArgs = [
46 p.absolute(p.join(packageDir, 'bin/test.dart')),
47 "--package-root=${p.join(packageDir, 'packages')}"
48 ]..addAll(args);
49
50 if (environment == null) environment = {};
51 environment.putIfAbsent("_UNITTEST_USE_COLOR", () => "false");
52
53 return startDart(allArgs, workingDirectory: workingDirectory,
54 environment: environment);
55 }
56
57 /// Starts Dart.
58 Future<Process> startDart(List<String> args, {String workingDirectory,
59 Map<String, String> environment}) {
60 var allArgs = Platform.executableArguments.toList()..addAll(args);
61
62 // TODO(nweiz): Use ScheduledProcess once it's compatible.
63 return Process.start(Platform.executable, allArgs,
64 workingDirectory: workingDirectory, environment: environment);
65 }
OLDNEW
« 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