提示词:验证 OPFS 参数备份跨实例恢复

结论:按 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 通过。
This commit is contained in:
cnc
2026-06-05 15:37:03 +08:00
parent 9a4e0e3712
commit cb315ce1cd

View File

@@ -94,10 +94,10 @@ export async function runBrowserOpfsParameterSections(context, simulator) {
// filename + ".bak", links the current parameter file to it, // filename + ".bak", links the current parameter file to it,
// then renames filename + ".new" over filename. // then renames filename + ".new" over filename.
await parseWithParameters("G21 G90\nG0 X4\nG28.1\nM30\n", "parameters/existing-save.var"); await parseWithParameters("G21 G90\nG0 X4\nG28.1\nM30\n", "parameters/existing-save.var");
const existingSaveParameterFile = await readOpfsText(simulator, "parameters/existing-save.var"); await withSmokeSimulator(async (restoredBackupSimulator) => {
expectIncludes(existingSaveParameterFile, "5161\t4.000000", "LinuxCNC existing OPFS parameter file was not replaced after save"); expectIncludes(await readOpfsText(restoredBackupSimulator, "parameters/existing-save.var"), "5161\t4.000000", "LinuxCNC existing OPFS parameter file was not restored in a new WASM instance");
const existingSaveParameterBackup = await readOpfsText(simulator, "parameters/existing-save.var.bak"); 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");
expectIncludes(existingSaveParameterBackup, "5161\t3.000000", "LinuxCNC existing OPFS parameter backup did not replace the stale backup with the previous file"); });
await expectMissingOpfsFile( await expectMissingOpfsFile(
() => simulator.fs.opfs.readFile("parameters/existing-save.var.new"), () => simulator.fs.opfs.readFile("parameters/existing-save.var.new"),
"LinuxCNC existing OPFS parameter temporary file remained after save", "LinuxCNC existing OPFS parameter temporary file remained after save",