From 657eecfcc3085a14c685642bbc2adf0d29fb1087 Mon Sep 17 00:00:00 2001 From: wangdequan Date: Mon, 8 Jun 2026 12:18:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E8=A7=84=E5=88=92=E7=BB=A7=E7=BB=AD?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:新增 namedparam_ini_semantics 夹具,将本地命名参数和 _ini[...] 查询纳入 upstream rs274 -i 基线,并接入 Node WASM 与浏览器 INI-aware 解释器 smoke;HAL 查询继续保留在 standalone adapter 边界。 --- wasm-port/docs/compatibility-validation.md | 35 ++++++++++++------- wasm-port/docs/drift-report.md | 11 ++++-- wasm-port/docs/scope-and-baseline.md | 2 +- wasm-port/tests/browser/interp_smoke.html | 21 +++++++++++ .../canon/namedparam_ini_semantics.events | 4 +++ .../gcode/namedparam_ini_semantics.ngc | 8 +++++ .../tests/fixtures/interp-fixture-matrix.mjs | 1 + .../tests/wasm/node/verify_interp_wasm.mjs | 23 ++++++++++++ ...verify_native_linuxcnc_fixture_baseline.sh | 3 ++ 9 files changed, 91 insertions(+), 17 deletions(-) create mode 100644 wasm-port/tests/fixtures/canon/namedparam_ini_semantics.events create mode 100644 wasm-port/tests/fixtures/gcode/namedparam_ini_semantics.ngc diff --git a/wasm-port/docs/compatibility-validation.md b/wasm-port/docs/compatibility-validation.md index b10bf4c..5f31b51 100644 --- a/wasm-port/docs/compatibility-validation.md +++ b/wasm-port/docs/compatibility-validation.md @@ -250,7 +250,7 @@ Positive G-code fixtures currently cover: - percent-delimited file `FINISH` boundary - file-open `ON_RESET` boundary - comment logging canonical calls -- named and numbered parameters +- local, INI-backed named parameters and numbered parameters - O-word subroutines - program-end modal reset - canonical runtime edge calls @@ -276,14 +276,16 @@ for `minimal_linear`, `arc_semantics`, `length_units`, `modal_incremental`, `comment_logging`, `numbered_params`, `tool_semantics`, `tool_table_setup`, `tool_reload`, `canned_cycles`, `cutter_comp_motion`, `threading_sync`, `nurbs_g5_semantics`, `nurbs_g6_semantics`, `state_tag_motion`, -`canon_runtime_edges`, `program_end_modal_reset`, and `namedparam_semantics` -through both Node WASM and browser INI-aware program ABI smoke coverage, +`canon_runtime_edges`, `program_end_modal_reset`, `namedparam_ini_semantics`, +and `namedparam_semantics` through both Node WASM and browser INI-aware +program ABI smoke coverage, plus the `g1_zero_feed`, `arc_radius_mismatch`, `arc_zero_radius`, `cutter_comp_plane_change`, `g53_incremental`, `namedparam_readonly`, `numbered_param_readonly`, `tool_not_found`, and `tool_length_offset_not_found` negative fixtures. The WASM interpreter file path additionally covers the same canonical-event fixture group, plus -`namedparam_semantics` through the INI-aware file execution ABI, +`namedparam_ini_semantics` and `namedparam_semantics` through the INI-aware +file execution ABI, `file_open_reset`, `percent_file_finish`, and `oword_subroutine`. `position_params` uses a dedicated file-path expectation under `tests/fixtures/canon_file/` because LinuxCNC file execution advances the @@ -369,6 +371,7 @@ Node WASM `Interp::execute()` coverage currently includes: - `state_tag_motion` - `canon_runtime_edges` - `program_end_modal_reset` +- `namedparam_ini_semantics` through the INI-aware program ABI - `namedparam_semantics` through the INI-aware program ABI Node WASM file-path coverage currently includes: @@ -400,6 +403,7 @@ Node WASM file-path coverage currently includes: - `percent_file_finish` - `oword_subroutine` - `position_params` through the dedicated `canon_file/` expectation +- `namedparam_ini_semantics` through the INI-aware file ABI - `namedparam_semantics` through the INI-aware file ABI Node WASM file-path negative coverage currently includes every fixture under @@ -454,6 +458,7 @@ Browser interpreter `Interp::execute()` coverage currently includes: - `canon_runtime_edges` - `tool_reload` - `program_end_modal_reset` +- `namedparam_ini_semantics` through the INI-aware program ABI - `namedparam_semantics` through the INI-aware program ABI Browser interpreter negative coverage currently includes every fixture under @@ -499,6 +504,7 @@ Browser interpreter file-path coverage currently includes the same - `percent_file_finish` - `oword_subroutine` - `position_params` through the dedicated `canon_file/` expectation +- `namedparam_ini_semantics` through the INI-aware file ABI - `namedparam_semantics` through the INI-aware file ABI All current positive G-code fixtures have browser interpreter smoke coverage @@ -509,24 +515,27 @@ The current fixture expectations validate standalone behavior against both the vendored LinuxCNC source path and an upstream `rs274` side-by-side baseline for parser/conversion, arc geometry, offsets, feed-control and feed-state readback, comment/logging, -numbered-parameter, probing, spindle-orient, file-open reset, file-finish, +numbered-parameter, local named-parameter plus `_ini[...]` lookup through +`rs274 -i`, probing, spindle-orient, file-open reset, file-finish, tool-reload, tool select/change/length-offset, canned-cycle, state-tag motion, tool-table setup, and O-word subroutine fixtures, plus threading/rigid tap, NURBS dispatch boundaries, and the comparable canonical runtime edge and program-end cleanup calls. Fixtures that depend on standalone-only runtime -adapters, HAL/INI/tool-change state, upstream `rs274` output gaps such as +adapters, HAL/tool-change state, upstream `rs274` output gaps such as `WAIT` or hidden NURBS control-point detail, or richer machine session state still need dedicated native LinuxCNC baselines. Remaining positive fixtures that are not in the upstream `rs274` side-by-side baseline are intentionally held out until they get a dedicated native LinuxCNC -baseline: `namedparam_semantics` depends on standalone INI/HAL adapter -resolution. `state_tag_motion` now compares its motion events with upstream -`rs274`, while `UPDATE_TAG` events remain a standalone state-tag capture -boundary. `tool_semantics` now compares T/M6/G43/G49 canonical events with -upstream `rs274`; M61 current-pocket host-state behavior remains covered by the -standalone fixture expectation, and `Interp::synch()` current/selected tool -slot reads are covered by the native init harness. +baseline: `namedparam_semantics` still depends on the standalone HAL adapter, +while `namedparam_ini_semantics` now covers the local named-parameter and +LinuxCNC `_ini[...]` subset against upstream `rs274 -i`. `state_tag_motion` +now compares its motion events with upstream `rs274`, while `UPDATE_TAG` +events remain a standalone state-tag capture boundary. `tool_semantics` now +compares T/M6/G43/G49 canonical events with upstream `rs274`; M61 +current-pocket host-state behavior remains covered by the standalone fixture +expectation, and `Interp::synch()` current/selected tool slot reads are +covered by the native init harness. The kinematics probes currently cover LinuxCNC identity/trivial kinematics, the switchable `5axiskins` XYZBCW bridge-mill model, TRT `xyzac`/`xyzbc` diff --git a/wasm-port/docs/drift-report.md b/wasm-port/docs/drift-report.md index bbeeb2b..aa66e99 100644 --- a/wasm-port/docs/drift-report.md +++ b/wasm-port/docs/drift-report.md @@ -91,12 +91,13 @@ semantic rewrites: - Fixture expectations are checked against the standalone vendored source path. The upstream `rs274` side-by-side baseline now covers simple motion, arc geometry, offsets, feed-control, comment/logging, numbered-parameter, - probing, spindle-orient, file-open reset, file-finish, tool-reload, and - tool select/change/length-offset, canned-cycle, state-tag motion, tool-table + local named-parameter plus `_ini[...]` lookup through `rs274 -i`, probing, + spindle-orient, file-open reset, file-finish, tool-reload, and tool + select/change/length-offset, canned-cycle, state-tag motion, tool-table setup, and O-word subroutine fixtures; it also covers threading/rigid tap, NURBS dispatch boundaries, and comparable canonical runtime edge and program-end cleanup calls. - Adapter-heavy fixtures, standalone modal-state assertions, and upstream + HAL-backed adapter-heavy fixtures, standalone modal-state assertions, and upstream `rs274` output gaps such as `WAIT` or hidden NURBS control-point detail still need dedicated native LinuxCNC baselines. - `canned_cycles` is now in the upstream `rs274` side-by-side baseline after @@ -107,6 +108,10 @@ semantic rewrites: - `tool_semantics` now compares its T/M6/G43/G49 canonical subset with upstream `rs274 -t -i`; M61 current-pocket host-state behavior remains a standalone fixture expectation. +- `namedparam_ini_semantics` now compares local named-parameter behavior and + `_ini[...]` lookup with upstream `rs274 -i`; the broader + `namedparam_semantics` fixture still keeps `_hal[...]` lookup on the + documented standalone HAL adapter boundary. ## Current Drift Conclusion diff --git a/wasm-port/docs/scope-and-baseline.md b/wasm-port/docs/scope-and-baseline.md index e38f814..43238a3 100644 --- a/wasm-port/docs/scope-and-baseline.md +++ b/wasm-port/docs/scope-and-baseline.md @@ -48,7 +48,7 @@ G-code fixture coverage includes: - NURBS G5 and G6 - spindle orient - tool semantics and tool table setup -- named and numbered parameters +- local, INI-backed named parameters and numbered parameters - O-word subroutines - program-end modal reset - canonical runtime edge calls diff --git a/wasm-port/tests/browser/interp_smoke.html b/wasm-port/tests/browser/interp_smoke.html index 68174b2..990fdbe 100644 --- a/wasm-port/tests/browser/interp_smoke.html +++ b/wasm-port/tests/browser/interp_smoke.html @@ -29,6 +29,7 @@ saveMachineTextFiles, } from "../../runtime/opfs/machine-file-store.js"; import { + INTERP_BASELINE_INI_FIXTURE, INTERP_BROWSER_FILE_FIXTURES, INTERP_BROWSER_MDI_FIXTURES, INTERP_ERROR_FIXTURES, @@ -240,6 +241,18 @@ namedParamExpectedText, ); + const baselineIniProgramText = await fetchText( + `../fixtures/gcode/${INTERP_BASELINE_INI_FIXTURE}.ngc`, + ); + const baselineIniExpectedText = ( + await fetchText(`../fixtures/canon/${INTERP_BASELINE_INI_FIXTURE}.events`) + ).trimEnd(); + verifyExpectedOutput( + INTERP_BASELINE_INI_FIXTURE, + interp.runProgramWithIni(baselineIniProgramText, namedParamIniPath), + baselineIniExpectedText, + ); + const positionParamsText = await fetchText( `../fixtures/gcode/${INTERP_POSITION_PARAMS_FILE_FIXTURE}.ngc`, ); @@ -273,6 +286,14 @@ namedParamExpectedText, ); + const baselineIniPath = `/work/${INTERP_BASELINE_INI_FIXTURE}.ngc`; + interp.writeTextFile(baselineIniPath, baselineIniProgramText); + verifyExpectedOutput( + `${INTERP_BASELINE_INI_FIXTURE}_file`, + interp.runFileWithIni(baselineIniPath, namedParamIniPath), + baselineIniExpectedText, + ); + verifyExpectedOutput( "restore_parameters_missing_file", interp.restoreParameters("/work/browser-missing.var"), diff --git a/wasm-port/tests/fixtures/canon/namedparam_ini_semantics.events b/wasm-port/tests/fixtures/canon/namedparam_ini_semantics.events new file mode 100644 index 0000000..b4cc132 --- /dev/null +++ b/wasm-port/tests/fixtures/canon/namedparam_ini_semantics.events @@ -0,0 +1,4 @@ +canon_event=MESSAGE: named local=7.2500 +canon_event=MESSAGE: exists local=1 missing=0 +canon_event=MESSAGE: ini velocity=35 +canon_event=PROGRAM_END diff --git a/wasm-port/tests/fixtures/gcode/namedparam_ini_semantics.ngc b/wasm-port/tests/fixtures/gcode/namedparam_ini_semantics.ngc new file mode 100644 index 0000000..8276a91 --- /dev/null +++ b/wasm-port/tests/fixtures/gcode/namedparam_ini_semantics.ngc @@ -0,0 +1,8 @@ +# = 7.25 +# = EXISTS[#] +# = EXISTS[#] +# = #<_ini[traj]max_linear_velocity> +(DEBUG, named local=%f#) +(DEBUG, exists local=%d# missing=%d#) +(DEBUG, ini velocity=%d#) +M2 diff --git a/wasm-port/tests/fixtures/interp-fixture-matrix.mjs b/wasm-port/tests/fixtures/interp-fixture-matrix.mjs index efbe3e0..436c645 100644 --- a/wasm-port/tests/fixtures/interp-fixture-matrix.mjs +++ b/wasm-port/tests/fixtures/interp-fixture-matrix.mjs @@ -71,4 +71,5 @@ export const INTERP_FILE_FIXTURES = [ export const INTERP_BROWSER_FILE_FIXTURES = INTERP_FILE_FIXTURES; export const INTERP_INI_FIXTURE = "namedparam_semantics"; +export const INTERP_BASELINE_INI_FIXTURE = "namedparam_ini_semantics"; export const INTERP_POSITION_PARAMS_FILE_FIXTURE = "position_params"; diff --git a/wasm-port/tests/wasm/node/verify_interp_wasm.mjs b/wasm-port/tests/wasm/node/verify_interp_wasm.mjs index bb4e541..238eae6 100644 --- a/wasm-port/tests/wasm/node/verify_interp_wasm.mjs +++ b/wasm-port/tests/wasm/node/verify_interp_wasm.mjs @@ -5,6 +5,7 @@ import assert from "node:assert/strict"; import { createLinuxCncInterpSdk } from "../../../runtime/sdk/src/index.js"; import { + INTERP_BASELINE_INI_FIXTURE, INTERP_ERROR_FIXTURES, INTERP_FILE_FIXTURES, INTERP_INI_FIXTURE, @@ -188,6 +189,20 @@ verifyExpectedOutput( namedParamExpected, ); +const baselineIniProgramText = readFileSync( + resolve(rootDir, `tests/fixtures/gcode/${INTERP_BASELINE_INI_FIXTURE}.ngc`), + "utf8", +); +const baselineIniExpected = readFileSync( + resolve(rootDir, `tests/fixtures/canon/${INTERP_BASELINE_INI_FIXTURE}.events`), + "utf8", +).trimEnd(); +verifyExpectedOutput( + INTERP_BASELINE_INI_FIXTURE, + interp.runProgramWithIni(baselineIniProgramText, namedParamIniPath), + baselineIniExpected, +); + for (const fixtureName of INTERP_ERROR_FIXTURES) { const programText = readFileSync( resolve(rootDir, `tests/fixtures/gcode_errors/${fixtureName}.ngc`), @@ -239,6 +254,14 @@ verifyExpectedOutput( namedParamExpected, ); +const baselineIniFilePath = `/work/${INTERP_BASELINE_INI_FIXTURE}.ngc`; +interp.writeTextFile(baselineIniFilePath, baselineIniProgramText); +verifyExpectedOutput( + `${INTERP_BASELINE_INI_FIXTURE}_file`, + interp.runFileWithIni(baselineIniFilePath, namedParamIniPath), + baselineIniExpected, +); + const positionParamsFilePath = "/work/position_params.ngc"; interp.writeTextFile( positionParamsFilePath, diff --git a/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh b/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh index e9802c6..2014dcd 100755 --- a/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh +++ b/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh @@ -20,6 +20,7 @@ FIXTURES=( length_units plane_selection modal_incremental + namedparam_ini_semantics numbered_params nurbs_g5_semantics nurbs_g6_semantics @@ -827,6 +828,8 @@ for name in "${FIXTURES[@]}"; do set +e if [[ "$name" == "tool_table_setup" || "$name" == "tool_semantics" ]]; then "$UPSTREAM_RS274" -g -i "$TOOL_TABLE_INI" -t "$TOOL_TABLE_BASELINE" "$gcode_file" > "$native_raw" 2>&1 + elif [[ "$name" == "namedparam_ini_semantics" ]]; then + "$UPSTREAM_RS274" -g -i "$ROOT_DIR/tests/fixtures/ini/namedparams.ini" "$gcode_file" > "$native_raw" 2>&1 else "$UPSTREAM_RS274" -g "$gcode_file" > "$native_raw" 2>&1 fi