| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 subscription = onServerStatus.listen((ServerStatusParams params) { | 152 subscription = onServerStatus.listen((ServerStatusParams params) { |
| 153 if (params.analysis != null && !params.analysis.isAnalyzing) { | 153 if (params.analysis != null && !params.analysis.isAnalyzing) { |
| 154 completer.complete(params); | 154 completer.complete(params); |
| 155 subscription.cancel(); | 155 subscription.cancel(); |
| 156 } | 156 } |
| 157 }); | 157 }); |
| 158 return completer.future; | 158 return completer.future; |
| 159 } | 159 } |
| 160 | 160 |
| 161 /** | 161 /** |
| 162 * Return `true` if the new analysis driver should be used by these tests. | |
| 163 */ | |
| 164 bool get enableNewAnalysisDriver => false; | |
| 165 | |
| 166 /** | |
| 167 * Print out any messages exchanged with the server. If some messages have | 162 * Print out any messages exchanged with the server. If some messages have |
| 168 * already been exchanged with the server, they are printed out immediately. | 163 * already been exchanged with the server, they are printed out immediately. |
| 169 */ | 164 */ |
| 170 void debugStdio() { | 165 void debugStdio() { |
| 171 server.debugStdio(); | 166 server.debugStdio(); |
| 172 } | 167 } |
| 173 | 168 |
| 174 List<AnalysisError> getErrors(String pathname) => | 169 List<AnalysisError> getErrors(String pathname) => |
| 175 currentAnalysisErrors[pathname]; | 170 currentAnalysisErrors[pathname]; |
| 176 | 171 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 254 } |
| 260 | 255 |
| 261 /** | 256 /** |
| 262 * Start [server]. | 257 * Start [server]. |
| 263 */ | 258 */ |
| 264 Future startServer( | 259 Future startServer( |
| 265 {bool checked: true, int diagnosticPort, int servicesPort}) => | 260 {bool checked: true, int diagnosticPort, int servicesPort}) => |
| 266 server.start( | 261 server.start( |
| 267 checked: checked, | 262 checked: checked, |
| 268 diagnosticPort: diagnosticPort, | 263 diagnosticPort: diagnosticPort, |
| 269 enableNewAnalysisDriver: enableNewAnalysisDriver, | |
| 270 servicesPort: servicesPort); | 264 servicesPort: servicesPort); |
| 271 | 265 |
| 272 /** | 266 /** |
| 273 * After every test, the server is stopped and [sourceDirectory] is deleted. | 267 * After every test, the server is stopped and [sourceDirectory] is deleted. |
| 274 */ | 268 */ |
| 275 Future tearDown() { | 269 Future tearDown() { |
| 276 return shutdownIfNeeded().then((_) { | 270 return shutdownIfNeeded().then((_) { |
| 277 sourceDirectory.deleteSync(recursive: true); | 271 sourceDirectory.deleteSync(recursive: true); |
| 278 }); | 272 }); |
| 279 } | 273 } |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 } | 644 } |
| 651 | 645 |
| 652 /** | 646 /** |
| 653 * Start the server. If [profileServer] is `true`, the server will be started | 647 * Start the server. If [profileServer] is `true`, the server will be started |
| 654 * with "--observe" and "--pause-isolates-on-exit", allowing the observatory | 648 * with "--observe" and "--pause-isolates-on-exit", allowing the observatory |
| 655 * to be used. | 649 * to be used. |
| 656 */ | 650 */ |
| 657 Future start({ | 651 Future start({ |
| 658 bool checked: true, | 652 bool checked: true, |
| 659 int diagnosticPort, | 653 int diagnosticPort, |
| 660 bool enableNewAnalysisDriver: false, | |
| 661 bool profileServer: false, | 654 bool profileServer: false, |
| 662 String sdkPath, | 655 String sdkPath, |
| 663 int servicesPort, | 656 int servicesPort, |
| 664 bool useAnalysisHighlight2: false, | 657 bool useAnalysisHighlight2: false, |
| 665 }) async { | 658 }) async { |
| 666 if (_process != null) { | 659 if (_process != null) { |
| 667 throw new Exception('Process already started'); | 660 throw new Exception('Process already started'); |
| 668 } | 661 } |
| 669 _time.start(); | 662 _time.start(); |
| 670 String dartBinary = Platform.executable; | 663 String dartBinary = Platform.executable; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 if (diagnosticPort != null) { | 697 if (diagnosticPort != null) { |
| 705 arguments.add('--port'); | 698 arguments.add('--port'); |
| 706 arguments.add(diagnosticPort.toString()); | 699 arguments.add(diagnosticPort.toString()); |
| 707 } | 700 } |
| 708 if (sdkPath != null) { | 701 if (sdkPath != null) { |
| 709 arguments.add('--sdk=$sdkPath'); | 702 arguments.add('--sdk=$sdkPath'); |
| 710 } | 703 } |
| 711 if (useAnalysisHighlight2) { | 704 if (useAnalysisHighlight2) { |
| 712 arguments.add('--useAnalysisHighlight2'); | 705 arguments.add('--useAnalysisHighlight2'); |
| 713 } | 706 } |
| 714 if (!enableNewAnalysisDriver) { | |
| 715 arguments.add('--disable-new-analysis-driver'); | |
| 716 } | |
| 717 // print('Launching $serverPath'); | 707 // print('Launching $serverPath'); |
| 718 // print('$dartBinary ${arguments.join(' ')}'); | 708 // print('$dartBinary ${arguments.join(' ')}'); |
| 719 // TODO(devoncarew): We could experiment with instead launching the analysis | 709 // TODO(devoncarew): We could experiment with instead launching the analysis |
| 720 // server in a separate isolate. This would make it easier to debug the | 710 // server in a separate isolate. This would make it easier to debug the |
| 721 // integration tests, and would likely speed the tests up as well. | 711 // integration tests, and would likely speed the tests up as well. |
| 722 _process = await Process.start(dartBinary, arguments); | 712 _process = await Process.start(dartBinary, arguments); |
| 723 _process.exitCode.then((int code) { | 713 _process.exitCode.then((int code) { |
| 724 if (code != 0) { | 714 if (code != 0) { |
| 725 _badDataFromServer('server terminated with exit code $code'); | 715 _badDataFromServer('server terminated with exit code $code'); |
| 726 } | 716 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 void populateMismatches(item, List<MismatchDescriber> mismatches); | 979 void populateMismatches(item, List<MismatchDescriber> mismatches); |
| 990 | 980 |
| 991 /** | 981 /** |
| 992 * Create a [MismatchDescriber] describing a mismatch with a simple string. | 982 * Create a [MismatchDescriber] describing a mismatch with a simple string. |
| 993 */ | 983 */ |
| 994 MismatchDescriber simpleDescription(String description) => | 984 MismatchDescriber simpleDescription(String description) => |
| 995 (Description mismatchDescription) { | 985 (Description mismatchDescription) { |
| 996 mismatchDescription.add(description); | 986 mismatchDescription.add(description); |
| 997 }; | 987 }; |
| 998 } | 988 } |
| OLD | NEW |