提示词:验证 OPFS 程序跨独立挂载恢复

结论:新增浏览器 OPFS section,使用同一 workspace 但不同 WASM mount point 的新 simulator 解析已持久化程序,证明程序来自 OPFS 而非旧 WASM FS mirror。LinuxCNC 来源依据为 rs274ngc_pre.cc open()/read_text() 文件读取路径;未扩展 smoke 语义。检查通过:./test-native.sh;./test-linuxcnc-source-link.sh。
This commit is contained in:
cnc
2026-06-05 20:59:43 +08:00
parent 37879f2a67
commit 1b60bc2b2e

View File

@@ -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" });
});
}