[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 <natebiggs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem
2024-12-02 23:15:39 +00:00
committed by Commit Queue
parent 1086762770
commit 579de4e2d3
2 changed files with 10 additions and 9 deletions
+9 -8
View File
@@ -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(
+1 -1
View File
@@ -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');