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

Side by Side Diff: tests/standalone/debugger/debug_lib.dart

Issue 12796012: Use random debug port in basic_debugger_test. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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 used by debugger wire protocol tests (standalone VM debugging). 5 // Library used by debugger wire protocol tests (standalone VM debugging).
6 6
7 library DartDebugger; 7 library DartDebugger;
8 8
9 import "dart:io"; 9 import "dart:io";
10 import "dart:utf"; 10 import "dart:utf";
11 import "dart:json" as JSON; 11 import "dart:json" as JSON;
12 12
13 // TODO(hausner): need to select a different port number for each
14 // test that runs in parallel.
15 var debugPort = 5860;
16
17 // Whether or not to print debug target process on the console. 13 // Whether or not to print debug target process on the console.
18 var showDebuggeeOutput = true; 14 var showDebuggeeOutput = true;
19 15
20 // Whether or not to print the debugger wire messages on the console. 16 // Whether or not to print the debugger wire messages on the console.
21 var verboseWire = false; 17 var verboseWire = false;
22 18
23 // Class to buffer wire protocol data from debug target and 19 // Class to buffer wire protocol data from debug target and
24 // break it down to individual json messages. 20 // break it down to individual json messages.
25 class JsonBuffer { 21 class JsonBuffer {
26 String buffer = null; 22 String buffer = null;
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 void close({killDebugee: false}) { 487 void close({killDebugee: false}) {
492 if (errorsDetected) { 488 if (errorsDetected) {
493 for (int i = 0; i < errors.length; i++) print(errors[i]); 489 for (int i = 0; i < errors.length; i++) print(errors[i]);
494 } 490 }
495 socket.close(); 491 socket.close();
496 if (killDebugee) { 492 if (killDebugee) {
497 targetProcess.kill(); 493 targetProcess.kill();
498 print("Target process killed"); 494 print("Target process killed");
499 } 495 }
500 Expect.isTrue(!errorsDetected); 496 Expect.isTrue(!errorsDetected);
501 stdin.close(); 497 exit(errors.length);
502 stdout.close();
503 stderr.close();
504 } 498 }
505 } 499 }
506 500
507 501
508 bool RunScript(List script) { 502 bool RunScript(List script, int debugPort) {
509 var options = new Options(); 503 var options = new Options();
510 if (options.arguments.contains("--debuggee")) { 504 if (options.arguments.contains("--debuggee")) {
511 return false; 505 return false;
512 } 506 }
513 // The default is to show debugging output. 507 // The default is to show debugging output.
514 showDebuggeeOutput = !options.arguments.contains("--non-verbose"); 508 showDebuggeeOutput = !options.arguments.contains("--non-verbose");
515 verboseWire = options.arguments.contains("--wire"); 509 verboseWire = options.arguments.contains("--wire");
516 510
517 var targetOpts = [ "--debug:$debugPort" ]; 511 var targetOpts = [ "--debug:$debugPort" ];
518 if (showDebuggeeOutput) targetOpts.add("--verbose_debug"); 512 if (showDebuggeeOutput) targetOpts.add("--verbose_debug");
519 targetOpts.add(options.script); 513 targetOpts.add(options.script);
520 targetOpts.add("--debuggee"); 514 targetOpts.add("--debuggee");
521 515
522 Process.start(options.executable, targetOpts).then((Process process) { 516 Process.start(options.executable, targetOpts).then((Process process) {
523 print("Debug target process started"); 517 print("Debug target process started");
524 process.stdin.close(); 518 process.stdin.close();
525 process.exitCode.then((int exitCode) { 519 process.exitCode.then((int exitCode) {
526 Expect.equals(0, exitCode); 520 Expect.equals(0, exitCode);
527 print("Debug target process exited with exit code $exitCode"); 521 print("Debug target process exited with exit code $exitCode");
528 }); 522 });
529 var debugger = new Debugger(process, debugPort); 523 var debugger = new Debugger(process, debugPort);
530 debugger.runScript(script); 524 debugger.runScript(script);
531 }); 525 });
532 return true; 526 return true;
533 } 527 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698