OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub | 5 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub |
6 /// tests are integration tests that stage some stuff on the file system, run | 6 /// tests are integration tests that stage some stuff on the file system, run |
7 /// pub, and then validate the results. This library provides an API to build | 7 /// pub, and then validate the results. This library provides an API to build |
8 /// tests like that. | 8 /// tests like that. |
9 library test_pub; | 9 library test_pub; |
10 | 10 |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 | 465 |
466 // If the executable looks like a path, get its full path. That way we | 466 // If the executable looks like a path, get its full path. That way we |
467 // can still find it when we spawn it with a different working directory. | 467 // can still find it when we spawn it with a different working directory. |
468 if (dartBin.contains(Platform.pathSeparator)) { | 468 if (dartBin.contains(Platform.pathSeparator)) { |
469 dartBin = path.absolute(dartBin); | 469 dartBin = path.absolute(dartBin); |
470 } | 470 } |
471 | 471 |
472 // Find the main pub entrypoint. | 472 // Find the main pub entrypoint. |
473 var pubPath = path.join(testDirectory, '..', 'bin', 'pub.dart'); | 473 var pubPath = path.join(testDirectory, '..', 'bin', 'pub.dart'); |
474 | 474 |
475 var dartArgs = [ | 475 var dartArgs = ['--package-root=$_packageRoot/', '--checked', pubPath, |
476 '--package-root=$_packageRoot/', | 476 '--verbose']; |
477 // Make the heap bigger since dart2js uses a lot of memory. | |
478 '--new_gen_heap_size=256', '--old_gen_heap_size=1536', | |
479 '--checked', pubPath, '--verbose' | |
480 ]; | |
481 dartArgs.addAll(args); | 477 dartArgs.addAll(args); |
482 | 478 |
483 if (tokenEndpoint == null) tokenEndpoint = new Future.value(); | 479 if (tokenEndpoint == null) tokenEndpoint = new Future.value(); |
484 var environmentFuture = tokenEndpoint.then((tokenEndpoint) { | 480 var environmentFuture = tokenEndpoint.then((tokenEndpoint) { |
485 var environment = {}; | 481 var environment = {}; |
486 environment['_PUB_TESTING'] = 'true'; | 482 environment['_PUB_TESTING'] = 'true'; |
487 environment['PUB_CACHE'] = pathInSandbox(cachePath); | 483 environment['PUB_CACHE'] = pathInSandbox(cachePath); |
488 environment['DART_SDK'] = pathInSandbox(sdkPath); | 484 environment['DART_SDK'] = pathInSandbox(sdkPath); |
489 if (tokenEndpoint != null) { | 485 if (tokenEndpoint != null) { |
490 environment['_PUB_TEST_TOKEN_ENDPOINT'] = | 486 environment['_PUB_TEST_TOKEN_ENDPOINT'] = |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 bool matches(item, Map matchState) { | 841 bool matches(item, Map matchState) { |
846 if (item is! Pair) return false; | 842 if (item is! Pair) return false; |
847 return _firstMatcher.matches(item.first, matchState) && | 843 return _firstMatcher.matches(item.first, matchState) && |
848 _lastMatcher.matches(item.last, matchState); | 844 _lastMatcher.matches(item.last, matchState); |
849 } | 845 } |
850 | 846 |
851 Description describe(Description description) { | 847 Description describe(Description description) { |
852 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 848 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
853 } | 849 } |
854 } | 850 } |
OLD | NEW |