From 579de4e2d38acb025be5135ef6ce2b9104e208d9 Mon Sep 17 00:00:00 2001 From: Sigmund Cherem Date: Mon, 2 Dec 2024 23:15:39 +0000 Subject: [PATCH] [dyn-modules] fix ddc test runner in windows Windows paths of the form `c:` are parsed incorrectly by the subprocesses actions when reading the package path. This change ensures they are encoded as `file:` URIs instead to ensure they are parsed properly. Fixes https://github.com/dart-lang/sdk/issues/56725 TESTED=dynamic_modules_suite Change-Id: Iadcfc8bf08b8845620dcf2be5fafadb975a8edc2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397180 Reviewed-by: Nate Biggs Commit-Queue: Sigmund Cherem --- pkg/dynamic_modules/test/runner/ddc.dart | 17 +++++++++-------- pkg/dynamic_modules/test/runner/util.dart | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pkg/dynamic_modules/test/runner/ddc.dart b/pkg/dynamic_modules/test/runner/ddc.dart index 8df6c5a13e0..41d36eba188 100644 --- a/pkg/dynamic_modules/test/runner/ddc.dart +++ b/pkg/dynamic_modules/test/runner/ddc.dart @@ -76,7 +76,7 @@ class DdcExecutor implements TargetExecutor { '$ddcSdkOutline', // Note: this needs to change if we ever intend to support packages within // the dynamic loading tests themselves - '--packages=${repoRoot.toFilePath()}/.dart_tool/package_config.json', + '--packages=$repoRoot/.dart_tool/package_config.json', if (!isMain) ...[ // TODO(sigmund): consider specifying the module name directly '--dynamic-module', @@ -95,7 +95,7 @@ class DdcExecutor implements TargetExecutor { var testDir = _tmp.uri.resolve(testName).toFilePath(); var args = [ '--packages=${repoRoot.toFilePath()}/.dart_tool/package_config.json', - kernelWOrkerAotSnapshot.toFilePath(), + kernelWorkerAotSnapshot.toFilePath(), '--summary-only', '--target', 'ddc', @@ -103,7 +103,7 @@ class DdcExecutor implements TargetExecutor { '${sourceDir.resolve('../../')}', '--multi-root-scheme', rootScheme, - '--packages-file=${repoRoot.toFilePath()}/.dart_tool/package_config.json', + '--packages-file=$repoRoot/.dart_tool/package_config.json', '--dart-sdk-summary', '$ddcSdkOutline', '--source', @@ -142,12 +142,13 @@ class DdcExecutor implements TargetExecutor { var testDir = _tmp.uri.resolve('${test.name}/'); var bootstrapUri = testDir.resolve('bootstrap.js'); // TODO(sigmund): remove hardwired entrypoint name + String toPath(Uri uri) => uri.toFilePath().replaceAll('\\', '\\\\'); File.fromUri(bootstrapUri).writeAsStringSync(''' - load('${ddcPreamblesJs.toFilePath()}'); // preambles/d8.js - load('${ddcSealNativeObjectJs.toFilePath()}'); // seal_native_object.js - load('${ddcModuleLoaderJs.toFilePath()}'); // ddc_module_loader.js - load('${ddcSdkJs.toFilePath()}'); // dart_sdk.js - load('main.dart.js'); // compiled test module + load('${toPath(ddcPreamblesJs)}'); // preambles/d8.js + load('${toPath(ddcSealNativeObjectJs)}'); // seal_native_object.js + load('${toPath(ddcModuleLoaderJs)}'); // ddc_module_loader.js + load('${toPath(ddcSdkJs)}'); // dart_sdk.js + load('main.dart.js'); // compiled test module self.dartMainRunner(function () { dart_library.configure( diff --git a/pkg/dynamic_modules/test/runner/util.dart b/pkg/dynamic_modules/test/runner/util.dart index 58d35675431..83963577b42 100644 --- a/pkg/dynamic_modules/test/runner/util.dart +++ b/pkg/dynamic_modules/test/runner/util.dart @@ -68,7 +68,7 @@ Uri _dartBin = Uri.file(Platform.resolvedExecutable); Uri dartAotBin = _dartBin .resolve(Platform.isWindows ? 'dartaotruntime.exe' : 'dartaotruntime'); Uri ddcAotSnapshot = _dartBin.resolve('snapshots/dartdevc_aot.dart.snapshot'); -Uri kernelWOrkerAotSnapshot = +Uri kernelWorkerAotSnapshot = _dartBin.resolve('snapshots/kernel_worker_aot.dart.snapshot'); Uri buildRootUri = repoRoot.resolve(buildFolder); Uri ddcSdkOutline = buildRootUri.resolve('ddc_outline.dill');