数控系统仿真软件,从linuxcnc移植过来的

结论:新增 coordinate_offsets 文件执行路径专用 WASM/浏览器验证,保留 MDI 路径状态读回,并通过 native、Node WASM、browser 与 host 聚合 smoke 验证。
This commit is contained in:
2026-06-08 13:48:59 +08:00
parent 57f3085e37
commit 7c6f91a169
7 changed files with 98 additions and 9 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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`,
);

View File

@@ -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

View File

@@ -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

View File

@@ -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";

View File

@@ -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,