按规划继续工作

结论:新增 namedparam_ini_semantics 夹具,将本地命名参数和 _ini[...] 查询纳入 upstream rs274 -i 基线,并接入 Node WASM 与浏览器 INI-aware 解释器 smoke;HAL 查询继续保留在 standalone adapter 边界。
This commit is contained in:
2026-06-08 12:18:02 +08:00
parent fb8fcee104
commit 657eecfcc3
9 changed files with 91 additions and 17 deletions

View File

@@ -250,7 +250,7 @@ Positive G-code fixtures currently cover:
- percent-delimited file `FINISH` boundary - percent-delimited file `FINISH` boundary
- file-open `ON_RESET` boundary - file-open `ON_RESET` boundary
- comment logging canonical calls - comment logging canonical calls
- named and numbered parameters - local, INI-backed named parameters and numbered parameters
- O-word subroutines - O-word subroutines
- program-end modal reset - program-end modal reset
- canonical runtime edge calls - 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`, `comment_logging`, `numbered_params`, `tool_semantics`, `tool_table_setup`,
`tool_reload`, `canned_cycles`, `cutter_comp_motion`, `threading_sync`, `tool_reload`, `canned_cycles`, `cutter_comp_motion`, `threading_sync`,
`nurbs_g5_semantics`, `nurbs_g6_semantics`, `state_tag_motion`, `nurbs_g5_semantics`, `nurbs_g6_semantics`, `state_tag_motion`,
`canon_runtime_edges`, `program_end_modal_reset`, and `namedparam_semantics` `canon_runtime_edges`, `program_end_modal_reset`, `namedparam_ini_semantics`,
through both Node WASM and browser INI-aware program ABI smoke coverage, 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`, plus the `g1_zero_feed`, `arc_radius_mismatch`, `arc_zero_radius`,
`cutter_comp_plane_change`, `g53_incremental`, `namedparam_readonly`, `cutter_comp_plane_change`, `g53_incremental`, `namedparam_readonly`,
`numbered_param_readonly`, `tool_not_found`, and `numbered_param_readonly`, `tool_not_found`, and
`tool_length_offset_not_found` negative fixtures. The WASM interpreter file `tool_length_offset_not_found` negative fixtures. The WASM interpreter file
path additionally covers the same canonical-event fixture group, plus 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`. `file_open_reset`, `percent_file_finish`, and `oword_subroutine`.
`position_params` uses a dedicated file-path expectation under `position_params` uses a dedicated file-path expectation under
`tests/fixtures/canon_file/` because LinuxCNC file execution advances the `tests/fixtures/canon_file/` because LinuxCNC file execution advances the
@@ -369,6 +371,7 @@ Node WASM `Interp::execute()` coverage currently includes:
- `state_tag_motion` - `state_tag_motion`
- `canon_runtime_edges` - `canon_runtime_edges`
- `program_end_modal_reset` - `program_end_modal_reset`
- `namedparam_ini_semantics` through the INI-aware program ABI
- `namedparam_semantics` through the INI-aware program ABI - `namedparam_semantics` through the INI-aware program ABI
Node WASM file-path coverage currently includes: Node WASM file-path coverage currently includes:
@@ -400,6 +403,7 @@ Node WASM file-path coverage currently includes:
- `percent_file_finish` - `percent_file_finish`
- `oword_subroutine` - `oword_subroutine`
- `position_params` 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 - `namedparam_semantics` through the INI-aware file ABI
Node WASM file-path negative coverage currently includes every fixture under 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` - `canon_runtime_edges`
- `tool_reload` - `tool_reload`
- `program_end_modal_reset` - `program_end_modal_reset`
- `namedparam_ini_semantics` through the INI-aware program ABI
- `namedparam_semantics` through the INI-aware program ABI - `namedparam_semantics` through the INI-aware program ABI
Browser interpreter negative coverage currently includes every fixture under 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` - `percent_file_finish`
- `oword_subroutine` - `oword_subroutine`
- `position_params` 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 - `namedparam_semantics` through the INI-aware file ABI
All current positive G-code fixtures have browser interpreter smoke coverage 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 vendored LinuxCNC source path and an upstream `rs274` side-by-side baseline for
parser/conversion, arc geometry, offsets, feed-control and feed-state parser/conversion, arc geometry, offsets, feed-control and feed-state
readback, comment/logging, 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-reload, tool select/change/length-offset, canned-cycle, state-tag motion,
tool-table setup, and O-word subroutine fixtures, plus threading/rigid tap, tool-table setup, and O-word subroutine fixtures, plus threading/rigid tap,
NURBS dispatch boundaries, and the comparable canonical runtime edge and NURBS dispatch boundaries, and the comparable canonical runtime edge and
program-end cleanup calls. Fixtures that depend on standalone-only runtime 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 `WAIT` or hidden NURBS control-point detail, or richer machine session state
still need dedicated native LinuxCNC baselines. still need dedicated native LinuxCNC baselines.
Remaining positive fixtures that are not in the upstream `rs274` side-by-side 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 are intentionally held out until they get a dedicated native LinuxCNC
baseline: `namedparam_semantics` depends on standalone INI/HAL adapter baseline: `namedparam_semantics` still depends on the standalone HAL adapter,
resolution. `state_tag_motion` now compares its motion events with upstream while `namedparam_ini_semantics` now covers the local named-parameter and
`rs274`, while `UPDATE_TAG` events remain a standalone state-tag capture LinuxCNC `_ini[...]` subset against upstream `rs274 -i`. `state_tag_motion`
boundary. `tool_semantics` now compares T/M6/G43/G49 canonical events with now compares its motion events with upstream `rs274`, while `UPDATE_TAG`
upstream `rs274`; M61 current-pocket host-state behavior remains covered by the events remain a standalone state-tag capture boundary. `tool_semantics` now
standalone fixture expectation, and `Interp::synch()` current/selected tool compares T/M6/G43/G49 canonical events with upstream `rs274`; M61
slot reads are covered by the native init harness. 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 The kinematics probes currently cover LinuxCNC identity/trivial kinematics, the
switchable `5axiskins` XYZBCW bridge-mill model, TRT `xyzac`/`xyzbc` switchable `5axiskins` XYZBCW bridge-mill model, TRT `xyzac`/`xyzbc`

View File

@@ -91,12 +91,13 @@ semantic rewrites:
- Fixture expectations are checked against the standalone vendored source - Fixture expectations are checked against the standalone vendored source
path. The upstream `rs274` side-by-side baseline now covers simple motion, path. The upstream `rs274` side-by-side baseline now covers simple motion,
arc geometry, offsets, feed-control, comment/logging, numbered-parameter, arc geometry, offsets, feed-control, comment/logging, numbered-parameter,
probing, spindle-orient, file-open reset, file-finish, tool-reload, and local named-parameter plus `_ini[...]` lookup through `rs274 -i`, probing,
tool select/change/length-offset, canned-cycle, state-tag motion, tool-table 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, setup, and O-word subroutine fixtures; it also covers threading/rigid tap,
NURBS dispatch boundaries, and comparable canonical runtime edge and NURBS dispatch boundaries, and comparable canonical runtime edge and
program-end cleanup calls. 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 `rs274` output gaps such as `WAIT` or hidden NURBS control-point detail still
need dedicated native LinuxCNC baselines. need dedicated native LinuxCNC baselines.
- `canned_cycles` is now in the upstream `rs274` side-by-side baseline after - `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 - `tool_semantics` now compares its T/M6/G43/G49 canonical subset with
upstream `rs274 -t -i`; M61 current-pocket host-state behavior remains a upstream `rs274 -t -i`; M61 current-pocket host-state behavior remains a
standalone fixture expectation. 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 ## Current Drift Conclusion

