按规划继续工作

结论:补齐 INI 派生自定义参数文件路径的浏览器 OPFS 保存和备份读回验证,继续通过 vendored LinuxCNC save_parameters 路径覆盖。
This commit is contained in:
2026-06-08 12:05:55 +08:00
parent 38fb69e535
commit ebb931c78d
2 changed files with 61 additions and 3 deletions

View File

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

View File

@@ -587,6 +587,64 @@
"parameter_5399=99", "parameter_5399=99",
].join("\n"), ].join("\n"),
); );
const savedIniNamedParameters = await saveMachineParametersToOpfs(
interp,
"browser-ini-file-session",
{
5161: 33.75,
5162: 67.5,
5220: 1.0,
5221: 5.25,
5399: 199,
},
{
opfsPath: loadedIniFileSession.parameters.opfsPath,
wasmPath: loadedIniFileSession.parameters.wasmPath,
},
);
if (
savedIniNamedParameters.opfsPath !==
"linuxcnc/machines/browser-ini-file-session/browser-custom.var"
) {
throw new Error(`unexpected custom saved parameter path: ${savedIniNamedParameters.opfsPath}`);
}
if (
savedIniNamedParameters.backupOpfsPath !==
"linuxcnc/machines/browser-ini-file-session/browser-custom.var.bak"
) {
throw new Error(`unexpected custom parameter backup path: ${savedIniNamedParameters.backupOpfsPath}`);
}
verifyExpectedOutput(
"opfs_save_ini_named_parameter_file",
savedIniNamedParameters.result,
[
"save_parameters=0",
"parameter_5161=33.75",
"parameter_5162=67.5",
"parameter_5221=5.25",
"parameter_5399=199",
].join("\n"),
);
verifyExpectedOutput(
"opfs_saved_ini_named_parameter_text",
await loadTextFile(loadedIniFileSession.parameters.opfsPath),
[
"5161\t33.750000",
"5162\t67.500000",
"5221\t5.250000",
"5399\t199.000000",
].join("\n"),
);
verifyExpectedOutput(
"opfs_saved_ini_named_parameter_backup_text",
await loadTextFile(savedIniNamedParameters.backupOpfsPath),
[
"5161 31.25",
"5162 62.5",
"5221 4.5",
"5399 99",
].join("\n"),
);
verifyExpectedOutput( verifyExpectedOutput(
"opfs_load_ini_named_tool_table", "opfs_load_ini_named_tool_table",
loadedIniFileSession.toolTable.result, loadedIniFileSession.toolTable.result,