OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub | 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub |
7 * tests are integration tests that stage some stuff on the file system, run | 7 * tests are integration tests that stage some stuff on the file system, run |
8 * pub, and then validate the results. This library provides an API to build | 8 * pub, and then validate the results. This library provides an API to build |
9 * tests like that. | 9 * tests like that. |
10 */ | 10 */ |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (sdk == null) return new Future.immediate(null); | 130 if (sdk == null) return new Future.immediate(null); |
131 | 131 |
132 return dir('sdk', sdk).create(sandboxDir); | 132 return dir('sdk', sdk).create(sandboxDir); |
133 } | 133 } |
134 | 134 |
135 Future<ProcessResult> _runPub(List<String> pubArgs, String workingDir) { | 135 Future<ProcessResult> _runPub(List<String> pubArgs, String workingDir) { |
136 // Find a dart executable we can use to run pub. Uses the one that the | 136 // Find a dart executable we can use to run pub. Uses the one that the |
137 // test infrastructure uses. | 137 // test infrastructure uses. |
138 final scriptDir = new File(new Options().script).directorySync().path; | 138 final scriptDir = new File(new Options().script).directorySync().path; |
139 final platform = Platform.operatingSystem; | 139 final platform = Platform.operatingSystem; |
140 final dartBin = join(scriptDir, '../../../tools/testing/bin/$platform/dart'); | 140 final dartBin = new File(new Options().executable).fullPathSync(); |
141 | 141 |
142 // Find the main pub entrypoint. | 142 // Find the main pub entrypoint. |
143 final pubPath = fs.joinPaths(scriptDir, '../../pub/pub.dart'); | 143 final pubPath = fs.joinPaths(scriptDir, '../../pub/pub.dart'); |
144 | 144 |
145 final args = ['--enable-type-checks', '--enable-asserts', pubPath]; | 145 final args = ['--enable-type-checks', '--enable-asserts', pubPath]; |
146 args.addAll(pubArgs); | 146 args.addAll(pubArgs); |
147 | 147 |
148 return runProcess(dartBin, args, workingDir); | 148 return runProcess(dartBin, args, workingDir); |
149 } | 149 } |
150 | 150 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 return Futures.wait(entryFutures).transform((entries) { | 324 return Futures.wait(entryFutures).transform((entries) { |
325 for (final entry in entries) { | 325 for (final entry in entries) { |
326 if (entry != null) return entry; | 326 if (entry != null) return entry; |
327 } | 327 } |
328 | 328 |
329 // If we got here, all of the sub-entries were valid. | 329 // If we got here, all of the sub-entries were valid. |
330 return null; | 330 return null; |
331 }); | 331 }); |
332 } | 332 } |
333 } | 333 } |
OLD | NEW |