按建议继续完成后续工作

结论:native 兼容性验证已接入 interpreter init、rotary indexer、canonical 边界 fixture,并新增 upstream rs274 side-by-side 基线;完整 verify_native_probes.sh 已通过。
This commit is contained in:
2026-06-07 22:37:29 +08:00
parent 59cfc8406e
commit 7a20531ae4
20 changed files with 530 additions and 25 deletions

View File

@@ -24,10 +24,14 @@ The native validation script runs these checks in order:
vendored file exists, and every vendored file is byte-identical to upstream.
3. `tools/verify_no_standalone_cnc_semantics.sh`
Confirms standalone code has not reintroduced `Interp::convert_g()`.
4. `tools/build_native_probes.sh`
4. `tools/verify_native_linuxcnc_fixture_baseline.sh`
Runs a narrow side-by-side fixture baseline through upstream
`../linuxcnc/bin/rs274` and compares normalized canonical events for
fixtures that do not require standalone-only runtime adapters.
5. `tools/build_native_probes.sh`
Builds native source probes and standalone harnesses from vendored
LinuxCNC source plus narrow runtime wrappers.
5. `tests/native/verify_native_probes.sh`
6. `tests/native/verify_native_probes.sh`
Checks probe exit codes, source-probe coverage, harness stdout, canonical
fixture events, and expected error behavior.
@@ -51,6 +55,8 @@ The validation fails if:
| `linuxcnc_namedparam_harness` | Validates LinuxCNC named parameter behavior, `_ini[...]`, and `_hal[...]` adapter resolution. |
| `linuxcnc_interp_minimal_harness` | Runs G-code fixtures through vendored LinuxCNC parser/execution/conversion code and captures canonical events. |
| `linuxcnc_parameter_file_harness` | Validates LinuxCNC parameter file restore/save behavior and required/read-only parameter handling. |
| `linuxcnc_interp_init_harness` | Validates vendored LinuxCNC `Interp::init()` emits canonical initialization boundaries through the standalone event sink. |
| `linuxcnc_indexer_harness` | Validates vendored LinuxCNC single-axis rotary indexer dispatch emits lock/unlock and motion boundaries through the standalone event sink. |
| `linuxcnc_tp_api_probe` | Validates vendored LinuxCNC trajectory planner calls for linear, arc, and queued motion paths. |
| `linuxcnc_kinematics_probe` | Validates vendored LinuxCNC `trivkins.c` plus `kins_util.c` initialize and perform identity forward/inverse mapping through the standalone HAL/RTAPI boundary. |
| `linuxcnc_5axis_kinematics_probe` | Validates vendored LinuxCNC `5axiskins.c` through `switchkins.c`, including 5-axis forward/inverse round-trip behavior and switching to identity kinematics. |
@@ -75,6 +81,11 @@ Positive G-code fixtures currently cover:
- spindle orient
- tool semantics
- tool table setup
- tool-data reload boundary
- interpreter state-tag boundary
- percent-delimited file `FINISH` boundary
- file-open `ON_RESET` boundary
- comment logging canonical calls
- named and numbered parameters
- O-word subroutines
- program-end modal reset
@@ -96,9 +107,11 @@ Negative fixtures currently cover:
Current validation is native-only. WASM, browser, SDK, OPFS, and full
machine-session validation remain future work.
The current fixture expectations validate standalone behavior against the
vendored LinuxCNC source path. They do not yet run a side-by-side native
LinuxCNC executable comparison for each fixture.
The current fixture expectations validate standalone behavior against both the
vendored LinuxCNC source path and a first upstream `rs274` side-by-side
baseline for simple parser/conversion fixtures. Fixtures that depend on
standalone-only runtime adapters, HAL/INI/tool table setup, or richer machine
session state still need dedicated native LinuxCNC baselines.
The kinematics probes currently cover LinuxCNC identity/trivial kinematics,
the switchable `5axiskins` XYZBCW bridge-mill model, and the TRT `xyzac`/`xyzbc`

View File

