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 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override --checked | 4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override --checked |
5 | 5 |
6 library test_helper; | 6 library test_helper; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 101 } |
102 print(''); // Print blank line to signal that we are ready. | 102 print(''); // Print blank line to signal that we are ready. |
103 if (testeeConcurrent != null) { | 103 if (testeeConcurrent != null) { |
104 testeeConcurrent(); | 104 testeeConcurrent(); |
105 } | 105 } |
106 // Wait around for the process to be killed. | 106 // Wait around for the process to be killed. |
107 stdin.first.then((_) => exit(0)); | 107 stdin.first.then((_) => exit(0)); |
108 } else { | 108 } else { |
109 var process = new _TestLauncher(); | 109 var process = new _TestLauncher(); |
110 process.launch(pause_on_exit).then((port) { | 110 process.launch(pause_on_exit).then((port) { |
111 if (mainArgs.contains("--gdb")) { | |
112 port = 8181; | |
113 } | |
114 String addr = 'ws://localhost:$port/ws'; | 111 String addr = 'ws://localhost:$port/ws'; |
115 var testIndex = 1; | 112 var testIndex = 1; |
116 var totalTests = tests.length; | 113 var totalTests = tests.length; |
117 var name = Platform.script.pathSegments.last; | 114 var name = Platform.script.pathSegments.last; |
118 runZoned(() { | 115 runZoned(() { |
119 new WebSocketVM(new WebSocketVMTarget(addr)).load() | 116 new WebSocketVM(new WebSocketVMTarget(addr)).load() |
120 .then((VM vm) => vm.isolates.first.load()) | 117 .then((VM vm) => vm.isolates.first.load()) |
121 .then((Isolate isolate) => Future.forEach(tests, (test) { | 118 .then((Isolate isolate) => Future.forEach(tests, (test) { |
122 print('Running $name [$testIndex/$totalTests]'); | 119 print('Running $name [$testIndex/$totalTests]'); |
123 testIndex++; | 120 testIndex++; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 185 } |
189 print(''); // Print blank line to signal that we are ready. | 186 print(''); // Print blank line to signal that we are ready. |
190 if (testeeConcurrent != null) { | 187 if (testeeConcurrent != null) { |
191 await testeeConcurrent(); | 188 await testeeConcurrent(); |
192 } | 189 } |
193 // Wait around for the process to be killed. | 190 // Wait around for the process to be killed. |
194 stdin.first.then((_) => exit(0)); | 191 stdin.first.then((_) => exit(0)); |
195 } else { | 192 } else { |
196 var process = new _TestLauncher(); | 193 var process = new _TestLauncher(); |
197 process.launch(pause_on_exit).then((port) async { | 194 process.launch(pause_on_exit).then((port) async { |
198 if (mainArgs.contains("--gdb")) { | |
199 port = 8181; | |
200 } | |
201 String addr = 'ws://localhost:$port/ws'; | 195 String addr = 'ws://localhost:$port/ws'; |
202 var testIndex = 1; | 196 var testIndex = 1; |
203 var totalTests = tests.length; | 197 var totalTests = tests.length; |
204 var name = Platform.script.pathSegments.last; | 198 var name = Platform.script.pathSegments.last; |
205 runZoned(() { | 199 runZoned(() { |
206 new WebSocketVM(new WebSocketVMTarget(addr)).load() | 200 new WebSocketVM(new WebSocketVMTarget(addr)).load() |
207 .then((VM vm) => Future.forEach(tests, (test) { | 201 .then((VM vm) => Future.forEach(tests, (test) { |
208 print('Running $name [$testIndex/$totalTests]'); | 202 print('Running $name [$testIndex/$totalTests]'); |
209 testIndex++; | 203 testIndex++; |
210 return test(vm); | 204 return test(vm); |
211 })).then((_) => process.requestExit()); | 205 })).then((_) => process.requestExit()); |
212 }, onError: (e, st) { | 206 }, onError: (e, st) { |
213 process.requestExit(); | 207 process.requestExit(); |
214 if (!_isWebSocketDisconnect(e)) { | 208 if (!_isWebSocketDisconnect(e)) { |
215 print('Unexpected exception in service tests: $e $st'); | 209 print('Unexpected exception in service tests: $e $st'); |
216 throw e; | 210 throw e; |
217 } | 211 } |
218 }); | 212 }); |
219 }); | 213 }); |
220 } | 214 } |
221 } | 215 } |
OLD | NEW |