补充浏览器 INI 文件名查询覆盖

结论:浏览器 INI/OPFS smoke 现在通过 LinuxCNC-backed INI SDK 验证 PARAMETER_FILE 和 TOOL_TABLE 文件名字符串查询。
This commit is contained in:
2026-06-08 10:55:11 +08:00
parent 1e17bbd0ba
commit 473964b9fe
2 changed files with 28 additions and 7 deletions

View File

@@ -120,12 +120,13 @@ keeping host override policy outside CNC semantics.
The browser INI/OPFS smoke script serves `wasm-port/` over localhost and runs The browser INI/OPFS smoke script serves `wasm-port/` over localhost and runs
Chromium headless against a test page that imports the JS SDK, loads the INI 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 WASM module, queries vendored LinuxCNC INI parsing through the SDK, including
performs an OPFS text-file, generic session snapshot, custom snapshot filename, machine-session parameter/tool-table file-name strings, and performs an OPFS
invalid snapshot filename/envelope, machine file, G-code text round trip, and text-file, generic session snapshot, custom snapshot filename, invalid
G-code filename path-model rejection. It also verifies that the INI panel UI snapshot filename/envelope, machine file, G-code text round trip, and G-code
exposes the default OPFS parameter-file and tool-table mappings used when a filename path-model rejection. It also verifies that the INI panel UI exposes
machine session is copied into the interpreter WASM filesystem. the default OPFS parameter-file and tool-table mappings used when a machine
session is copied into the interpreter WASM filesystem.
The browser interpreter smoke script serves `wasm-port/` over localhost and The browser interpreter smoke script serves `wasm-port/` over localhost and
runs Chromium headless against a test page that loads the interpreter-core runs Chromium headless against a test page that loads the interpreter-core
@@ -198,7 +199,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, including LinuxCNC-backed boolean conversion and machine-session file-name string lookup. | | `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, including LinuxCNC-backed boolean conversion and machine-session file-name string lookup. |
| `tests/wasm/node/verify_interp_wasm.sh` | Validates the initial interpreter-core WASM module can be built from vendored LinuxCNC interpreter source, loaded through the interpreter JS SDK, run the first fixture group through `Interp::execute()` and selected file fixtures through `Interp::open()`/`read()`/`execute()`, match the native canonical event plus required state readback fixtures, and run parameter-file restore/save through vendored LinuxCNC `Interp::restore_parameters()` and `Interp::save_parameters()`. | | `tests/wasm/node/verify_interp_wasm.sh` | Validates the initial interpreter-core WASM module can be built from vendored LinuxCNC interpreter source, loaded through the interpreter JS SDK, run the first fixture group through `Interp::execute()` and selected file fixtures through `Interp::open()`/`read()`/`execute()`, match the native canonical event plus required state readback fixtures, and run parameter-file restore/save through vendored LinuxCNC `Interp::restore_parameters()` and `Interp::save_parameters()`. |
| `tests/opfs/node/verify_file_service.sh` | Validates the host-owned OPFS text-file adapter, path model, session snapshot store including custom filenames and envelope/path rejection paths, machine file store, G-code text store including filename rejection paths, OPFS-to-WASM parameter/tool-table bridges, and grouped machine-session loading without moving file persistence, parameter semantics, or tool-table semantics into the WASM core. | | `tests/opfs/node/verify_file_service.sh` | Validates the host-owned OPFS text-file adapter, path model, session snapshot store including custom filenames and envelope/path rejection paths, machine file store, G-code text store including filename rejection paths, OPFS-to-WASM parameter/tool-table bridges, and grouped machine-session loading without moving file persistence, parameter semantics, or tool-table semantics into the WASM core. |
| `tests/browser/verify_ini_panel_browser.sh` | Validates the INI SDK, INI/interpreter WASM module loading, OPFS text-file round trip, generic session snapshot round trip plus custom filename and envelope/path rejection paths, machine file text round trip, G-code text round trip plus filename rejection paths, and the INI panel UI's machine-session load with default OPFS parameter/tool-table file mapping, G-code run, and canonical-event display paths in a real browser runtime. | | `tests/browser/verify_ini_panel_browser.sh` | Validates the INI SDK, INI/interpreter WASM module loading, LinuxCNC-backed INI machine-session file-name string lookup, OPFS text-file round trip, generic session snapshot round trip plus custom filename and envelope/path rejection paths, machine file text round trip, G-code text round trip plus filename rejection paths, and the INI panel UI's machine-session load with default OPFS parameter/tool-table file mapping, G-code run, and canonical-event display paths in a real browser runtime. |
| `tests/browser/verify_interp_browser.sh` | Validates the interpreter-core WASM module loads through the interpreter JS SDK in a real browser runtime and runs selected positive and negative canonical fixtures through vendored LinuxCNC `Interp::execute()` plus `Interp::open()`/`read()`/`execute()` via the exported C ABI, including OPFS-backed parameter-file restore/save and tool-table load/save through vendored LinuxCNC source. | | `tests/browser/verify_interp_browser.sh` | Validates the interpreter-core WASM module loads through the interpreter JS SDK in a real browser runtime and runs selected positive and negative canonical fixtures through vendored LinuxCNC `Interp::execute()` plus `Interp::open()`/`read()`/`execute()` via the exported C ABI, including OPFS-backed parameter-file restore/save and tool-table load/save through vendored LinuxCNC source. |
| `tests/host/verify_host_smokes.sh` | Runs the current host-side Node, WASM interpreter-core, OPFS, and browser smoke validation with shared WASM builds. | | `tests/host/verify_host_smokes.sh` | Runs the current host-side Node, WASM interpreter-core, OPFS, and browser smoke validation with shared WASM builds. |

View File

@@ -85,20 +85,40 @@ COORDINATES = X Y Z
[KINS] [KINS]
KINEMATICS = trivkins KINEMATICS = trivkins
JOINTS = 3 JOINTS = 3
[RS274NGC]
PARAMETER_FILE = browser-linuxcnc.var
[EMCIO]
TOOL_TABLE = browser-tool.tbl
`; `;
ini.writeTextFile(wasmPath, iniText); ini.writeTextFile(wasmPath, iniText);
assertEqual(ini.getString(wasmPath, "EMC", "MACHINE"), "browser-smoke", "machine"); assertEqual(ini.getString(wasmPath, "EMC", "MACHINE"), "browser-smoke", "machine");
assertEqual(ini.getString(wasmPath, "TRAJ", "LINEAR_UNITS"), "mm", "units"); assertEqual(ini.getString(wasmPath, "TRAJ", "LINEAR_UNITS"), "mm", "units");
assertEqual(ini.getString(wasmPath, "KINS", "KINEMATICS"), "trivkins", "kinematics"); assertEqual(ini.getString(wasmPath, "KINS", "KINEMATICS"), "trivkins", "kinematics");
assertEqual(
ini.getString(wasmPath, "RS274NGC", "PARAMETER_FILE"),
"browser-linuxcnc.var",
"parameter file",
);
assertEqual(
ini.getString(wasmPath, "EMCIO", "TOOL_TABLE"),
"browser-tool.tbl",
"tool table",
);
assertEqual(ini.getString(wasmPath, "TRAJ", "MISSING"), null, "missing tag"); assertEqual(ini.getString(wasmPath, "TRAJ", "MISSING"), null, "missing tag");
const fields = ini.getFields(wasmPath, { const fields = ini.getFields(wasmPath, {
machine: { section: "EMC", tag: "MACHINE" }, machine: { section: "EMC", tag: "MACHINE" },
joints: { section: "KINS", tag: "JOINTS" }, joints: { section: "KINS", tag: "JOINTS" },
parameterFile: { section: "RS274NGC", tag: "PARAMETER_FILE" },
toolTable: { section: "EMCIO", tag: "TOOL_TABLE" },
}); });
assertEqual(fields.machine, "browser-smoke", "field machine"); assertEqual(fields.machine, "browser-smoke", "field machine");
assertEqual(fields.joints, "3", "field joints"); assertEqual(fields.joints, "3", "field joints");
assertEqual(fields.parameterFile, "browser-linuxcnc.var", "field parameter file");
assertEqual(fields.toolTable, "browser-tool.tbl", "field tool table");
const opfsPath = machineIniPath("browser-smoke"); const opfsPath = machineIniPath("browser-smoke");
await saveTextFile(opfsPath, iniText); await saveTextFile(opfsPath, iniText);