Chromium Code Reviews| 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..66ee57fad6663244a5a7ec4874d15942c61ab40e 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,12 @@ void testPub(String description, [List<Descriptor> cache, Descriptor app, |
| future.handleException((error) { |
| deleteSandboxIfCreated(); |
| - return false; |
| + try { |
|
Bob Nystrom
2012/05/03 00:15:49
Is this temp code? If not, leave a comment explain
nweiz
2012/05/04 01:03:43
Done.
|
| + throw error; |
| + } catch (var e, var stack) { |
| + reportTestError('$e', '$stack'); |
| + } |
| + return true; |
| }); |
| }); |
| } |
| @@ -107,6 +122,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. |