结论:按 LinuxCNC rs274ngc_pre.cc save_parameters() 的 .new、.bak、unlink/link/rename 顺序补强 OPFS/app/browser smoke 守卫,并验证临时参数文件不会残留在 OPFS。
67 lines
3.3 KiB
Markdown
67 lines
3.3 KiB
Markdown
# LinuxCNC WASM smoke source map
|
|
|
|
This map records the source basis and boundaries for the Node and browser WASM
|
|
smoke wrappers. It is a smoke-test guard only; it must not add CNC behavior,
|
|
must not expand the temporary smoke parser, and must keep browser filesystem
|
|
persistence OPFS-only. In browser contexts, browser filesystem persistence
|
|
OPFS-only is the required boundary.
|
|
|
|
## LinuxCNC Source Basis
|
|
|
|
- `src/emc/rs274ngc/rs274ngc_pre.cc` provides `Interp::ini_load()`,
|
|
`Interp::restore_parameters()`, `Interp::save_parameters()`, and `read_text()`
|
|
behavior exercised by Node/browser bridge tests.
|
|
- `src/emc/rs274ngc/rs274ngc_pre.cc` saves parameters by writing
|
|
`filename + ".new"`, unlinking `filename + ".bak"`, linking the previous file
|
|
to `filename + ".bak"`, and renaming the temporary file over the main file.
|
|
- `src/emc/rs274ngc/interp_convert.cc` provides `convert_m()` coverage for
|
|
M66 waits and M68 analog output side effects used by generated remap cases.
|
|
- `src/emc/nml_intf/canon.hh` declares the `WAIT()` and
|
|
`SET_AUX_OUTPUT_VALUE()` canon entry points surfaced through the event bridge.
|
|
- `src/emc/kinematics/5axiskins.c`, `src/emc/kinematics/trtfuncs.c`,
|
|
`src/emc/kinematics/xyzac-trt-kins.c`,
|
|
`src/emc/kinematics/xyzbc-trt-kins.c`, and
|
|
`src/emc/kinematics/userkfuncs.c` provide the RTCP/kinematics inverse paths
|
|
covered by WASM smoke tests.
|
|
- `configs/sim/**.ini` files and `remap_subs/{428,429,430}remap.ngc` sources
|
|
generate `web/public/linuxcnc_switchkins_remap_config_cases.json`.
|
|
|
|
## Smoke Coverage
|
|
|
|
| Smoke entry | Boundary |
|
|
| --- | --- |
|
|
| `test-web-wasm-node-smoke.sh` | Runs the Node WASM wrapper with generated LinuxCNC switchkins cases and LinuxCNC-backed RTCP checks. |
|
|
| `test-web-wasm-node-smoke.cjs` | Exercises the C ABI, `web/src/wasm-core.js`, generated switchkins config cases, and source-backed kinematics events. |
|
|
| `test-web-wasm-browser-smoke.sh` | Runs browser checks after verifying copied WASM artifacts and smoke module structure. |
|
|
| `web/test-browser-wasm-smoke-linuxcnc-sections.js` | Exercises LinuxCNC browser parsing and generated switchkins cases without INI_FILE_NAME remap-load aliases. |
|
|
| `web/test-browser-wasm-smoke-opfs-parameter-sections.js` | Exercises LinuxCNC parameter restore/save/backup semantics through OPFS. |
|
|
| `web/test-browser-wasm-smoke-app-sections.js` | Verifies the browser app uses OPFS program and parameter persistence. |
|
|
|
|
## Boundaries
|
|
|
|
- Node smoke must leave OPFS disabled and must reject `parseFile*` methods that
|
|
require an OPFS workspace.
|
|
- Browser smoke must keep program files, LinuxCNC parameter files, temporary
|
|
`.new` files, and `.bak` backups under OPFS-backed storage.
|
|
- Generated switchkins config smoke cases must continue to come from
|
|
`web/public/linuxcnc_switchkins_remap_config_cases.json`.
|
|
- The browser smoke shell guard also pins required section names for LinuxCNC
|
|
browser parsing, OPFS parameter restore/save failure handling, and browser
|
|
app OPFS reload coverage.
|
|
- Smoke wrappers must keep positive minimum coverage thresholds so accidental
|
|
section loss is visible.
|
|
|
|
## Checks
|
|
|
|
Run:
|
|
|
|
```bash
|
|
./check-linuxcnc-wasm-smoke-source-map.sh
|
|
./test-native.sh
|
|
./test-linuxcnc-source-link.sh
|
|
```
|
|
|
|
`check-linuxcnc-wasm-smoke-source-map.sh` keeps this document, LinuxCNC source
|
|
anchors, smoke wrapper boundaries, OPFS-only policy, and generated switchkins
|
|
case usage synchronized.
|