OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 @TestOn("vm") | 5 @TestOn("vm") |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 import 'dart:math' as math; |
8 | 9 |
9 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
10 import 'package:test/src/util/exit_codes.dart' as exit_codes; | 11 import 'package:test/src/util/exit_codes.dart' as exit_codes; |
11 import 'package:test/src/util/io.dart'; | 12 import 'package:test/src/util/io.dart'; |
12 import 'package:test/test.dart'; | 13 import 'package:test/test.dart'; |
13 | 14 |
14 import '../io.dart'; | 15 import '../io.dart'; |
15 | 16 |
16 String _sandbox; | 17 String _sandbox; |
17 | 18 |
(...skipping 10 matching lines...) Expand all Loading... |
28 final _failure = """ | 29 final _failure = """ |
29 import 'dart:async'; | 30 import 'dart:async'; |
30 | 31 |
31 import 'package:test/test.dart'; | 32 import 'package:test/test.dart'; |
32 | 33 |
33 void main() { | 34 void main() { |
34 test("failure", () => throw new TestFailure("oh no")); | 35 test("failure", () => throw new TestFailure("oh no")); |
35 } | 36 } |
36 """; | 37 """; |
37 | 38 |
| 39 final _defaultConcurrency = math.max(1, Platform.numberOfProcessors ~/ 2); |
| 40 |
38 final _usage = """ | 41 final _usage = """ |
39 Usage: pub run test:test [files or directories...] | 42 Usage: pub run test:test [files or directories...] |
40 | 43 |
41 -h, --help Shows this usage information. | 44 -h, --help Shows this usage information. |
42 -n, --name A substring of the name of the test to run. | 45 -n, --name A substring of the name of the test to run. |
43 Regular expression syntax is supported. | 46 Regular expression syntax is supported. |
44 | 47 |
45 -N, --plain-name A plain-text substring of the name of the test to run. | 48 -N, --plain-name A plain-text substring of the name of the test to
run. |
46 -p, --platform The platform(s) on which to run the tests. | 49 -p, --platform The platform(s) on which to run the tests. |
47 [vm (default), chrome] | 50 [vm (default), chrome] |
48 | 51 |
49 --pub-serve=<port> The port of a pub serve instance serving "test/". | 52 -j, --concurrency=<threads> The number of concurrent test suites run. |
50 --[no-]color Whether to use terminal colors. | 53 (defaults to $_defaultConcurrency) |
51 (auto-detected by default) | 54 |
| 55 --pub-serve=<port> The port of a pub serve instance serving "test/". |
| 56 --[no-]color Whether to use terminal colors. |
| 57 (auto-detected by default) |
52 """; | 58 """; |
53 | 59 |
54 void main() { | 60 void main() { |
55 setUp(() { | 61 setUp(() { |
56 _sandbox = createTempDir(); | 62 _sandbox = createTempDir(); |
57 }); | 63 }); |
58 | 64 |
59 tearDown(() { | 65 tearDown(() { |
60 new Directory(_sandbox).deleteSync(recursive: true); | 66 new Directory(_sandbox).deleteSync(recursive: true); |
61 }); | 67 }); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 }); | 378 }); |
373 }); | 379 }); |
374 }); | 380 }); |
375 } | 381 } |
376 | 382 |
377 ProcessResult _runUnittest(List<String> args) => | 383 ProcessResult _runUnittest(List<String> args) => |
378 runUnittest(args, workingDirectory: _sandbox); | 384 runUnittest(args, workingDirectory: _sandbox); |
379 | 385 |
380 ProcessResult _runDart(List<String> args) => | 386 ProcessResult _runDart(List<String> args) => |
381 runDart(args, workingDirectory: _sandbox); | 387 runDart(args, workingDirectory: _sandbox); |
OLD | NEW |