| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 String pathInSandbox(path) => join(getFullPath(sandboxDir), path); | 247 String pathInSandbox(path) => join(getFullPath(sandboxDir), path); |
| 248 | 248 |
| 249 return ensureDir(pathInSandbox(appPath)).chain((_) { | 249 return ensureDir(pathInSandbox(appPath)).chain((_) { |
| 250 // Find a dart executable we can use to run pub. Uses the one that the | 250 // Find a dart executable we can use to run pub. Uses the one that the |
| 251 // test infrastructure uses. We are not using new Options.executable here | 251 // test infrastructure uses. We are not using new Options.executable here |
| 252 // because that gets confused if you invoked Dart through a shell script. | 252 // because that gets confused if you invoked Dart through a shell script. |
| 253 var scriptDir = new File(new Options().script).directorySync().path; | 253 var scriptDir = new File(new Options().script).directorySync().path; |
| 254 var platform = Platform.operatingSystem; | 254 var platform = Platform.operatingSystem; |
| 255 var dartBin = join(scriptDir, '../../../tools/testing/bin/$platform/dart')
; | 255 var dartBin = join(scriptDir, '../../../tools/testing/bin/$platform/dart')
; |
| 256 | 256 |
| 257 if (platform == 'windows') dartBin = '$dartBin.exe'; |
| 258 |
| 257 // Find the main pub entrypoint. | 259 // Find the main pub entrypoint. |
| 258 var pubPath = fs.joinPaths(scriptDir, '../../pub/pub.dart'); | 260 var pubPath = fs.joinPaths(scriptDir, '../../pub/pub.dart'); |
| 259 | 261 |
| 260 var dartArgs = | 262 var dartArgs = |
| 261 ['--enable-type-checks', '--enable-asserts', pubPath, '--trace']; | 263 ['--enable-type-checks', '--enable-asserts', pubPath, '--trace']; |
| 262 dartArgs.addAll(args); | 264 dartArgs.addAll(args); |
| 263 | 265 |
| 264 var environment = new Map.from(Platform.environment); | 266 var environment = new Map.from(Platform.environment); |
| 265 environment['PUB_CACHE'] = pathInSandbox(cachePath); | 267 environment['PUB_CACHE'] = pathInSandbox(cachePath); |
| 266 environment['DART_SDK'] = pathInSandbox(sdkPath); | 268 environment['DART_SDK'] = pathInSandbox(sdkPath); |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 } | 808 } |
| 807 | 809 |
| 808 /** | 810 /** |
| 809 * Schedules a callback to be called after Pub is run with [runPub], even if it | 811 * Schedules a callback to be called after Pub is run with [runPub], even if it |
| 810 * fails. | 812 * fails. |
| 811 */ | 813 */ |
| 812 void _scheduleCleanup(_ScheduledEvent event) { | 814 void _scheduleCleanup(_ScheduledEvent event) { |
| 813 if (_scheduledCleanup == null) _scheduledCleanup = []; | 815 if (_scheduledCleanup == null) _scheduledCleanup = []; |
| 814 _scheduledCleanup.add(event); | 816 _scheduledCleanup.add(event); |
| 815 } | 817 } |
| OLD | NEW |