@@ -115,7 +115,13 @@ class _ServiceTesteeLauncher {
115115 bool pauseOnUnhandledExceptions,
116116 bool testeeControlsServer,
117117 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,
119125 List <String >? experiments,
120126 List <String >? extraArgs,
121127 ) {
@@ -125,7 +131,7 @@ class _ServiceTesteeLauncher {
125131 pauseOnUnhandledExceptions,
126132 testeeControlsServer,
127133 useAuthToken,
128- shouldTesteeBeLaunchedWithDartRunResident ,
134+ residentCompilerInfoFilePath ,
129135 experiments,
130136 extraArgs,
131137 );
@@ -137,7 +143,13 @@ class _ServiceTesteeLauncher {
137143 bool pauseOnUnhandledExceptions,
138144 bool testeeControlsServer,
139145 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,
141153 List <String >? experiments,
142154 List <String >? extraArgs,
143155 ) {
@@ -169,8 +181,12 @@ class _ServiceTesteeLauncher {
169181 fullArgs.add ('--enable-vm-service:0' );
170182 }
171183
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+ ]);
174190 }
175191 fullArgs.addAll (args);
176192
@@ -202,7 +218,13 @@ class _ServiceTesteeLauncher {
202218 bool pauseOnUnhandledExceptions,
203219 bool testeeControlsServer,
204220 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,
206228 List <String >? experiments,
207229 List <String >? extraArgs,
208230 ) {
@@ -212,7 +234,7 @@ class _ServiceTesteeLauncher {
212234 pauseOnUnhandledExceptions,
213235 testeeControlsServer,
214236 useAuthToken,
215- shouldTesteeBeLaunchedWithDartRunResident ,
237+ residentCompilerInfoFilePath ,
216238 experiments,
217239 extraArgs,
218240 ).then ((p) {
@@ -286,6 +308,16 @@ class _ServiceTesterRunner {
286308 bool allowForNonZeroExitCode = false ,
287309 VmServiceFactory serviceFactory = VmService .defaultFactory,
288310 }) 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+
289321 final process = _ServiceTesteeLauncher (scriptName);
290322 late VmService vm;
291323 late IsolateRef isolate;
@@ -297,7 +329,7 @@ class _ServiceTesterRunner {
297329 pauseOnUnhandledExceptions,
298330 testeeControlsServer,
299331 useAuthToken,
300- shouldTesteeBeLaunchedWithDartRunResident ,
332+ residentCompilerInfoFilePath ,
301333 experiments,
302334 extraArgs,
303335 )
@@ -366,13 +398,19 @@ $st
366398 final exitCode = await process.exitCode;
367399 if (shouldTesteeBeLaunchedWithDartRunResident) {
368400 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 '
370403 'Service tests' ,
371404 );
372405 await io.Process .run (
373406 io.Platform .executable,
374- ['compilation-server' , 'shutdown' ],
407+ [
408+ 'compilation-server' ,
409+ 'shutdown' ,
410+ '--resident-compiler-info-file=$residentCompilerInfoFilePath ' ,
411+ ],
375412 );
413+ tempDir.deleteSync (recursive: true );
376414 }
377415 if (exitCode != 0 ) {
378416 if (! (process.killedByTester || allowForNonZeroExitCode)) {
0 commit comments