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

Unified Diff: tests/standalone/debugger/debug_lib.dart

Issue 14773038: Fixed debugger_test to wait until target process is dead (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/debugger/debug_lib.dart
diff --git a/tests/standalone/debugger/debug_lib.dart b/tests/standalone/debugger/debug_lib.dart
index ff51f9ba5c2ae5bfedb7324459bb7af176d7b503..6658fa4fab36dafe36152004e7494a9b8bd92fa9 100644
--- a/tests/standalone/debugger/debug_lib.dart
+++ b/tests/standalone/debugger/debug_lib.dart
@@ -488,16 +488,30 @@ class Debugger {
}
void close({killDebugee: false}) {
+ void exit() {
+ if (errorsDetected) throw "Errors detected";
+ exit(errors.length);
+ }
if (errorsDetected) {
for (int i = 0; i < errors.length; i++) print(errors[i]);
}
- if (socket != null) socket.close();
+ if (socket != null) {
+ socket.close().catchError((error) {
+ print("Error occured while closing socket: $error");
+ };
+ }
if (killDebugee) {
- targetProcess.kill();
- print("Target process killed");
+ if (!targetProcess.kill()) {
+ print("Could not send kill signal to target process.");
hausner 2013/05/15 15:43:36 After printing this, you still wait for the target
ricow1 2013/05/16 07:19:55 From the api docs: Returns true if the process is
kustermann 2013/05/16 08:06:08 We wait for the exitCode and if the target process
hausner 2013/05/16 15:38:32 Thanks for the explanation Rico and Martin. Thinki
+ } else {
+ print("Successfully sent kill signal to target process.");
+ }
+ targetProcess.exitCode.then((exitCode) {
+ exit();
+ });
+ } else {
+ exit();
}
- if (errorsDetected) throw "Errors detected";
- exit(errors.length);
}
}
@@ -508,7 +522,7 @@ bool RunScript(List script) {
return false;
}
verboseWire = options.arguments.contains("--wire");
-
+
// Pick a port in the upper half of the port number range.
var seed = new DateTime.now().millisecondsSinceEpoch;
Random random = new Random(seed);
@@ -536,11 +550,11 @@ bool RunScript(List script) {
});
},
onError: (e) {
- if (++retries >= 3) {
+ if (++retries >= 3) {
print('unable to find unused port: $e');
var trace = getAttachedStackTrace(e);
if (trace != null) print("StackTrace: $trace");
- return -1;
+ return -1;
} else {
// Retry with another random port.
RunScript(script);
« 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