diff --git a/web/test-browser-wasm-smoke-opfs-basic-sections.js b/web/test-browser-wasm-smoke-opfs-basic-sections.js index 1ee4040..26852bf 100644 --- a/web/test-browser-wasm-smoke-opfs-basic-sections.js +++ b/web/test-browser-wasm-smoke-opfs-basic-sections.js @@ -125,4 +125,23 @@ export async function runBrowserOpfsBasicSections(context, simulator) { "LinuxCNC OPFS program file was not restored across WASM simulator instances"); }); }); + + await runSection("opfs program restore with independent mount", async () => { + await withSmokeSimulator(async (independentMountSimulator) => { + // LinuxCNC source basis: rs274ngc_pre.cc open()/read_text() + // reads the mirrored program file. A different mount point proves + // the program came from OPFS instead of a prior WASM FS mirror. + const independentMountEvents = await independentMountSimulator.parseFile( + "programs/browser-smoke.ngc", + "linuxcnc", + { backend: "linuxcnc-rs274" }, + ); + expectEvent(independentMountEvents, (event) => event.type === "rapid" && near(event.end.x, 1), + "LinuxCNC OPFS program file was not restored through an independent WASM mount"); + const independentMountPath = independentMountSimulator.fs.opfs.resolvePath("programs/browser-smoke.ngc"); + if (!independentMountPath.startsWith("/cnc-independent/")) { + throw new Error("independent OPFS mount point was not used for restored program parsing"); + } + }, { mountPoint: "/cnc-independent", workspacePath: "cnc-simulator-smoke" }); + }); }