扩展解释器WASM夹具覆盖
结论:解释器核心WASM验证已从minimal_linear扩展到弧、单位、增量、平面和坐标偏置等第一批基础夹具,仍直接调用LinuxCNC解释器源码。
This commit is contained in:
@@ -73,9 +73,9 @@ queries against a file written to the Emscripten filesystem.
|
|||||||
The WASM interpreter-core smoke script builds
|
The WASM interpreter-core smoke script builds
|
||||||
`build/wasm/core/linuxcnc_interp.js` and `linuxcnc_interp.wasm` from the same
|
`build/wasm/core/linuxcnc_interp.js` and `linuxcnc_interp.wasm` from the same
|
||||||
vendored LinuxCNC interpreter source set used by the native minimal
|
vendored LinuxCNC interpreter source set used by the native minimal
|
||||||
interpreter harness. It loads the module in Node, runs the `minimal_linear`
|
interpreter harness. It loads the module in Node, runs the first WASM
|
||||||
G-code fixture through `Interp::execute()`, and compares emitted canonical
|
interpreter fixture group through `Interp::execute()`, and compares emitted
|
||||||
events with `tests/fixtures/canon/minimal_linear.events`.
|
canonical events with the matching files in `tests/fixtures/canon/`.
|
||||||
|
|
||||||
The OPFS host-boundary script validates the JavaScript file-service adapter
|
The OPFS host-boundary script validates the JavaScript file-service adapter
|
||||||
with a Node mock of the browser File System Access handles. It covers nested
|
with a Node mock of the browser File System Access handles. It covers nested
|
||||||
@@ -92,8 +92,9 @@ module, queries vendored LinuxCNC INI parsing through the SDK, and performs an
|
|||||||
OPFS text-file, generic session snapshot, machine file, and G-code text
|
OPFS text-file, generic session snapshot, machine file, and G-code text
|
||||||
round trip.
|
round trip.
|
||||||
|
|
||||||
The aggregate host smoke script builds the INI WASM artifact once, then runs
|
The aggregate host smoke script builds the INI and interpreter-core WASM
|
||||||
the Node WASM smoke, the Node OPFS mock smoke, and the Chromium browser smoke.
|
artifacts once, then runs the Node WASM smokes, the Node OPFS mock smoke, and
|
||||||
|
the Chromium browser smoke.
|
||||||
|
|
||||||
## Source Coverage
|
## Source Coverage
|
||||||
|
|
||||||
@@ -142,7 +143,7 @@ The validation fails if:
|
|||||||
| Harness | Purpose |
|
| Harness | Purpose |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `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/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/wasm/node/verify_interp_wasm.sh` | Validates the initial interpreter-core WASM module can be built from vendored LinuxCNC interpreter source, run `minimal_linear.ngc` through `Interp::execute()`, and match the native canonical event fixture. |
|
| `tests/wasm/node/verify_interp_wasm.sh` | Validates the initial interpreter-core WASM module can be built from vendored LinuxCNC interpreter source, run the first fixture group through `Interp::execute()`, and match the native canonical event fixtures. |
|
||||||
| `tests/opfs/node/verify_file_service.sh` | Validates the host-owned OPFS text-file adapter, path model, session snapshot store, machine file store, and G-code text store used by the browser INI panel without moving file persistence into the WASM core. |
|
| `tests/opfs/node/verify_file_service.sh` | Validates the host-owned OPFS text-file adapter, path model, session snapshot store, machine file store, and G-code text 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, OPFS text-file round trip, generic session snapshot round trip, machine file text round trip, and G-code text 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, generic session snapshot round trip, machine file text round trip, and G-code text round trip in a real browser runtime. |
|
||||||
| `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. |
|
||||||
@@ -190,10 +191,11 @@ Negative fixtures currently cover:
|
|||||||
|
|
||||||
Current full-core validation is native-only. WASM/SDK validation covers the
|
Current full-core validation is native-only. WASM/SDK validation covers the
|
||||||
INI parser smoke harness and an initial interpreter-core canonical event smoke
|
INI parser smoke harness and an initial interpreter-core canonical event smoke
|
||||||
for `minimal_linear`. OPFS validation is limited to the JavaScript
|
for `minimal_linear`, `arc_semantics`, `length_units`, `modal_incremental`,
|
||||||
host-boundary adapter plus the INI browser smoke harness. Full browser
|
`plane_selection`, and `coordinate_offsets`. OPFS validation is limited to the
|
||||||
coverage, full SDK coverage, and full machine-session validation remain future
|
JavaScript host-boundary adapter plus the INI browser smoke harness. Full
|
||||||
work.
|
browser coverage, full SDK coverage, and full machine-session validation remain
|
||||||
|
future work.
|
||||||
|
|
||||||
The current fixture expectations validate standalone behavior against both the
|
The current fixture expectations validate standalone behavior against both the
|
||||||
vendored LinuxCNC source path and an upstream `rs274` side-by-side baseline for
|
vendored LinuxCNC source path and an upstream `rs274` side-by-side baseline for
|
||||||
|
|||||||
@@ -40,23 +40,37 @@ const interp = await createLinuxCncInterpModule({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const fixtureName = "minimal_linear";
|
const fixtureNames = [
|
||||||
const programText = readFileSync(
|
"minimal_linear",
|
||||||
resolve(rootDir, `tests/fixtures/gcode/${fixtureName}.ngc`),
|
"arc_semantics",
|
||||||
"utf8",
|
"length_units",
|
||||||
);
|
"modal_incremental",
|
||||||
const expectedEvents = readFileSync(
|
"plane_selection",
|
||||||
resolve(rootDir, `tests/fixtures/canon/${fixtureName}.events`),
|
"coordinate_offsets",
|
||||||
"utf8",
|
];
|
||||||
).trimEnd();
|
|
||||||
|
|
||||||
const output = runProgram(interp, programText);
|
for (const fixtureName of fixtureNames) {
|
||||||
const actualEventSet = new Set(
|
const programText = readFileSync(
|
||||||
output.split("\n").filter((line) => line.startsWith("canon_event=")),
|
resolve(rootDir, `tests/fixtures/gcode/${fixtureName}.ngc`),
|
||||||
);
|
"utf8",
|
||||||
const expectedEventLines = expectedEvents.split("\n").filter(Boolean);
|
);
|
||||||
|
const expectedEvents = readFileSync(
|
||||||
|
resolve(rootDir, `tests/fixtures/canon/${fixtureName}.events`),
|
||||||
|
"utf8",
|
||||||
|
).trimEnd();
|
||||||
|
|
||||||
for (const expectedEvent of expectedEventLines) {
|
const output = runProgram(interp, programText);
|
||||||
assert.equal(actualEventSet.has(expectedEvent), true, expectedEvent);
|
const actualEventSet = new Set(
|
||||||
|
output.split("\n").filter((line) => line.startsWith("canon_event=")),
|
||||||
|
);
|
||||||
|
const expectedEventLines = expectedEvents.split("\n").filter(Boolean);
|
||||||
|
|
||||||
|
for (const expectedEvent of expectedEventLines) {
|
||||||
|
assert.equal(
|
||||||
|
actualEventSet.has(expectedEvent),
|
||||||
|
true,
|
||||||
|
`${fixtureName}: ${expectedEvent}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
console.log("interp_wasm_node_smoke=ok");
|
console.log("interp_wasm_node_smoke=ok");
|
||||||
|
|||||||
Reference in New Issue
Block a user