按规划继续工作

结论:补齐显式参数文件 override 路径的浏览器 OPFS 保存和备份读回验证,继续通过 vendored LinuxCNC save_parameters 路径覆盖。
This commit is contained in:
2026-06-08 12:00:03 +08:00
parent 441231cf5e
commit 98d0f2963f
2 changed files with 61 additions and 1 deletions

View File

@@ -296,7 +296,9 @@ rejection, missing-file success, missing required numeric parameter defaulting,
required numeric parameter writeback, removal of named-parameter-only lines
from saved output, and the `.bak` backup produced by vendored
`save_parameters()`, including browser OPFS readback of the backup text after
the host bridge writes it to persistent storage. It also covers LinuxCNC tool-table
the host bridge writes it to persistent storage, plus explicit host
parameter-file override paths saved back to OPFS with their LinuxCNC-produced
backup text. It also covers LinuxCNC tool-table
load/save behavior through vendored `tooldata_common.cc`, including the
non-random and random-toolchanger `tooldata_init()` branches, with the SDK
only copying text into the Emscripten filesystem and calling the exported C

View File

@@ -703,6 +703,64 @@
"tool_1.comment=browser explicit tool",
].join("\n"),
);
const savedExplicitParameters = await saveMachineParametersToOpfs(
interp,
"browser-ini-override-session",
{
5161: 51.25,
5162: 102.5,
5220: 1.0,
5221: 7.5,
5399: 202,
},
{
opfsPath: loadedIniOverrideSession.parameters.opfsPath,
wasmPath: loadedIniOverrideSession.parameters.wasmPath,
},
);
if (
savedExplicitParameters.opfsPath !==
"linuxcnc/machines/browser-ini-override-session/browser-explicit.var"
) {
throw new Error(`unexpected explicit saved parameter path: ${savedExplicitParameters.opfsPath}`);
}
if (
savedExplicitParameters.backupOpfsPath !==
"linuxcnc/machines/browser-ini-override-session/browser-explicit.var.bak"
) {
throw new Error(`unexpected explicit backup path: ${savedExplicitParameters.backupOpfsPath}`);
}
verifyExpectedOutput(
"opfs_save_explicit_parameter_file",
savedExplicitParameters.result,
[
"save_parameters=0",
"parameter_5161=51.25",
"parameter_5162=102.5",
"parameter_5221=7.5",
"parameter_5399=202",
].join("\n"),
);
verifyExpectedOutput(
"opfs_saved_explicit_parameter_text",
await loadTextFile(loadedIniOverrideSession.parameters.opfsPath),
[
"5161\t51.250000",
"5162\t102.500000",
"5221\t7.500000",
"5399\t202.000000",
].join("\n"),
);
verifyExpectedOutput(
"opfs_saved_explicit_parameter_backup_text",
await loadTextFile(savedExplicitParameters.backupOpfsPath),
[
"5161 41.25",
"5162 82.5",
"5221 6.5",
"5399 101",
].join("\n"),
);
await saveMachineTextFiles("browser-invalid-param-file-session", {
ini: [