diff --git a/wasm-port/docs/compatibility-validation.md b/wasm-port/docs/compatibility-validation.md index fc8a922..7021d6f 100644 --- a/wasm-port/docs/compatibility-validation.md +++ b/wasm-port/docs/compatibility-validation.md @@ -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 diff --git a/wasm-port/tests/browser/interp_smoke.html b/wasm-port/tests/browser/interp_smoke.html index f4ced92..e079e90 100644 --- a/wasm-port/tests/browser/interp_smoke.html +++ b/wasm-port/tests/browser/interp_smoke.html @@ -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: [