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