OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
6 * Classes and methods for executing tests. | 6 * Classes and methods for executing tests. |
7 * | 7 * |
8 * This module includes: | 8 * This module includes: |
9 * - Managing parallel execution of tests, including timeout checks. | 9 * - Managing parallel execution of tests, including timeout checks. |
10 * - Evaluating the output of each test as pass/fail/crash/timeout. | 10 * - Evaluating the output of each test as pass/fail/crash/timeout. |
(...skipping 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2332 return; | 2332 return; |
2333 } | 2333 } |
2334 | 2334 |
2335 _process = null; | 2335 _process = null; |
2336 locked = false; | 2336 locked = false; |
2337 _port = -1; | 2337 _port = -1; |
2338 } | 2338 } |
2339 | 2339 |
2340 static Future<String> _firstLine(stream) { | 2340 static Future<String> _firstLine(stream) { |
2341 var completer = new Completer<String>(); | 2341 var completer = new Completer<String>(); |
2342 var first = true; | |
2343 stream.transform(UTF8.decoder) | 2342 stream.transform(UTF8.decoder) |
2344 .transform(new LineSplitter()) | 2343 .transform(new LineSplitter()) |
2345 .listen((line) { | 2344 .listen((line) { |
2346 if (first) { | 2345 if (!completer.isCompleted) { |
2347 completer.complete(line); | 2346 completer.complete(line); |
2348 first = false; | |
2349 } | 2347 } |
2350 // We need to drain a pipe continuously. | 2348 // We need to drain a pipe continuously. |
| 2349 }, onDone: () { |
| 2350 if (!completer.isCompleted) { |
| 2351 completer.completeError( |
| 2352 "DFE kernel compiler server did not sucessfully start up"); |
| 2353 } |
2351 }); | 2354 }); |
2352 return completer.future; | 2355 return completer.future; |
2353 } | 2356 } |
2354 | 2357 |
2355 Future _startProcess() async { | 2358 Future _startProcess() async { |
2356 final executable = io.Platform.executable; | 2359 final executable = io.Platform.executable; |
2357 final arguments = ['utils/kernel-service/kernel-service.dart', '--batch']; | 2360 final arguments = ['utils/kernel-service/kernel-service.dart', '--batch']; |
2358 | 2361 |
2359 try { | 2362 try { |
2360 _port = -1; | 2363 _port = -1; |
2361 _process = await io.Process.start(executable, arguments); | 2364 _process = await io.Process.start(executable, arguments); |
2362 _process.exitCode.then(_onExit); | 2365 _process.exitCode.then(_onExit); |
2363 _process.stderr.drain(); | 2366 _process.stderr.transform(UTF8.decoder).listen(DebugLogger.error); |
2364 | 2367 |
2365 final readyMsg = await _firstLine(_process.stdout); | 2368 final readyMsg = await _firstLine(_process.stdout); |
2366 final data = readyMsg.split(' '); | 2369 final data = readyMsg.split(' '); |
2367 assert(data[0] == 'READY'); | 2370 assert(data[0] == 'READY'); |
2368 | 2371 |
2369 _port = int.parse(data[1]); | 2372 _port = int.parse(data[1]); |
2370 } catch (e) { | 2373 } catch (e) { |
2371 print("Process error:"); | 2374 print("Process error:"); |
2372 print(" Command: $executable ${arguments.join(' ')}"); | 2375 print(" Command: $executable ${arguments.join(' ')}"); |
2373 print(" Error: $e"); | 2376 print(" Error: $e"); |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3309 } | 3312 } |
3310 } | 3313 } |
3311 | 3314 |
3312 void eventAllTestsDone() { | 3315 void eventAllTestsDone() { |
3313 for (var listener in _eventListener) { | 3316 for (var listener in _eventListener) { |
3314 listener.allDone(); | 3317 listener.allDone(); |
3315 } | 3318 } |
3316 _allDone(); | 3319 _allDone(); |
3317 } | 3320 } |
3318 } | 3321 } |
OLD | NEW |