数控系统仿真软件,从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

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