| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 test.integration.analysis; | 5 library test.integration.analysis; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 _process.stdin.add(UTF8.encoder.convert("${line}\n")); | 577 _process.stdin.add(UTF8.encoder.convert("${line}\n")); |
| 578 return completer.future; | 578 return completer.future; |
| 579 } | 579 } |
| 580 | 580 |
| 581 /** | 581 /** |
| 582 * Start the server. If [debugServer] is `true`, the server will be started | 582 * Start the server. If [debugServer] is `true`, the server will be started |
| 583 * with "--debug", allowing a debugger to be attached. If [profileServer] is | 583 * with "--debug", allowing a debugger to be attached. If [profileServer] is |
| 584 * `true`, the server will be started with "--observe" and | 584 * `true`, the server will be started with "--observe" and |
| 585 * "--pause-isolates-on-exit", allowing the observatory to be used. | 585 * "--pause-isolates-on-exit", allowing the observatory to be used. |
| 586 */ | 586 */ |
| 587 Future start({bool debugServer: false, bool profileServer: false}) { | 587 Future start({bool debugServer: false, int diagnosticPort, bool profileServer:
false}) { |
| 588 if (_process != null) { | 588 if (_process != null) { |
| 589 throw new Exception('Process already started'); | 589 throw new Exception('Process already started'); |
| 590 } | 590 } |
| 591 _time.start(); | 591 _time.start(); |
| 592 String dartBinary = Platform.executable; | 592 String dartBinary = Platform.executable; |
| 593 String rootDir = | 593 String rootDir = |
| 594 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); | 594 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); |
| 595 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); | 595 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); |
| 596 List<String> arguments = []; | 596 List<String> arguments = []; |
| 597 if (debugServer) { | 597 if (debugServer) { |
| 598 arguments.add('--debug'); | 598 arguments.add('--debug'); |
| 599 } | 599 } |
| 600 if (profileServer) { | 600 if (profileServer) { |
| 601 arguments.add('--observe'); | 601 arguments.add('--observe'); |
| 602 arguments.add('--pause-isolates-on-exit'); | 602 arguments.add('--pause-isolates-on-exit'); |
| 603 } | 603 } |
| 604 if (Platform.packageRoot.isNotEmpty) { | 604 if (Platform.packageRoot.isNotEmpty) { |
| 605 arguments.add('--package-root=${Platform.packageRoot}'); | 605 arguments.add('--package-root=${Platform.packageRoot}'); |
| 606 } | 606 } |
| 607 arguments.add('--checked'); | 607 arguments.add('--checked'); |
| 608 arguments.add(serverPath); | 608 arguments.add(serverPath); |
| 609 if (diagnosticPort != null) { |
| 610 arguments.add('--port'); |
| 611 arguments.add(diagnosticPort.toString()); |
| 612 } |
| 609 return Process.start(dartBinary, arguments).then((Process process) { | 613 return Process.start(dartBinary, arguments).then((Process process) { |
| 610 _process = process; | 614 _process = process; |
| 611 process.exitCode.then((int code) { | 615 process.exitCode.then((int code) { |
| 612 _recordStdio('TERMINATED WITH EXIT CODE $code'); | 616 _recordStdio('TERMINATED WITH EXIT CODE $code'); |
| 613 if (code != 0) { | 617 if (code != 0) { |
| 614 _badDataFromServer(); | 618 _badDataFromServer(); |
| 615 } | 619 } |
| 616 }); | 620 }); |
| 617 }); | 621 }); |
| 618 } | 622 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 void populateMismatches(item, List<MismatchDescriber> mismatches); | 860 void populateMismatches(item, List<MismatchDescriber> mismatches); |
| 857 | 861 |
| 858 /** | 862 /** |
| 859 * Create a [MismatchDescriber] describing a mismatch with a simple string. | 863 * Create a [MismatchDescriber] describing a mismatch with a simple string. |
| 860 */ | 864 */ |
| 861 MismatchDescriber simpleDescription(String description) => | 865 MismatchDescriber simpleDescription(String description) => |
| 862 (Description mismatchDescription) { | 866 (Description mismatchDescription) { |
| 863 mismatchDescription.add(description); | 867 mismatchDescription.add(description); |
| 864 }; | 868 }; |
| 865 } | 869 } |
| OLD | NEW |