From 7c6f91a169a49c237362cf5458ca4681f7be34c0 Mon Sep 17 00:00:00 2001 From: wangdequan Date: Mon, 8 Jun 2026 13:48:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8E=A7=E7=B3=BB=E7=BB=9F=E4=BB=BF?= =?UTF-8?q?=E7=9C=9F=E8=BD=AF=E4=BB=B6=EF=BC=8C=E4=BB=8Elinuxcnc=E7=A7=BB?= =?UTF-8?q?=E6=A4=8D=E8=BF=87=E6=9D=A5=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:新增 coordinate_offsets 文件执行路径专用 WASM/浏览器验证,保留 MDI 路径状态读回,并通过 native、Node WASM、browser 与 host 聚合 smoke 验证。 --- wasm-port/docs/compatibility-validation.md | 15 ++++++--- wasm-port/docs/drift-report.md | 6 ++-- wasm-port/tests/browser/interp_smoke.html | 16 ++++++++++ .../fixtures/canon/coordinate_offsets.events | 16 ++++++++++ .../canon_file/coordinate_offsets.events | 31 +++++++++++++++++++ .../tests/fixtures/interp-fixture-matrix.mjs | 2 +- .../tests/wasm/node/verify_interp_wasm.mjs | 21 +++++++++++++ 7 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 wasm-port/tests/fixtures/canon_file/coordinate_offsets.events diff --git a/wasm-port/docs/compatibility-validation.md b/wasm-port/docs/compatibility-validation.md index 8deaa23..9abda1a 100644 --- a/wasm-port/docs/compatibility-validation.md +++ b/wasm-port/docs/compatibility-validation.md @@ -297,6 +297,11 @@ file execution ABI, post-execute position parameters differently than the line-by-line MDI smoke; both expectations now also pin post-execute modal, override, spindle, mist, and flood `_setup` state readback. +`coordinate_offsets` also uses a dedicated file-path expectation because +LinuxCNC file execution leaves the post-execute position parameters at the +file-path reset state while the line-by-line MDI path exposes the active G55 +offset values; both paths pin the post-execute modal, override, spindle, mist, +and flood `_setup` state. `tool_semantics` also pins the post-execute position-parameter and modal, override, spindle, mist, and flood `_setup` state after T/M6/G43/G49/M61 tool behavior. @@ -397,7 +402,6 @@ Node WASM file-path coverage currently includes: - `length_units` - `modal_incremental` - `plane_selection` -- `coordinate_offsets` - `g53_machine_coordinates` - `feed_control_modes` - `probe_semantics` @@ -418,6 +422,7 @@ Node WASM file-path coverage currently includes: - `file_open_reset` - `percent_file_finish` - `oword_subroutine` +- `coordinate_offsets` through the dedicated `canon_file/` expectation - `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 @@ -498,7 +503,6 @@ Browser interpreter file-path coverage currently includes the same - `length_units` - `modal_incremental` - `plane_selection` -- `coordinate_offsets` - `g53_machine_coordinates` - `feed_control_modes` - `probe_semantics` @@ -519,6 +523,7 @@ Browser interpreter file-path coverage currently includes the same - `file_open_reset` - `percent_file_finish` - `oword_subroutine` +- `coordinate_offsets` through the dedicated `canon_file/` expectation - `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 @@ -538,9 +543,9 @@ 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. The standalone vendored-source harness, Node WASM smoke, and browser smoke also -pin `feed_control_modes`, the `position_params` MDI/file-path, -`tool_semantics`, and `canon_runtime_edges` post-program modal, override, -spindle, mist, and flood `_setup` state. The same upstream baseline also +pin `coordinate_offsets` MDI/file-path, `feed_control_modes`, the +`position_params` MDI/file-path, `tool_semantics`, and `canon_runtime_edges` +post-program modal, override, spindle, mist, and flood `_setup` state. The same upstream baseline also validates the current negative fixture error text and absent canonical-event constraints. Fixtures that depend on standalone-only runtime adapters, HAL state, upstream `rs274` output gaps such as diff --git a/wasm-port/docs/drift-report.md b/wasm-port/docs/drift-report.md index 9f07fd3..7f01641 100644 --- a/wasm-port/docs/drift-report.md +++ b/wasm-port/docs/drift-report.md @@ -98,9 +98,9 @@ semantic rewrites: fixtures; it also covers threading/rigid tap, NURBS dispatch boundaries, and comparable canonical runtime edge and program-end cleanup calls. The vendored-source native harness plus Node WASM and browser smokes also pin - `feed_control_modes`, the `position_params` MDI/file-path, - `tool_semantics`, and `canon_runtime_edges` post-program modal, override, - spindle, mist, and flood `_setup` state. It now also checks the negative fixture set + `coordinate_offsets` MDI/file-path, `feed_control_modes`, the + `position_params` MDI/file-path, `tool_semantics`, and `canon_runtime_edges` + post-program modal, override, spindle, mist, and flood `_setup` state. It now also checks the negative fixture set against upstream `rs274 -g` for expected error text and absent canonical event constraints. HAL-backed adapter-heavy fixtures, standalone modal-state assertions, and upstream diff --git a/wasm-port/tests/browser/interp_smoke.html b/wasm-port/tests/browser/interp_smoke.html index 990fdbe..e01e881 100644 --- a/wasm-port/tests/browser/interp_smoke.html +++ b/wasm-port/tests/browser/interp_smoke.html @@ -32,6 +32,7 @@ INTERP_BASELINE_INI_FIXTURE, INTERP_BROWSER_FILE_FIXTURES, INTERP_BROWSER_MDI_FIXTURES, + INTERP_COORDINATE_OFFSETS_FILE_FIXTURE, INTERP_ERROR_FIXTURES, INTERP_INI_FIXTURE, INTERP_POSITION_PARAMS_FILE_FIXTURE, @@ -253,6 +254,21 @@ baselineIniExpectedText, ); + const coordinateOffsetsText = await fetchText( + `../fixtures/gcode/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`, + ); + const coordinateOffsetsPath = `/work/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`; + interp.writeTextFile(coordinateOffsetsPath, coordinateOffsetsText); + verifyExpectedOutput( + `${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}_file`, + interp.runFile(coordinateOffsetsPath), + ( + await fetchText( + `../fixtures/canon_file/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.events`, + ) + ).trimEnd(), + ); + const positionParamsText = await fetchText( `../fixtures/gcode/${INTERP_POSITION_PARAMS_FILE_FIXTURE}.ngc`, ); diff --git a/wasm-port/tests/fixtures/canon/coordinate_offsets.events b/wasm-port/tests/fixtures/canon/coordinate_offsets.events index bc2a016..f558366 100644 --- a/wasm-port/tests/fixtures/canon/coordinate_offsets.events +++ b/wasm-port/tests/fixtures/canon/coordinate_offsets.events @@ -10,3 +10,19 @@ canon_event=SET_G92_OFFSET x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 canon_event=SET_G5X_OFFSET index=1 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 canon_event=SET_G92_OFFSET x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 canon_event=SET_XY_ROTATION rotation=0 +setup.current_x=0 +setup.current_y=0 +setup.current_z=0 +setup.parameter_5420=-4 +setup.parameter_5421=-5 +setup.parameter_5422=-6 +post_execute.plane=1 +post_execute.distance_mode=0 +post_execute.feed_mode=0 +post_execute.motion_mode=0 +post_execute.origin_index=1 +post_execute.feed_override=0 +post_execute.speed_override_0=0 +post_execute.spindle_turning_0=1 +post_execute.mist=0 +post_execute.flood=0 diff --git a/wasm-port/tests/fixtures/canon_file/coordinate_offsets.events b/wasm-port/tests/fixtures/canon_file/coordinate_offsets.events new file mode 100644 index 0000000..84c856a --- /dev/null +++ b/wasm-port/tests/fixtures/canon_file/coordinate_offsets.events @@ -0,0 +1,31 @@ +file_open=0 +file_read_count=7 +file_execute_count=6 +canon_event=SELECT_PLANE plane=1 +canon_event=STRAIGHT_TRAVERSE line=1 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_G5X_OFFSET index=2 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_G92_OFFSET x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_XY_ROTATION rotation=0 +canon_event=SET_G5X_OFFSET index=2 x=4 y=5 z=6 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_XY_ROTATION rotation=0 +canon_event=SET_G92_OFFSET x=-14 y=-25 z=-36 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_G92_OFFSET x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_G5X_OFFSET index=1 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_G92_OFFSET x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_XY_ROTATION rotation=0 +setup.current_x=0 +setup.current_y=0 +setup.current_z=0 +setup.parameter_5420=0 +setup.parameter_5421=0 +setup.parameter_5422=0 +post_execute.plane=1 +post_execute.distance_mode=0 +post_execute.feed_mode=0 +post_execute.motion_mode=0 +post_execute.origin_index=1 +post_execute.feed_override=0 +post_execute.speed_override_0=0 +post_execute.spindle_turning_0=1 +post_execute.mist=0 +post_execute.flood=0 diff --git a/wasm-port/tests/fixtures/interp-fixture-matrix.mjs b/wasm-port/tests/fixtures/interp-fixture-matrix.mjs index 436c645..0923071 100644 --- a/wasm-port/tests/fixtures/interp-fixture-matrix.mjs +++ b/wasm-port/tests/fixtures/interp-fixture-matrix.mjs @@ -45,7 +45,6 @@ export const INTERP_FILE_FIXTURES = [ "length_units", "modal_incremental", "plane_selection", - "coordinate_offsets", "g53_machine_coordinates", "feed_control_modes", "probe_semantics", @@ -72,4 +71,5 @@ 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_COORDINATE_OFFSETS_FILE_FIXTURE = "coordinate_offsets"; 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 238eae6..cd5c69a 100644 --- a/wasm-port/tests/wasm/node/verify_interp_wasm.mjs +++ b/wasm-port/tests/wasm/node/verify_interp_wasm.mjs @@ -6,6 +6,7 @@ import assert from "node:assert/strict"; import { createLinuxCncInterpSdk } from "../../../runtime/sdk/src/index.js"; import { INTERP_BASELINE_INI_FIXTURE, + INTERP_COORDINATE_OFFSETS_FILE_FIXTURE, INTERP_ERROR_FIXTURES, INTERP_FILE_FIXTURES, INTERP_INI_FIXTURE, @@ -262,6 +263,26 @@ verifyExpectedOutput( baselineIniExpected, ); +const coordinateOffsetsFilePath = `/work/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`; +interp.writeTextFile( + coordinateOffsetsFilePath, + readFileSync( + resolve(rootDir, `tests/fixtures/gcode/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`), + "utf8", + ), +); +verifyExpectedOutput( + `${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}_file`, + interp.runFile(coordinateOffsetsFilePath), + readFileSync( + resolve( + rootDir, + `tests/fixtures/canon_file/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.events`, + ), + "utf8", + ).trimEnd(), +); + const positionParamsFilePath = "/work/position_params.ngc"; interp.writeTextFile( positionParamsFilePath,