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 |
11 import 'dart:async'; | 11 import 'dart:async'; |
12 import 'dart:collection' show Queue; | 12 import 'dart:collection' show Queue; |
13 import 'dart:io' hide sleep; | 13 import 'dart:io' hide sleep; |
14 import 'dart:json' as json; | 14 import 'dart:json' as json; |
15 import 'dart:math'; | 15 import 'dart:math'; |
16 import 'dart:utf'; | 16 import 'dart:utf'; |
17 | 17 |
18 import 'package:http/testing.dart'; | 18 import 'package:http/testing.dart'; |
19 import 'package:oauth2/oauth2.dart' as oauth2; | 19 import 'package:oauth2/oauth2.dart' as oauth2; |
20 import 'package:pathos/path.dart' as path; | 20 import 'package:pathos/path.dart' as path; |
21 import 'package:scheduled_test/scheduled_process.dart'; | 21 import 'package:scheduled_test/scheduled_process.dart'; |
22 import 'package:scheduled_test/scheduled_server.dart'; | 22 import 'package:scheduled_test/scheduled_server.dart'; |
23 import 'package:scheduled_test/scheduled_test.dart'; | 23 import 'package:scheduled_test/scheduled_test.dart'; |
| 24 import 'package:unittest/compact_vm_config.dart'; |
24 import 'package:yaml/yaml.dart'; | 25 import 'package:yaml/yaml.dart'; |
25 | 26 |
26 import '../lib/src/entrypoint.dart'; | 27 import '../lib/src/entrypoint.dart'; |
27 // TODO(rnystrom): Using "gitlib" as the prefix here is ugly, but "git" collides | 28 // TODO(rnystrom): Using "gitlib" as the prefix here is ugly, but "git" collides |
28 // with the git descriptor method. Maybe we should try to clean up the top level | 29 // with the git descriptor method. Maybe we should try to clean up the top level |
29 // scope a bit? | 30 // scope a bit? |
30 import '../lib/src/git.dart' as gitlib; | 31 import '../lib/src/git.dart' as gitlib; |
31 import '../lib/src/http.dart'; | 32 import '../lib/src/http.dart'; |
32 import '../lib/src/io.dart'; | 33 import '../lib/src/io.dart'; |
33 import '../lib/src/log.dart' as log; | 34 import '../lib/src/log.dart' as log; |
34 import '../lib/src/safe_http_server.dart'; | 35 import '../lib/src/safe_http_server.dart'; |
35 import '../lib/src/source/git.dart'; | 36 import '../lib/src/source/git.dart'; |
36 import '../lib/src/source/hosted.dart'; | 37 import '../lib/src/source/hosted.dart'; |
37 import '../lib/src/source/path.dart'; | 38 import '../lib/src/source/path.dart'; |
38 import '../lib/src/system_cache.dart'; | 39 import '../lib/src/system_cache.dart'; |
39 import '../lib/src/utils.dart'; | 40 import '../lib/src/utils.dart'; |
40 import '../lib/src/validator.dart'; | 41 import '../lib/src/validator.dart'; |
41 import 'command_line_config.dart'; | |
42 import 'descriptor.dart' as d; | 42 import 'descriptor.dart' as d; |
43 | 43 |
44 /// This should be called at the top of a test file to set up an appropriate | 44 /// This should be called at the top of a test file to set up an appropriate |
45 /// test configuration for the machine running the tests. | 45 /// test configuration for the machine running the tests. |
46 initConfig() { | 46 initConfig() { |
47 // If we aren't running on the bots, use the human-friendly config. | 47 useCompactVMConfiguration(); |
48 if (!runningOnBuildbot) { | |
49 unittestConfiguration = new CommandLineConfiguration(); | |
50 } | |
51 } | 48 } |
52 | 49 |
53 /// Returns whether we're running on a Dart build bot. | 50 /// Returns whether we're running on a Dart build bot. |
54 bool get runningOnBuildbot => | 51 bool get runningOnBuildbot => |
55 Platform.environment.containsKey('BUILDBOT_BUILDERNAME'); | 52 Platform.environment.containsKey('BUILDBOT_BUILDERNAME'); |
56 | 53 |
57 /// The current [HttpServer] created using [serve]. | 54 /// The current [HttpServer] created using [serve]. |
58 var _server; | 55 var _server; |
59 | 56 |
60 /// The list of paths that have been requested from the server since the last | 57 /// The list of paths that have been requested from the server since the last |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 bool matches(item, Map matchState) { | 791 bool matches(item, Map matchState) { |
795 if (item is! Pair) return false; | 792 if (item is! Pair) return false; |
796 return _firstMatcher.matches(item.first, matchState) && | 793 return _firstMatcher.matches(item.first, matchState) && |
797 _lastMatcher.matches(item.last, matchState); | 794 _lastMatcher.matches(item.last, matchState); |
798 } | 795 } |
799 | 796 |
800 Description describe(Description description) { | 797 Description describe(Description description) { |
801 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 798 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
802 } | 799 } |
803 } | 800 } |
OLD | NEW |