@@ -40,7 +40,6 @@ class VMPlatform extends PlatformPlugin {
4040 final _compiler = TestCompiler (
4141 p.join (p.current, '.dart_tool' , 'test' , 'incremental_kernel' ));
4242 final _closeMemo = AsyncMemoizer <void >();
43- final _workingDirectory = Directory .current.uri;
4443 final _tempDir = Directory .systemTemp.createTempSync ('dart_test.vm.' );
4544
4645 @override
@@ -121,7 +120,7 @@ class VMPlatform extends PlatformPlugin {
121120 // ignore: deprecated_member_use, Remove when SDK constraint is at 3.2.0
122121 var isolateID = Service .getIsolateID (isolate! )! ;
123122
124- var libraryPath = _absolute ( path).toString ();
123+ var libraryPath = ( await absoluteUri ( path) ).toString ();
125124 var serverUri = info.serverUri! ;
126125 client = await vmServiceConnectUri (_wsUriFor (serverUri).toString ());
127126 var isolateNumber = int .parse (isolateID.split ('/' ).last);
@@ -164,12 +163,6 @@ class VMPlatform extends PlatformPlugin {
164163 _tempDir.deleteWithRetry (),
165164 ]));
166165
167- Uri _absolute (String path) {
168- final uri = p.toUri (path);
169- if (uri.isAbsolute) return uri;
170- return _workingDirectory.resolveUri (uri);
171- }
172-
173166 /// Compiles [path] to a native executable and spawns it as a process.
174167 ///
175168 /// Sets up a communication channel as well by passing command line arguments
@@ -187,7 +180,7 @@ class VMPlatform extends PlatformPlugin {
187180
188181 /// Compiles [path] to a native executable using `dart compile exe` .
189182 Future <String > _compileToNative (String path, Metadata suiteMetadata) async {
190- var bootstrapPath = _bootstrapNativeTestFile (
183+ var bootstrapPath = await _bootstrapNativeTestFile (
191184 path,
192185 suiteMetadata.languageVersionComment ??
193186 await rootPackageLanguageVersionComment);
@@ -228,7 +221,7 @@ stderr: ${processResult.stderr}''');
228221 Compiler .kernel => _spawnIsolateWithUri (
229222 await _compileToKernel (path, suiteMetadata), message),
230223 Compiler .source => _spawnIsolateWithUri (
231- _bootstrapIsolateTestFile (
224+ await _bootstrapIsolateTestFile (
232225 path,
233226 suiteMetadata.languageVersionComment ??
234227 await rootPackageLanguageVersionComment),
@@ -244,12 +237,13 @@ stderr: ${processResult.stderr}''');
244237
245238 /// Compiles [path] to kernel and returns the uri to the compiled dill.
246239 Future <Uri > _compileToKernel (String path, Metadata suiteMetadata) async {
247- final response = await _compiler.compile (_absolute (path), suiteMetadata);
240+ final response =
241+ await _compiler.compile (await absoluteUri (path), suiteMetadata);
248242 var compiledDill = response.kernelOutputUri? .toFilePath ();
249243 if (compiledDill == null || response.errorCount > 0 ) {
250244 throw LoadException (path, response.compilerOutput ?? 'unknown error' );
251245 }
252- return _absolute (compiledDill);
246+ return absoluteUri (compiledDill);
253247 }
254248
255249 /// Runs [uri] in an isolate, passing [message] .
@@ -260,9 +254,10 @@ stderr: ${processResult.stderr}''');
260254
261255 Future <Isolate > _spawnPrecompiledIsolate (String testPath, SendPort message,
262256 String precompiledPath, Compiler compiler) async {
263- testPath = _absolute ('${p .join (precompiledPath , testPath )}.vm_test.dart' )
264- .path
265- .stripDriveLetterLeadingSlash;
257+ testPath =
258+ (await absoluteUri ('${p .join (precompiledPath , testPath )}.vm_test.dart' ))
259+ .path
260+ .stripDriveLetterLeadingSlash;
266261 switch (compiler) {
267262 case Compiler .kernel:
268263 var dillTestpath =
@@ -297,15 +292,15 @@ stderr: ${processResult.stderr}''');
297292 /// file.
298293 ///
299294 /// Returns the [Uri] to the created file.
300- Uri _bootstrapIsolateTestFile (
301- String testPath, String languageVersionComment) {
295+ Future < Uri > _bootstrapIsolateTestFile (
296+ String testPath, String languageVersionComment) async {
302297 var file = File (p.join (
303298 _tempDir.path, p.setExtension (testPath, '.bootstrap.isolate.dart' )));
304299 if (! file.existsSync ()) {
305300 file
306301 ..createSync (recursive: true )
307302 ..writeAsStringSync (_bootstrapIsolateTestContents (
308- _absolute (testPath), languageVersionComment));
303+ await absoluteUri (testPath), languageVersionComment));
309304 }
310305 return file.uri;
311306 }
@@ -314,15 +309,15 @@ stderr: ${processResult.stderr}''');
314309 /// contents to a temporary file.
315310 ///
316311 /// Returns the path to the created file.
317- String _bootstrapNativeTestFile (
318- String testPath, String languageVersionComment) {
312+ Future < String > _bootstrapNativeTestFile (
313+ String testPath, String languageVersionComment) async {
319314 var file = File (p.join (
320315 _tempDir.path, p.setExtension (testPath, '.bootstrap.native.dart' )));
321316 if (! file.existsSync ()) {
322317 file
323318 ..createSync (recursive: true )
324319 ..writeAsStringSync (_bootstrapNativeTestContents (
325- _absolute (testPath), languageVersionComment));
320+ await absoluteUri (testPath), languageVersionComment));
326321 }
327322 return file.path;
328323 }
0 commit comments