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

View file

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

View file

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

View file

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