Guard fixture loop staging

This commit is contained in:
2026-06-13 15:14:38 +08:00
parent 4c4ee2ae02
commit dfeedeb675
3 changed files with 103 additions and 16 deletions

View File

@@ -4336,6 +4336,14 @@
return wasmPath;
}
async function writeLocalErrorGcodeFixture(interp, fixtureName, wasmPath, expectedWasmPath) {
if (wasmPath !== expectedWasmPath) {
throw new Error(`browser_${fixtureName}_local_error_gcode_staging: path drift`);
}
interp.writeTextFile(wasmPath, await fetchText(`../fixtures/gcode_errors/${fixtureName}.ngc`));
return wasmPath;
}
async function loadSimMachineFiles(machineRel, iniFile, programFile = null) {
const iniText = await fetchText(
`../../vendor/linuxcnc/configs/sim/${machineRel}/${iniFile}`,
@@ -5215,10 +5223,11 @@
}
for (const errorFixtureName of INTERP_ERROR_FIXTURES) {
const programPath = `/work/${errorFixtureName}-error.ngc`;
interp.writeTextFile(
programPath,
await fetchText(`../fixtures/gcode_errors/${errorFixtureName}.ngc`),
const programPath = await writeLocalErrorGcodeFixture(
interp,
errorFixtureName,
`/work/${errorFixtureName}-error.ngc`,
`/work/${errorFixtureName}-error.ngc`,
);
verifyExpectedFileError(
`${errorFixtureName}_file`,
@@ -5308,8 +5317,12 @@
);
for (const fileFixtureName of INTERP_BROWSER_FILE_FIXTURES) {
const programPath = `/work/${fileFixtureName}.ngc`;
interp.writeTextFile(programPath, await fetchText(`../fixtures/gcode/${fileFixtureName}.ngc`));
const programPath = await writeLocalGcodeFixture(
interp,
fileFixtureName,
`/work/${fileFixtureName}.ngc`,
`/work/${fileFixtureName}.ngc`,
);
verifyExpectedOutput(
`${fileFixtureName}_file`,
interp.runFile(programPath),