From ebb931c78decc8c0bf0f56d6ae3f30af63823da9 Mon Sep 17 00:00:00 2001 From: wangdequan Date: Mon, 8 Jun 2026 12:05:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E8=A7=84=E5=88=92=E7=BB=A7=E7=BB=AD?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:补齐 INI 派生自定义参数文件路径的浏览器 OPFS 保存和备份读回验证,继续通过 vendored LinuxCNC save_parameters 路径覆盖。 --- wasm-port/docs/compatibility-validation.md | 6 +-- wasm-port/tests/browser/interp_smoke.html | 58 ++++++++++++++++++++++ 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/wasm-port/docs/compatibility-validation.md b/wasm-port/docs/compatibility-validation.md index 3e8ab9d..cf8cd3b 100644 --- a/wasm-port/docs/compatibility-validation.md +++ b/wasm-port/docs/compatibility-validation.md @@ -296,9 +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, plus explicit host -parameter-file override paths saved back to OPFS with their LinuxCNC-produced -backup text. It also covers LinuxCNC tool-table +the host bridge writes it to persistent storage, plus INI-derived custom and +explicit host override parameter-file 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 diff --git a/wasm-port/tests/browser/interp_smoke.html b/wasm-port/tests/browser/interp_smoke.html index 8ded607..68174b2 100644 --- a/wasm-port/tests/browser/interp_smoke.html +++ b/wasm-port/tests/browser/interp_smoke.html @@ -587,6 +587,64 @@ "parameter_5399=99", ].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( "opfs_load_ini_named_tool_table", loadedIniFileSession.toolTable.result,