@@ -115,7 +115,13 @@ class _ServiceTesteeLauncher {
115
115
bool pauseOnUnhandledExceptions,
116
116
bool testeeControlsServer,
117
117
bool useAuthToken,
118
- bool shouldTesteeBeLaunchedWithDartRunResident,
118
+
119
+ /// If non-null, any compilation requests sent from the testee VM will be
120
+ /// sent to the resident frontend compiler associated with
121
+ /// [residentCompilerInfoFilePath] rather than the testee VM's kernel
122
+ /// isolate. If null, then those requests will be sent to the testee VM's
123
+ /// kernel isolate.
124
+ String ? residentCompilerInfoFilePath,
119
125
List <String >? experiments,
120
126
List <String >? extraArgs,
121
127
) {
@@ -125,7 +131,7 @@ class _ServiceTesteeLauncher {
125
131
pauseOnUnhandledExceptions,
126
132
testeeControlsServer,
127
133
useAuthToken,
128
- shouldTesteeBeLaunchedWithDartRunResident ,
134
+ residentCompilerInfoFilePath ,
129
135
experiments,
130
136
extraArgs,
131
137
);
@@ -137,7 +143,13 @@ class _ServiceTesteeLauncher {
137
143
bool pauseOnUnhandledExceptions,
138
144
bool testeeControlsServer,
139
145
bool useAuthToken,
140
- bool shouldTesteeBeLaunchedWithDartRunResident,
146
+
147
+ /// If non-null, any compilation requests sent from the testee VM will be
148
+ /// sent to the resident frontend compiler associated with
149
+ /// [residentCompilerInfoFilePath] rather than the testee VM's kernel
150
+ /// isolate. If null, then those requests will be sent to the testee VM's
151
+ /// kernel isolate.
152
+ String ? residentCompilerInfoFilePath,
141
153
List <String >? experiments,
142
154
List <String >? extraArgs,
143
155
) {
@@ -169,8 +181,12 @@ class _ServiceTesteeLauncher {
169
181
fullArgs.add ('--enable-vm-service:0' );
170
182
}
171
183
172
- if (shouldTesteeBeLaunchedWithDartRunResident) {
173
- fullArgs.addAll (['run' , '--resident' ]);
184
+ if (residentCompilerInfoFilePath != null ) {
185
+ fullArgs.addAll ([
186
+ 'run' ,
187
+ '--resident' ,
188
+ '--resident-compiler-info-file=$residentCompilerInfoFilePath ' ,
189
+ ]);
174
190
}
175
191
fullArgs.addAll (args);
176
192
@@ -202,7 +218,13 @@ class _ServiceTesteeLauncher {
202
218
bool pauseOnUnhandledExceptions,
203
219
bool testeeControlsServer,
204
220
bool useAuthToken,
205
- bool shouldTesteeBeLaunchedWithDartRunResident,
221
+
222
+ /// If non-null, any compilation requests sent from the testee VM will be
223
+ /// sent to the resident frontend compiler associated with
224
+ /// [residentCompilerInfoFilePath] rather than the testee VM's kernel
225
+ /// isolate. If null, then those requests will be sent to the testee VM's
226
+ /// kernel isolate.
227
+ String ? residentCompilerInfoFilePath,
206
228
List <String >? experiments,
207
229
List <String >? extraArgs,
208
230
) {
@@ -212,7 +234,7 @@ class _ServiceTesteeLauncher {
212
234
pauseOnUnhandledExceptions,
213
235
testeeControlsServer,
214
236
useAuthToken,
215
- shouldTesteeBeLaunchedWithDartRunResident ,
237
+ residentCompilerInfoFilePath ,
216
238
experiments,
217
239
extraArgs,
218
240
).then ((p) {
@@ -286,6 +308,16 @@ class _ServiceTesterRunner {
286
308
bool allowForNonZeroExitCode = false ,
287
309
VmServiceFactory serviceFactory = VmService .defaultFactory,
288
310
}) async {
311
+ final tempDir = io.Directory .systemTemp.createTempSync ();
312
+ final String ? residentCompilerInfoFilePath;
313
+ if (shouldTesteeBeLaunchedWithDartRunResident) {
314
+ residentCompilerInfoFilePath =
315
+ '${tempDir .path }${io .Platform .pathSeparator }'
316
+ 'resident_compiler_info.txt' ;
317
+ } else {
318
+ residentCompilerInfoFilePath = null ;
319
+ }
320
+
289
321
final process = _ServiceTesteeLauncher (scriptName);
290
322
late VmService vm;
291
323
late IsolateRef isolate;
@@ -297,7 +329,7 @@ class _ServiceTesterRunner {
297
329
pauseOnUnhandledExceptions,
298
330
testeeControlsServer,
299
331
useAuthToken,
300
- shouldTesteeBeLaunchedWithDartRunResident ,
332
+ residentCompilerInfoFilePath ,
301
333
experiments,
302
334
extraArgs,
303
335
)
@@ -366,13 +398,19 @@ $st
366
398
final exitCode = await process.exitCode;
367
399
if (shouldTesteeBeLaunchedWithDartRunResident) {
368
400
print (
369
- '** Shutting down resident frontend compiler that was used by VM '
401
+ '** Shutting down resident frontend compiler associated with '
402
+ '$residentCompilerInfoFilePath that was used by VM '
370
403
'Service tests' ,
371
404
);
372
405
await io.Process .run (
373
406
io.Platform .executable,
374
- ['compilation-server' , 'shutdown' ],
407
+ [
408
+ 'compilation-server' ,
409
+ 'shutdown' ,
410
+ '--resident-compiler-info-file=$residentCompilerInfoFilePath ' ,
411
+ ],
375
412
);
413
+ tempDir.deleteSync (recursive: true );
376
414
}
377
415
if (exitCode != 0 ) {
378
416
if (! (process.killedByTester || allowForNonZeroExitCode)) {
0 commit comments