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

Unified Diff: test/io.dart

Issue 1094533005: When testing, make sure we run Dart from an absolute path. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | 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 46b42623f1226ea65e63a6c25e39c99b651c0373..a783634ca4d9f15782304ca317b710ded04c804c 100644
--- a/test/io.dart
+++ b/test/io.dart
@@ -14,9 +14,9 @@ import 'package:test/src/util/io.dart';
final String packageDir = p.dirname(p.dirname(libraryPath(#test.test.io)));
/// The path to the `pub` executable in the current Dart SDK.
-final _pubPath = p.join(
+final _pubPath = p.absolute(p.join(
p.dirname(Platform.executable),
- Platform.isWindows ? 'pub.bat' : 'pub');
+ Platform.isWindows ? 'pub.bat' : 'pub'));
/// Runs the test executable with the package root set properly.
ProcessResult runUnittest(List<String> args, {String workingDirectory,
@@ -37,10 +37,16 @@ ProcessResult runUnittest(List<String> args, {String workingDirectory,
/// Runs Dart.
ProcessResult runDart(List<String> args, {String workingDirectory,
Map<String, String> environment}) {
- var allArgs = Platform.executableArguments.toList()..addAll(args);
+ var allArgs = Platform.executableArguments.map((arg) {
+ // The package root might be relative, so we need to make it absolute if
+ // we're going to run in a different working directory.
+ if (!arg.startsWith("--package-root=")) return arg;
+ return "--package-root=" +
+ p.absolute(arg.substring("--package-root=".length));
+ }).toList()..addAll(args);
// TODO(nweiz): Use ScheduledProcess once it's compatible.
- return Process.runSync(Platform.executable, allArgs,
+ return Process.runSync(p.absolute(Platform.executable), allArgs,
workingDirectory: workingDirectory, environment: environment);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698