From 1b60bc2b2e7f424d461f5db6d5326da08cde6121 Mon Sep 17 00:00:00 2001 From: cnc Date: Fri, 5 Jun 2026 20:59:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=8D=EF=BC=9A=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=20OPFS=20=E7=A8=8B=E5=BA=8F=E8=B7=A8=E7=8B=AC?= =?UTF-8?q?=E7=AB=8B=E6=8C=82=E8=BD=BD=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:新增浏览器 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。 --- ...-browser-wasm-smoke-opfs-basic-sections.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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" }); + }); }