Skip to content

Commit

Permalink
[dyn-modules] fix ddc test runner in windows
Browse files Browse the repository at this point in the history
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 #56725

TESTED=dynamic_modules_suite

Change-Id: Iadcfc8bf08b8845620dcf2be5fafadb975a8edc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397180
Reviewed-by: Nate Biggs <[email protected]>
Commit-Queue: Sigmund Cherem <[email protected]>
  • Loading branch information
sigmundch authored and Commit Queue committed Dec 2, 2024
1 parent 1086762 commit 579de4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions pkg/dynamic_modules/test/runner/ddc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -95,15 +95,15 @@ 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',
'--multi-root',
'${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',
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pkg/dynamic_modules/test/runner/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 579de4e

Please sign in to comment.