Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: tools/testing/dart/android.dart

Issue 1950633003: Fix exit code handling for Android testing. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4
5 library android; 5 library android;
6 6
7 import "dart:async"; 7 import "dart:async";
8 import "dart:convert" show LineSplitter, UTF8; 8 import "dart:convert" show LineSplitter, UTF8;
9 import "dart:core"; 9 import "dart:core";
10 import "dart:collection"; 10 import "dart:collection";
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 int exitCode = result.exitCode; 326 int exitCode = result.exitCode;
327 var lines = result 327 var lines = result
328 .stdout.split('\n') 328 .stdout.split('\n')
329 .where((line) => line.trim().length > 0) 329 .where((line) => line.trim().length > 0)
330 .toList(); 330 .toList();
331 if (lines.length > 0) { 331 if (lines.length > 0) {
332 int index = lines.last.indexOf(MARKER); 332 int index = lines.last.indexOf(MARKER);
333 if (index >= 0) { 333 if (index >= 0) {
334 exitCode = int.parse( 334 exitCode = int.parse(
335 lines.last.substring(index + MARKER.length).trim()); 335 lines.last.substring(index + MARKER.length).trim());
336 exitCode = exitCode.toSigned(8); 336 if (exitCode > 128 && exitCode <= 128 + 31) {
337 // Return negative exit codes for signals 1..31 (128+N for signal N)
338 exitCode = 128 - exitCode;
339 }
337 } else { 340 } else {
338 // In case of timeouts, for example, we won't get the exitcode marker. 341 // In case of timeouts, for example, we won't get the exitcode marker.
339 assert(result.exitCode != 0); 342 assert(result.exitCode != 0);
340 } 343 }
341 } 344 }
342 return new AdbCommandResult( 345 return new AdbCommandResult(
343 result.command, result.stdout, result.stderr, exitCode, 346 result.command, result.stdout, result.stderr, exitCode,
344 result.timedOut); 347 result.timedOut);
345 } 348 }
346 349
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 430
428 void releaseDevice(AdbDevice device) { 431 void releaseDevice(AdbDevice device) {
429 if (_waiter.length > 0) { 432 if (_waiter.length > 0) {
430 Completer completer = _waiter.removeFirst(); 433 Completer completer = _waiter.removeFirst();
431 completer.complete(device); 434 completer.complete(device);
432 } else { 435 } else {
433 _idleDevices.add(device); 436 _idleDevices.add(device);
434 } 437 }
435 } 438 }
436 } 439 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698