| Index: utils/tests/pub/test_pub.dart
|
| diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart
|
| index ddac2322e53425df15f7d2720bd284eeb36c1c23..afba3e7201713025e21002a4e56265d6c7ede7f5 100644
|
| --- a/utils/tests/pub/test_pub.dart
|
| +++ b/utils/tests/pub/test_pub.dart
|
| @@ -30,10 +30,11 @@ DirectoryDescriptor dir(String name, [List<Descriptor> contents]) =>
|
|
|
| void testPub(String description, [List<Descriptor> cache, Descriptor app,
|
| List<String> args, List<Descriptor> expectedPackageDir,
|
| - String output, int exitCode = 0]) {
|
| + List<Descriptor> sdk, String output, int exitCode = 0]) {
|
| asyncTest(description, 1, () {
|
| var createdSandboxDir;
|
| var createdAppDir;
|
| + var createdSdkDir;
|
|
|
| deleteSandboxIfCreated() {
|
| if (createdSandboxDir != null) {
|
| @@ -50,6 +51,9 @@ void testPub(String description, [List<Descriptor> cache, Descriptor app,
|
| return _setUpApp(sandboxDir, app);
|
| }).chain((appDir) {
|
| createdAppDir = appDir;
|
| + return _setUpSdk(createdSandboxDir, sdk);
|
| + }).chain((sdkDir) {
|
| + createdSdkDir = sdkDir;
|
| return _setUpCache(createdSandboxDir, cache);
|
| }).chain((cacheDir) {
|
| var workingDir;
|
| @@ -61,6 +65,12 @@ void testPub(String description, [List<Descriptor> cache, Descriptor app,
|
| args.add('--cachedir=${getFullPath(cacheDir)}');
|
| }
|
|
|
| + if (createdSdkDir != null) {
|
| + // TODO(rnystrom): Hack in the SDK path. Should pass this in using
|
| + // environment var once #752 is done.
|
| + args.add('--sdkdir=${getFullPath(createdSdkDir)}');
|
| + }
|
| +
|
| return _runPub(args, workingDir);
|
| }).chain((result) {
|
| _validateOutput(output, result.stdout);
|
| @@ -84,7 +94,15 @@ void testPub(String description, [List<Descriptor> cache, Descriptor app,
|
|
|
| future.handleException((error) {
|
| deleteSandboxIfCreated();
|
| - return false;
|
| + // If we encounter an error, we want to pass it to the test framework. In
|
| + // order to get the stack trace information, we need to re-throw and
|
| + // re-catch it.
|
| + try {
|
| + throw error;
|
| + } catch (var e, var stack) {
|
| + reportTestError('$e', '$stack');
|
| + }
|
| + return true;
|
| });
|
| });
|
| }
|
| @@ -107,6 +125,13 @@ Future _setUpApp(Directory sandboxDir, Descriptor app) {
|
| return app.create(sandboxDir);
|
| }
|
|
|
| +Future _setUpSdk(Directory sandboxDir, List<Descriptor> sdk) {
|
| + // No SDK directory.
|
| + if (sdk == null) return new Future.immediate(null);
|
| +
|
| + return dir('sdk', sdk).create(sandboxDir);
|
| +}
|
| +
|
| Future<ProcessResult> _runPub(List<String> pubArgs, String workingDir) {
|
| // Find a dart executable we can use to run pub. Uses the one that the
|
| // test infrastructure uses.
|
|
|