Switch integration tests to use a snapshot for the analysis server.

Bug: https://github.com/dart-lang/sdk/issues/33189
Change-Id: I27ac08545c36c1cc1c7718b945f298b6286731b9
Reviewed-on: https://dart-review.googlesource.com/57300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
This commit is contained in:
Devon Carew 2018-05-30 17:29:55 +00:00 committed by commit-bot@chromium.org
parent cc9c8f93f5
commit fe3bba8b03
4 changed files with 25 additions and 23 deletions

View file

@ -59,7 +59,7 @@ class AnalysisServerMemoryUsageTest
/**
* The server is automatically started before every test.
*/
*/
@override
Future setUp({bool useCFE: false}) {
onAnalysisErrors.listen((AnalysisErrorsParams params) {
@ -74,11 +74,7 @@ class AnalysisServerMemoryUsageTest
outOfTestExpect(serverConnected.isCompleted, isFalse);
serverConnected.complete();
});
return startServer(
servicesPort: vmServicePort,
cfe: useCFE,
checked: false,
).then((_) {
return startServer(servicesPort: vmServicePort, cfe: useCFE).then((_) {
server.listenToOutput(dispatchNotification);
server.exitCode.then((_) {
skipShutdown = true;

View file

@ -70,14 +70,9 @@ class AnalysisDomainGetErrorsTest
}
@override
Future startServer(
{bool checked: true,
int diagnosticPort,
int servicesPort,
bool cfe: false}) {
Future startServer({int diagnosticPort, int servicesPort, bool cfe: false}) {
String sdkPath = createNonStandardSdk();
return server.start(
checked: checked,
diagnosticPort: diagnosticPort,
sdkPath: sdkPath,
servicesPort: servicesPort,

View file

@ -21,13 +21,11 @@ main() {
@reflectiveTest
class AnalysisHighlightsTest extends AbstractAnalysisServerIntegrationTest {
Future startServer({
bool checked: true,
int diagnosticPort,
int servicesPort,
bool cfe: false,
}) {
return server.start(
checked: checked,
diagnosticPort: diagnosticPort,
servicesPort: servicesPort,
useAnalysisHighlight2: true,

View file

@ -263,13 +263,11 @@ abstract class AbstractAnalysisServerIntegrationTest
* Start [server].
*/
Future startServer({
bool checked: true,
int diagnosticPort,
int servicesPort,
bool cfe: false,
}) {
return server.start(
checked: checked,
diagnosticPort: diagnosticPort,
servicesPort: servicesPort,
useCFE: cfe || useCFE);
@ -664,7 +662,6 @@ class Server {
* to be used.
*/
Future start({
bool checked: true,
int diagnosticPort,
String instrumentationLogFile,
bool profileServer: false,
@ -678,9 +675,28 @@ class Server {
}
_time.start();
String dartBinary = Platform.executable;
String rootDir =
findRoot(Platform.script.toFilePath(windows: Platform.isWindows));
String serverPath = normalize(join(rootDir, 'bin', 'server.dart'));
// The integration tests run 3x faster when run from snapshots (you need to
// run test.py with --use-sdk).
final bool useSnapshot = true;
String serverPath;
if (useSnapshot) {
// Look for snapshots/analysis_server.dart.snapshot.
serverPath = normalize(join(dirname(Platform.resolvedExecutable),
'snapshots', 'analysis_server.dart.snapshot'));
if (!FileSystemEntity.isFileSync(serverPath)) {
// Look for dart-sdk/bin/snapshots/analysis_server.dart.snapshot.
serverPath = normalize(join(dirname(Platform.resolvedExecutable),
'dart-sdk', 'bin', 'snapshots', 'analysis_server.dart.snapshot'));
}
} else {
String rootDir =
findRoot(Platform.script.toFilePath(windows: Platform.isWindows));
serverPath = normalize(join(rootDir, 'bin', 'server.dart'));
}
List<String> arguments = [];
//
// Add VM arguments.
@ -701,9 +717,6 @@ class Server {
if (Platform.packageConfig != null) {
arguments.add('--packages=${Platform.packageConfig}');
}
if (checked) {
arguments.add('--checked');
}
//
// Add the server executable.
//