| 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 // TODO(nweiz): Remove this tag when we can get [packageDir] working without it | 5 // TODO(nweiz): Remove this tag when we can get [packageDir] working without it |
| 6 // (dart-lang/sdk#24022). | 6 // (dart-lang/sdk#24022). |
| 7 library test.test.io; | 7 library test.test.io; |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 StreamMatcher containsInOrder(Iterable<String> strings) => | 95 StreamMatcher containsInOrder(Iterable<String> strings) => |
| 96 inOrder(strings.map((string) => consumeThrough(contains(string)))); | 96 inOrder(strings.map((string) => consumeThrough(contains(string)))); |
| 97 | 97 |
| 98 /// Runs the test executable with the package root set properly. | 98 /// Runs the test executable with the package root set properly. |
| 99 /// | 99 /// |
| 100 /// If [forwardStdio] is true, the standard output and error from the process | 100 /// If [forwardStdio] is true, the standard output and error from the process |
| 101 /// will be printed as part of the parent test. This is used for debugging. | 101 /// will be printed as part of the parent test. This is used for debugging. |
| 102 ScheduledProcess runTest(List args, {String reporter, | 102 ScheduledProcess runTest(List args, {String reporter, |
| 103 int concurrency, Map<String, String> environment, | 103 int concurrency, Map<String, String> environment, |
| 104 bool forwardStdio: false}) { | 104 bool forwardStdio: false}) { |
| 105 reporter ??= "expanded"; | |
| 106 concurrency ??= 1; | 105 concurrency ??= 1; |
| 107 | 106 |
| 108 var allArgs = [ | 107 var allArgs = [ |
| 109 p.absolute(p.join(packageDir, 'bin/test.dart')), | 108 p.absolute(p.join(packageDir, 'bin/test.dart')), |
| 110 "--package-root=${p.join(packageDir, 'packages')}", | 109 "--package-root=${p.join(packageDir, 'packages')}", |
| 111 "--concurrency=$concurrency", | 110 "--concurrency=$concurrency" |
| 112 "--reporter=$reporter" | 111 ]; |
| 113 ]..addAll(args); | 112 if (reporter != null) allArgs.add("--reporter=$reporter"); |
| 113 allArgs.addAll(args); |
| 114 | 114 |
| 115 if (environment == null) environment = {}; | 115 if (environment == null) environment = {}; |
| 116 environment.putIfAbsent("_UNITTEST_USE_COLOR", () => "false"); | 116 environment.putIfAbsent("_DART_TEST_TESTING", () => "true"); |
| 117 | 117 |
| 118 var process = runDart(allArgs, | 118 var process = runDart(allArgs, |
| 119 environment: environment, | 119 environment: environment, |
| 120 description: "dart bin/test.dart"); | 120 description: "dart bin/test.dart"); |
| 121 | 121 |
| 122 if (forwardStdio) { | 122 if (forwardStdio) { |
| 123 process.stdoutStream().listen(print); | 123 process.stdoutStream().listen(print); |
| 124 process.stderrStream().listen(print); | 124 process.stderrStream().listen(print); |
| 125 } | 125 } |
| 126 | 126 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 var match; | 172 var match; |
| 173 while (match == null) { | 173 while (match == null) { |
| 174 var line = await pub.stdout.next(); | 174 var line = await pub.stdout.next(); |
| 175 match = _servingRegExp.firstMatch(line); | 175 match = _servingRegExp.firstMatch(line); |
| 176 } | 176 } |
| 177 _pubServePortCompleter.complete(int.parse(match[1])); | 177 _pubServePortCompleter.complete(int.parse(match[1])); |
| 178 }, "waiting for pub serve to emit its port number"); | 178 }, "waiting for pub serve to emit its port number"); |
| 179 | 179 |
| 180 return pub; | 180 return pub; |
| 181 } | 181 } |
| OLD | NEW |