| Index: utils/tests/pub/test_pub.dart
|
| diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart
|
| index 6e7f209814306f4b9dbb2f8c4757c524201e992c..f7ae3a95ee9ae6f6671aee264fac34764006d93c 100644
|
| --- a/utils/tests/pub/test_pub.dart
|
| +++ b/utils/tests/pub/test_pub.dart
|
| @@ -202,19 +202,26 @@ void schedulePub([List<String> args, Pattern output, Pattern error,
|
| String pathInSandbox(path) => join(getFullPath(sandboxDir), path);
|
|
|
| return ensureDir(pathInSandbox(appPath)).chain((_) {
|
| - // TODO(rnystrom): Hack in the cache directory path. Should pass this in
|
| - // using environment var once #752 is done.
|
| - args.insertRange(0, 1, '--cachedir=${pathInSandbox(cachePath)}');
|
| -
|
| - // TODO(rnystrom): Hack in the SDK path. Should pass this in using
|
| - // environment var once #752 is done.
|
| - args.insertRange(0, 1, '--sdkdir=${pathInSandbox(sdkPath)}');
|
| -
|
| - // If an error occurs in pub during testing, we want it to print the stack
|
| - // trace so it can be debugged.
|
| - args.insertRange(0, 1, '--trace');
|
| -
|
| - return _runPub(args, pathInSandbox(appPath), pipeStdout: output == null,
|
| + // Find a dart executable we can use to run pub. Uses the one that the
|
| + // test infrastructure uses. We are not using new Options.executable here
|
| + // because that gets confused if you invoked Dart through a shell script.
|
| + var scriptDir = new File(new Options().script).directorySync().path;
|
| + var platform = Platform.operatingSystem;
|
| + var dartBin = join(scriptDir, '../../../tools/testing/bin/$platform/dart');
|
| +
|
| + // Find the main pub entrypoint.
|
| + var pubPath = fs.joinPaths(scriptDir, '../../pub/pub.dart');
|
| +
|
| + var dartArgs =
|
| + ['--enable-type-checks', '--enable-asserts', pubPath, '--trace'];
|
| + dartArgs.addAll(args);
|
| +
|
| + var environment = new Map.from(Platform.environment);
|
| + environment['PUB_CACHE'] = pathInSandbox(cachePath);
|
| + environment['DART_SDK'] = pathInSandbox(sdkPath);
|
| +
|
| + return runProcess(dartBin, dartArgs, workingDir: pathInSandbox(appPath),
|
| + environment: environment, pipeStdout: output == null,
|
| pipeStderr: error == null);
|
| }).transform((result) {
|
| _validateOutput(output, result.stdout);
|
| @@ -278,24 +285,6 @@ Future _runScheduled(Directory parentDir, List<_ScheduledEvent> scheduled) {
|
| return runNextEvent();
|
| }
|
|
|
| -Future<ProcessResult> _runPub(List<String> pubArgs, String workingDir,
|
| - [bool pipeStdout=false, bool pipeStderr=false]) {
|
| - // Find a dart executable we can use to run pub. Uses the one that the
|
| - // test infrastructure uses. We are not using new Options.executable here
|
| - // because that gets confused if you invoked Dart through a shell script.
|
| - final scriptDir = new File(new Options().script).directorySync().path;
|
| - final platform = Platform.operatingSystem;
|
| - final dartBin = join(scriptDir, '../../../tools/testing/bin/$platform/dart');
|
| -
|
| - // Find the main pub entrypoint.
|
| - final pubPath = fs.joinPaths(scriptDir, '../../pub/pub.dart');
|
| -
|
| - final args = ['--enable-type-checks', '--enable-asserts', pubPath];
|
| - args.addAll(pubArgs);
|
| -
|
| - return runProcess(dartBin, args, workingDir, pipeStdout, pipeStderr);
|
| -}
|
| -
|
| /**
|
| * Compares the [actual] output from running pub with [expected]. For [String]
|
| * patterns, ignores leading and trailing whitespace differences and tries to
|
|
|