From cb315ce1cd33c1664be09e09e2acab07605fc5f4 Mon Sep 17 00:00:00 2001 From: cnc Date: Fri, 5 Jun 2026 15:37:03 +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=E5=8F=82=E6=95=B0=E5=A4=87=E4=BB=BD?= =?UTF-8?q?=E8=B7=A8=E5=AE=9E=E4=BE=8B=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:按 LinuxCNC src/emc/rs274ngc/rs274ngc_pre.cc save_parameters() 的 .bak 保存语义,强化浏览器 smoke,在新 WASM 实例中读取 OPFS 主参数文件和备份文件,证明备份不是当前实例镜像残留。 检查:./check-linuxcnc-opfs-source-map.sh 通过;./test-native.sh 通过;./test-linuxcnc-source-link.sh 通过。 --- web/test-browser-wasm-smoke-opfs-parameter-sections.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/test-browser-wasm-smoke-opfs-parameter-sections.js b/web/test-browser-wasm-smoke-opfs-parameter-sections.js index 0d22989..47e39ce 100644 --- a/web/test-browser-wasm-smoke-opfs-parameter-sections.js +++ b/web/test-browser-wasm-smoke-opfs-parameter-sections.js @@ -94,10 +94,10 @@ export async function runBrowserOpfsParameterSections(context, simulator) { // filename + ".bak", links the current parameter file to it, // then renames filename + ".new" over filename. await parseWithParameters("G21 G90\nG0 X4\nG28.1\nM30\n", "parameters/existing-save.var"); - const existingSaveParameterFile = await readOpfsText(simulator, "parameters/existing-save.var"); - expectIncludes(existingSaveParameterFile, "5161\t4.000000", "LinuxCNC existing OPFS parameter file was not replaced after save"); - const existingSaveParameterBackup = await readOpfsText(simulator, "parameters/existing-save.var.bak"); - expectIncludes(existingSaveParameterBackup, "5161\t3.000000", "LinuxCNC existing OPFS parameter backup did not replace the stale backup with the previous file"); + await withSmokeSimulator(async (restoredBackupSimulator) => { + expectIncludes(await readOpfsText(restoredBackupSimulator, "parameters/existing-save.var"), "5161\t4.000000", "LinuxCNC existing OPFS parameter file was not restored in a new WASM instance"); + expectIncludes(await readOpfsText(restoredBackupSimulator, "parameters/existing-save.var.bak"), "5161\t3.000000", "LinuxCNC existing OPFS parameter backup was not restored in a new WASM instance"); + }); await expectMissingOpfsFile( () => simulator.fs.opfs.readFile("parameters/existing-save.var.new"), "LinuxCNC existing OPFS parameter temporary file remained after save",