@@ -26,6 +26,13 @@ semantic rewrites:
| HAL lookup | Standalone HAL adapter for `_hal[...]` named parameter reads. |
| INI lookup | Standalone INI adapter around vendored LinuxCNC INI parser behavior. |
| Canonical output | Canonical calls are captured as test events instead of driving hardware. |
| Tool-data reload | LinuxCNC `RELOAD_TOOLDATA` is captured as a canonical test event; browser/native tool-table reload plumbing remains a future host/runtime adapter. |
| Interpreter state tags | LinuxCNC `UPDATE_TAG` callbacks are captured from the state tags packed by vendored interpreter code; standalone code does not derive modal state. |
| Rotary indexer lock state | LinuxCNC `UNLOCK_ROTARY` and `LOCK_ROTARY` callbacks are captured from the vendored single-axis indexer path; standalone code does not implement rotary-indexing semantics. |
| File flush | LinuxCNC `FINISH` is captured as a canonical test event on the vendored `%`-delimited file-reading path. |
| Interpreter reset | LinuxCNC `ON_RESET` is captured as a canonical test event on the vendored interpreter reset/file-open path. |
| Interpreter init | LinuxCNC `INIT_CANON` and the canonical initialization sequence from vendored `Interp::init()` are captured as test events. |
| Comment logging | LinuxCNC `LOGOPEN`, `LOG`, `LOGAPPEND`, and `LOGCLOSE` callbacks are captured as canonical test events instead of writing host log files. |
| Python/remap | Python/remap hooks are stubbed at the runtime edge. |
| Dynamic interpreter path | `interp_base.cc` probe uses standalone `EMC2_HOME` compile-time path boundary. |
| Realtime scheduler | TP probes seed deterministic status/config data instead of running LinuxCNC realtime process topology. |
@@ -58,8 +65,10 @@ semantic rewrites:
- Positive cutter-compensated motion and cutter compensation rejection paths
now have standalone interpreter fixture coverage through vendored LinuxCNC
source.
- Fixture expectations are currently checked against the standalone vendored
source path, not by running a native LinuxCNC binary for every fixture.
- Fixture expectations are checked against the standalone vendored source
path. A first upstream `rs274` side-by-side baseline now covers simple
parser/conversion fixtures; adapter-heavy fixtures still need dedicated
native LinuxCNC baselines.
## Current Drift Conclusion

View File

@@ -456,6 +456,58 @@ Current verified progress:
`tests/fixtures/gcode/tool_table_setup.ngc` and
`tests/fixtures/canon/tool_table_setup.events` pin `G10 L1` tool offset,
diameter, front/back angle, and orientation behavior.
- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records
the tool-data reload boundary call emitted by vendored
`interp_convert.cc::convert_modal_0()`: `RELOAD_TOOLDATA`.
`tests/fixtures/gcode/tool_reload.ngc` and
`tests/fixtures/canon/tool_reload.events` pin `G10 L0` dispatch without
adding standalone tool-table reload semantics.
- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records
interpreter state-tag boundary calls emitted by vendored LinuxCNC
`interp_write.cc::write_state_tag()` and
`interp_convert.cc::update_tag()`: `UPDATE_TAG`.
`tests/fixtures/gcode/state_tag_motion.ngc` and
`tests/fixtures/canon/state_tag_motion.events` pin straight-motion state tag
emission without deriving modal state in standalone code.
- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records
rotary indexer lock/unlock boundary calls emitted by vendored
`interp_convert.cc::issue_straight_index()`: `UNLOCK_ROTARY` and
`LOCK_ROTARY`. A dedicated `linuxcnc_indexer_harness` pins the LinuxCNC
single-axis `G0 A...` indexer path, including the surrounding motion-control
boundary calls, without adding standalone rotary-indexing semantics.
- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records
the canonical flush boundary emitted by vendored LinuxCNC file-reading
code: `FINISH`. `tests/fixtures/gcode/percent_file_finish.ngc` and
`tests/fixtures/canon/percent_file_finish.events` pin `%`-delimited file
handling from `rs274ngc_pre.cc::open()` and `interp_read.cc::read_text()`.
The native verification script treats this fixture as file-mode-only
because `%` is a LinuxCNC program-file delimiter, not a valid MDI command.
- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records
the reset/queue-drop boundary emitted by vendored
`rs274ngc_pre.cc::reset()`: `ON_RESET`.
`tests/fixtures/gcode/file_open_reset.ngc` and
`tests/fixtures/canon/file_open_reset.events` pin the LinuxCNC file-open
reset path without adding standalone queue-management semantics.
- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records
the interpreter initialization boundary emitted by vendored
`rs274ngc_pre.cc::init()`: `INIT_CANON`. A dedicated
`linuxcnc_interp_init_harness` calls vendored `Interp::init()` and pins the
LinuxCNC initialization sequence: `INIT_CANON`, `USE_LENGTH_UNITS`,
`SET_G5X_OFFSET`, `SET_G92_OFFSET`, `SET_XY_ROTATION`, and
`SET_FEED_REFERENCE`, without changing the minimal G-code fixture harness
startup path.
- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records
comment logging canonical boundary calls emitted by vendored
`interp_convert.cc::convert_comment()`: `LOGOPEN`, `LOG`, `LOGAPPEND`,
and `LOGCLOSE`. `tests/fixtures/gcode/comment_logging.ngc` and
`tests/fixtures/canon/comment_logging.events` pin LinuxCNC comment logging
dispatch without adding standalone comment semantics.
- `tools/verify_native_linuxcnc_fixture_baseline.sh` now runs a first
side-by-side baseline against upstream `../linuxcnc/bin/rs274`. It normalizes
native LinuxCNC canonical output for simple parser/conversion fixtures
(`minimal_linear`, `length_units`, `plane_selection`, and
`modal_incremental`) and compares it with the standalone fixture events,
without introducing a project-authored CNC semantics oracle.
- `tests/fixtures/gcode_errors/g1_zero_feed.ngc` and
`tests/fixtures/canon_errors/g1_zero_feed.expected` pin the negative
`G1` zero-feed case. The source basis is LinuxCNC