按建议,继续完成后续工作
结论:已将 session snapshot store 纳入 Chromium 浏览器 smoke,验证真实浏览器 OPFS 中的 INI 文本和通用 session snapshot 均可往返保存读取。
This commit is contained in:
@@ -75,7 +75,7 @@ round-trip store without defining CNC machine-state semantics.
|
||||
The browser smoke script serves `wasm-port/` over localhost and runs Chromium
|
||||
headless against a test page that imports the JS SDK, loads the INI WASM
|
||||
module, queries vendored LinuxCNC INI parsing through the SDK, and performs an
|
||||
OPFS text-file round trip.
|
||||
OPFS text-file and generic session snapshot round trip.
|
||||
|
||||
The aggregate host smoke script builds the INI WASM artifact once, then runs
|
||||
the Node WASM smoke, the Node OPFS mock smoke, and the Chromium browser smoke.
|
||||
@@ -128,7 +128,7 @@ The validation fails if:
|
||||
| --- | --- |
|
||||
| `tests/wasm/node/verify_ini_wasm.sh` | Validates the browser-facing INI WASM module can be built from vendored LinuxCNC `inifile.cc`, loaded through the JS SDK in Node, and queried through the exported C ABI. |
|
||||
| `tests/opfs/node/verify_file_service.sh` | Validates the host-owned OPFS text-file adapter, path model, and session snapshot store used by the browser INI panel without moving file persistence into the WASM core. |
|
||||
| `tests/browser/verify_ini_panel_browser.sh` | Validates the INI SDK, WASM module loading, and OPFS text-file round trip in a real browser runtime. |
|
||||
| `tests/browser/verify_ini_panel_browser.sh` | Validates the INI SDK, WASM module loading, OPFS text-file round trip, and generic session snapshot round trip in a real browser runtime. |
|
||||
| `tests/host/verify_host_smokes.sh` | Runs the current host-side Node, WASM, OPFS, and browser smoke validation with a single INI WASM build. |
|
||||
|
||||
## Fixture Coverage
|
||||
|
||||
@@ -62,7 +62,7 @@ semantic rewrites:
|
||||
vendored LinuxCNC `inifile.cc`.
|
||||
- OPFS validation covers a Node mock of the file-service adapter, the
|
||||
host-side path model, generic session snapshot storage, and a Chromium
|
||||
localhost round trip for INI text-file persistence.
|
||||
localhost round trip for INI text-file and session snapshot persistence.
|
||||
- Host-side smoke validation is aggregated by
|
||||
`tests/host/verify_host_smokes.sh` so Node, WASM, OPFS, and browser checks
|
||||
run from one command.
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
import { createLinuxCncIniSdk } from "../../runtime/sdk/src/linuxcnc-ini.js";
|
||||
import { loadTextFile, saveTextFile } from "../../runtime/opfs/file-service.js";
|
||||
import { machineIniPath } from "../../runtime/opfs/path-model.js";
|
||||
import {
|
||||
loadSessionSnapshot,
|
||||
saveSessionSnapshot,
|
||||
} from "../../runtime/opfs/snapshot-store.js";
|
||||
|
||||
const status = document.getElementById("status");
|
||||
|
||||
@@ -51,6 +55,23 @@ JOINTS = 3
|
||||
await saveTextFile(opfsPath, iniText);
|
||||
assertEqual(await loadTextFile(opfsPath), iniText, "opfs roundtrip");
|
||||
|
||||
const snapshotPayload = { files: { ini: opfsPath } };
|
||||
const savedSnapshot = await saveSessionSnapshot(
|
||||
"browser-session",
|
||||
snapshotPayload,
|
||||
{
|
||||
createdAt: "2026-06-08T00:00:00.000Z",
|
||||
metadata: { source: "browser-smoke" },
|
||||
},
|
||||
);
|
||||
const loadedSnapshot = await loadSessionSnapshot("browser-session");
|
||||
assertEqual(loadedSnapshot.format, "linuxcnc-wasm-session-snapshot", "snapshot format");
|
||||
assertEqual(loadedSnapshot.version, 1, "snapshot version");
|
||||
assertEqual(loadedSnapshot.sessionId, "browser-session", "snapshot session");
|
||||
assertEqual(loadedSnapshot.createdAt, savedSnapshot.createdAt, "snapshot timestamp");
|
||||
assertEqual(loadedSnapshot.payload.files.ini, opfsPath, "snapshot payload");
|
||||
assertEqual(loadedSnapshot.metadata.source, "browser-smoke", "snapshot metadata");
|
||||
|
||||
status.textContent = "browser_ini_opfs_smoke=ok";
|
||||
} catch (error) {
|
||||
status.textContent = `browser_ini_opfs_smoke=fail ${error.stack || error.message}`;
|
||||
|
||||
Reference in New Issue
Block a user