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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 print(''); // Print blank line to signal that we are ready. | 99 print(''); // Print blank line to signal that we are ready. |
100 if (testeeConcurrent != null) { | 100 if (testeeConcurrent != null) { |
101 testeeConcurrent(); | 101 testeeConcurrent(); |
102 } | 102 } |
103 // Wait around for the process to be killed. | 103 // Wait around for the process to be killed. |
104 stdin.first.then((_) => exit(0)); | 104 stdin.first.then((_) => exit(0)); |
105 } else { | 105 } else { |
106 var process = new _TestLauncher(); | 106 var process = new _TestLauncher(); |
107 process.launch(pause_on_exit).then((port) { | 107 process.launch(pause_on_exit).then((port) { |
108 String addr = 'ws://localhost:$port/ws'; | 108 String addr = 'ws://localhost:$port/ws'; |
109 var testIndex = 0; | 109 var testIndex = 1; |
110 var totalTests = tests.length - 1; | 110 var totalTests = tests.length; |
111 var name = Platform.script.pathSegments.last; | 111 var name = Platform.script.pathSegments.last; |
112 runZoned(() { | 112 runZoned(() { |
113 new WebSocketVM(new WebSocketVMTarget(addr)).load() | 113 new WebSocketVM(new WebSocketVMTarget(addr)).load() |
114 .then((VM vm) => vm.isolates.first.load()) | 114 .then((VM vm) => vm.isolates.first.load()) |
115 .then((Isolate isolate) => Future.forEach(tests, (test) { | 115 .then((Isolate isolate) => Future.forEach(tests, (test) { |
116 print('Running $name [$testIndex/$totalTests]'); | 116 print('Running $name [$testIndex/$totalTests]'); |
117 testIndex++; | 117 testIndex++; |
118 return test(isolate); | 118 return test(isolate); |
119 })).then((_) => process.requestExit()); | 119 })).then((_) => process.requestExit()); |
120 }, onError: (e, st) { | 120 }, onError: (e, st) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 print(''); // Print blank line to signal that we are ready. | 160 print(''); // Print blank line to signal that we are ready. |
161 if (testeeConcurrent != null) { | 161 if (testeeConcurrent != null) { |
162 await testeeConcurrent(); | 162 await testeeConcurrent(); |
163 } | 163 } |
164 // Wait around for the process to be killed. | 164 // Wait around for the process to be killed. |
165 stdin.first.then((_) => exit(0)); | 165 stdin.first.then((_) => exit(0)); |
166 } else { | 166 } else { |
167 var process = new _TestLauncher(); | 167 var process = new _TestLauncher(); |
168 process.launch(pause_on_exit).then((port) async { | 168 process.launch(pause_on_exit).then((port) async { |
169 String addr = 'ws://localhost:$port/ws'; | 169 String addr = 'ws://localhost:$port/ws'; |
170 var testIndex = 0; | 170 var testIndex = 1; |
171 var totalTests = tests.length - 1; | 171 var totalTests = tests.length; |
172 var name = Platform.script.pathSegments.last; | 172 var name = Platform.script.pathSegments.last; |
173 runZoned(() { | 173 runZoned(() { |
174 new WebSocketVM(new WebSocketVMTarget(addr)).load() | 174 new WebSocketVM(new WebSocketVMTarget(addr)).load() |
175 .then((VM vm) => Future.forEach(tests, (test) { | 175 .then((VM vm) => Future.forEach(tests, (test) { |
176 print('Running $name [$testIndex/$totalTests]'); | 176 print('Running $name [$testIndex/$totalTests]'); |
177 testIndex++; | 177 testIndex++; |
178 return test(vm); | 178 return test(vm); |
179 })).then((_) => process.requestExit()); | 179 })).then((_) => process.requestExit()); |
180 }, onError: (e, st) { | 180 }, onError: (e, st) { |
181 if (!_isWebSocketDisconnect(e)) { | 181 if (!_isWebSocketDisconnect(e)) { |
182 print('Unexpected exception in service tests: $e $st'); | 182 print('Unexpected exception in service tests: $e $st'); |
183 throw e; | 183 throw e; |
184 } | 184 } |
185 }); | 185 }); |
186 }); | 186 }); |
187 } | 187 } |
188 } | 188 } |
OLD | NEW |