diff --git a/check-linuxcnc-opfs-source-map.sh b/check-linuxcnc-opfs-source-map.sh index e83e199..a6a7bca 100755 --- a/check-linuxcnc-opfs-source-map.sh +++ b/check-linuxcnc-opfs-source-map.sh @@ -107,6 +107,8 @@ grep -F 'runSection("opfs directory persist and load"' \ web/test-browser-wasm-smoke-opfs-directory-sections.js >/dev/null grep -F 'runSection("opfs metadata queries avoid wasm mirror pollution"' \ web/test-browser-wasm-smoke-opfs-directory-sections.js >/dev/null +grep -F 'runSection("opfs copy and move mirror files"' \ + web/test-browser-wasm-smoke-opfs-mirror-sections.js >/dev/null grep -F 'runSection("browser opfs policy"' \ web/test-browser-wasm-smoke-opfs-policy-sections.js >/dev/null grep -F 'runSection("opfs parameter restore in new instance"' test-web-wasm-browser-smoke.sh >/dev/null diff --git a/test-web-wasm-browser-smoke.sh b/test-web-wasm-browser-smoke.sh index 69073a3..46024d6 100755 --- a/test-web-wasm-browser-smoke.sh +++ b/test-web-wasm-browser-smoke.sh @@ -179,6 +179,9 @@ required_browser_sections = { 'runSection("opfs directory persist and load"', 'runSection("opfs metadata queries avoid wasm mirror pollution"', ), + "web/test-browser-wasm-smoke-opfs-mirror-sections.js": ( + 'runSection("opfs copy and move mirror files"', + ), "web/test-browser-wasm-smoke-opfs-policy-sections.js": ( 'runSection("browser opfs policy"', ), diff --git a/web/test-browser-wasm-smoke-opfs-mirror-sections.js b/web/test-browser-wasm-smoke-opfs-mirror-sections.js index e8b91b3..884313b 100644 --- a/web/test-browser-wasm-smoke-opfs-mirror-sections.js +++ b/web/test-browser-wasm-smoke-opfs-mirror-sections.js @@ -88,6 +88,25 @@ export async function runBrowserOpfsMirrorSections(context, simulator) { () => simulator.fs.module.FS.stat(movedTemporaryWasmPath), "OPFS moveFile left the WASM mirror source behind", ); + await withSmokeSimulator(async (restoredMoveSimulator) => { + const restoredMovedParameterFile = await readOpfsText(restoredMoveSimulator, "parameters/move-main.var"); + expectText(restoredMovedParameterFile, "5161\t2.000000\n", + "OPFS moveFile destination was not persisted for a new WASM instance"); + if (await restoredMoveSimulator.fs.opfs.exists("parameters/move-main.var.new")) { + throw new Error("OPFS moveFile source was still persisted for a new WASM instance"); + } + const restoredMovedParameterWasmPath = restoredMoveSimulator.fs.opfs.resolvePath("parameters/move-main.var"); + const restoredMovedParameterWasm = new TextDecoder().decode( + restoredMoveSimulator.fs.module.FS.readFile(restoredMovedParameterWasmPath), + ); + expectText(restoredMovedParameterWasm, "5161\t2.000000\n", + "OPFS moveFile destination was not mirrored for a new WASM instance"); + const restoredMovedTemporaryWasmPath = restoredMoveSimulator.fs.opfs.resolvePath("parameters/move-main.var.new"); + expectMissingWasmPath( + () => restoredMoveSimulator.fs.module.FS.stat(restoredMovedTemporaryWasmPath), + "OPFS moveFile source was mirrored for a new WASM instance", + ); + }); await simulator.fs.opfs.writeFile("parameters/mirror-conflict-source.var", "5161\t3.000000\n"); const copyConflictPath = simulator.fs.opfs.resolvePath("parameters/mirror-conflict-copy.var");