Guard nested remaps oword staging paths

This commit is contained in:
2026-06-13 08:32:39 +08:00
parent 234a1cf81c
commit 035cd8fa68
3 changed files with 84 additions and 13 deletions

View File

@@ -4647,10 +4647,13 @@
return wasmDir;
}
function assertRemapRegressionStaging(name, files, wasmDir) {
function assertRemapRegressionStaging(name, files, wasmDir, expectedUnstagedFiles = []) {
if (files.length === 0 || new Set(files).size !== files.length) {
throw new Error(`browser_remap_${name}_fixture_coverage: list drift`);
}
if (expectedUnstagedFiles.some((file) => files.includes(file))) {
throw new Error(`browser_remap_${name}_unstaged_fixture_overlap: list drift`);
}
const remapStagedRelativeFiles = files.map((file) => `${wasmDir}/${file}`.replace(`/work/browser-remap/${name}/`, ""));
if (remapStagedRelativeFiles.join(",") !== files.join(",")) {
throw new Error(`browser_remap_${name}_staging_manifest: list drift`);
@@ -6134,17 +6137,27 @@
].join("\n"),
);
const nestedRemapsOwordFiles = [
"test.ini",
"test.ngc",
"rm400.ngc",
"rm401.ngc",
"rm402.ngc",
"rm403.ngc",
];
const nestedRemapsOwordUnstagedFiles = [
"testsub.ngc",
];
const nestedRemapsOwordDir = await writeRemapRegressionFiles(
interp,
"nested-remaps-oword",
[
"test.ini",
"test.ngc",
"rm400.ngc",
"rm401.ngc",
"rm402.ngc",
"rm403.ngc",
],
nestedRemapsOwordFiles,
);
assertRemapRegressionStaging(
"nested-remaps-oword",
nestedRemapsOwordFiles,
nestedRemapsOwordDir,
nestedRemapsOwordUnstagedFiles,
);
verifyExpectedOutput(
"browser_nested_remaps_oword_remap",

View File

@@ -246,15 +246,20 @@ function writeRemapRegressionFiles(name, files) {
return wasmDir;
}
function assertRemapRegressionStaging(name, files, wasmDir) {
function assertRemapRegressionStaging(name, files, wasmDir, expectedUnstagedFiles = []) {
const sourceDir = resolve(rootDir, "vendor/linuxcnc/tests/remap", name);
assert.deepEqual(
readdirSync(sourceDir)
.filter((filename) => filename.endsWith(".ini") || filename.endsWith(".ngc"))
.sort(),
[...files].sort(),
[...files, ...expectedUnstagedFiles].sort(),
`remap ${name} fixture coverage drift`,
);
assert.deepEqual(
files.filter((file) => expectedUnstagedFiles.includes(file)),
[],
`remap ${name} unstaged fixture overlap drift`,
);
assert.deepEqual(
files.map((file) => `${wasmDir}/${file}`),
files.map((file) => `/work/remap/${name}/${file}`),
@@ -1110,14 +1115,27 @@ verifyExpectedOutput(
].join("\n"),
);
const nestedRemapsOwordDir = writeRemapRegressionFiles("nested-remaps-oword", [
const nestedRemapsOwordFiles = [
"test.ini",
"test.ngc",
"rm400.ngc",
"rm401.ngc",
"rm402.ngc",
"rm403.ngc",
]);
];
const nestedRemapsOwordUnstagedFiles = [
"testsub.ngc",
];
const nestedRemapsOwordDir = writeRemapRegressionFiles(
"nested-remaps-oword",
nestedRemapsOwordFiles,
);
assertRemapRegressionStaging(
"nested-remaps-oword",
nestedRemapsOwordFiles,
nestedRemapsOwordDir,
nestedRemapsOwordUnstagedFiles,
);
verifyExpectedOutput(
"nested_remaps_oword_remap_wasm",
interp.runRemapFile(