参考所有分组,完成尽量多的内容。禁止顺手扩功能 smoke:锁定OPFS参数保存顺序

结论:按 LinuxCNC rs274ngc_pre.cc save_parameters() 的 .new、.bak、unlink/link/rename 顺序补强 OPFS/app/browser smoke 守卫,并验证临时参数文件不会残留在 OPFS。
This commit is contained in:
cnc
2026-06-04 19:42:49 +08:00
parent a12c0166b5
commit b89d6311ff
7 changed files with 46 additions and 0 deletions

View File

@@ -39,6 +39,13 @@ export async function runBrowserAppOpfsSections(context) {
const updatedParameterFile = new TextDecoder().decode(await appSimulator.fs.opfs.readFile("parameters/rs274ngc.var"));
expectIncludes(updatedParameterFile, "5161\t2.000000",
"app frame did not replace LinuxCNC parameter state after second parse");
// LinuxCNC source basis: rs274ngc_pre.cc save_parameters()
// renames filename + ".new" over filename after a successful save.
await context.expectOpfsMissing(
appSimulator,
"parameters/rs274ngc.var.new",
"app frame did not clean up LinuxCNC temporary parameter file in OPFS",
);
const savedParameterBackup = new TextDecoder().decode(await appSimulator.fs.opfs.readFile("parameters/rs274ngc.var.bak"));
expectIncludes(savedParameterBackup, "5161\t1.000000",
"app frame did not persist LinuxCNC parameter backup into OPFS");