View File

@@ -48,7 +48,7 @@ G-code fixture coverage includes:
- NURBS G5 and G6 - NURBS G5 and G6
- spindle orient - spindle orient
- tool semantics and tool table setup - tool semantics and tool table setup
- named and numbered parameters - local, INI-backed named parameters and numbered parameters
- O-word subroutines - O-word subroutines
- program-end modal reset - program-end modal reset
- canonical runtime edge calls - canonical runtime edge calls

View File

@@ -29,6 +29,7 @@
saveMachineTextFiles, saveMachineTextFiles,
} from "../../runtime/opfs/machine-file-store.js"; } from "../../runtime/opfs/machine-file-store.js";
import { import {
INTERP_BASELINE_INI_FIXTURE,
INTERP_BROWSER_FILE_FIXTURES, INTERP_BROWSER_FILE_FIXTURES,
INTERP_BROWSER_MDI_FIXTURES, INTERP_BROWSER_MDI_FIXTURES,
INTERP_ERROR_FIXTURES, INTERP_ERROR_FIXTURES,
@@ -240,6 +241,18 @@
namedParamExpectedText, 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( const positionParamsText = await fetchText(
`../fixtures/gcode/${INTERP_POSITION_PARAMS_FILE_FIXTURE}.ngc`, `../fixtures/gcode/${INTERP_POSITION_PARAMS_FILE_FIXTURE}.ngc`,
); );
@@ -273,6 +286,14 @@
namedParamExpectedText, 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( verifyExpectedOutput(
"restore_parameters_missing_file", "restore_parameters_missing_file",
interp.restoreParameters("/work/browser-missing.var"), interp.restoreParameters("/work/browser-missing.var"),

View File

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

View File

@@ -0,0 +1,8 @@
#<local_probe> = 7.25
#<exists_local> = EXISTS[#<local_probe>]
#<exists_missing> = EXISTS[#<missing_probe>]
#<ini_velocity> = #<_ini[traj]max_linear_velocity>
(DEBUG, named local=%f#<local_probe>)
(DEBUG, exists local=%d#<exists_local> missing=%d#<exists_missing>)
(DEBUG, ini velocity=%d#<ini_velocity>)
M2

View File

@@ -71,4 +71,5 @@ export const INTERP_FILE_FIXTURES = [
export const INTERP_BROWSER_FILE_FIXTURES = INTERP_FILE_FIXTURES; export const INTERP_BROWSER_FILE_FIXTURES = INTERP_FILE_FIXTURES;
export const INTERP_INI_FIXTURE = "namedparam_semantics"; 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"; export const INTERP_POSITION_PARAMS_FILE_FIXTURE = "position_params";

View File

@@ -5,6 +5,7 @@ import assert from "node:assert/strict";
import { createLinuxCncInterpSdk } from "../../../runtime/sdk/src/index.js"; import { createLinuxCncInterpSdk } from "../../../runtime/sdk/src/index.js";
import { import {
INTERP_BASELINE_INI_FIXTURE,
INTERP_ERROR_FIXTURES, INTERP_ERROR_FIXTURES,
INTERP_FILE_FIXTURES, INTERP_FILE_FIXTURES,
INTERP_INI_FIXTURE, INTERP_INI_FIXTURE,
@@ -188,6 +189,20 @@ verifyExpectedOutput(
namedParamExpected, 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) { for (const fixtureName of INTERP_ERROR_FIXTURES) {
const programText = readFileSync( const programText = readFileSync(
resolve(rootDir, `tests/fixtures/gcode_errors/${fixtureName}.ngc`), resolve(rootDir, `tests/fixtures/gcode_errors/${fixtureName}.ngc`),
@@ -239,6 +254,14 @@ verifyExpectedOutput(
namedParamExpected, 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"; const positionParamsFilePath = "/work/position_params.ngc";
interp.writeTextFile( interp.writeTextFile(
positionParamsFilePath, positionParamsFilePath,

View File

@@ -20,6 +20,7 @@ FIXTURES=(
length_units length_units
plane_selection plane_selection
modal_incremental modal_incremental
namedparam_ini_semantics
numbered_params numbered_params
nurbs_g5_semantics nurbs_g5_semantics
nurbs_g6_semantics nurbs_g6_semantics
@@ -827,6 +828,8 @@ for name in "${FIXTURES[@]}"; do
set +e set +e
if [[ "$name" == "tool_table_setup" || "$name" == "tool_semantics" ]]; then 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 "$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 else
"$UPSTREAM_RS274" -g "$gcode_file" > "$native_raw" 2>&1 "$UPSTREAM_RS274" -g "$gcode_file" > "$native_raw" 2>&1
fi fi