继续按 align-linuxcnc 约束:补轴运动 native 覆盖,测试通过

结论:补齐 LinuxCNC interp_internal.cc enhance_block() 轴/运动错误 fixture 的 native 校验,并同步 check_other_codes() native 覆盖文档;./test-native.sh 与 ./test-linuxcnc-source-link.sh 均通过。
This commit is contained in:
cnc
2026-06-02 23:34:56 +08:00
parent 93f2a903b5
commit ba526a6042
2 changed files with 51 additions and 2 deletions

View File

@@ -191,6 +191,7 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu
| Area | Status | Regression |
| --- | --- | --- |
| Basic modal motion `G0/G1/G2/G3` | covered, including `G91` incremental linear motion, R-format arcs, `G18`/`G19` arc plane mapping, and `G90.1`/`G91.1` IJK modes | `tests/gcode/linuxcnc_basic_motion.ngc`, `tests/gcode/basic_mill.ngc`, `tests/gcode/incremental_and_r_arc.ngc`, `tests/gcode/linuxcnc_arc_planes.ngc`, `tests/gcode/linuxcnc_arc_distance_modes.ngc` |
| Block-level axis/motion validation | covered through LinuxCNC native/source `enhance_block()` checks for invalid `G80` axes, missing `G52/G92` or motion axes, bare axes without active motion, and modal-0 axis consumers on motion blocks | `tests/gcode/linuxcnc_g80_axis_error.ngc`, `tests/gcode/linuxcnc_g52_missing_axis_error.ngc`, `tests/gcode/linuxcnc_g92_missing_axis_error.ngc`, `tests/gcode/linuxcnc_motion_missing_axis_error.ngc`, `tests/gcode/linuxcnc_axis_without_motion_error.ngc`, `tests/gcode/linuxcnc_motion_with_g92_axis_error.ngc` |
| Predefined position moves `G28/G28.1`, `G30/G30.1` | covered for stored position, waypoint, selected-axis return, and all-axis return | `tests/gcode/linuxcnc_predefined_positions.ngc` |
| Machine-coordinate move `G53` | covered for explicit/modal `G0`, `G1`, arc rejection, and incremental-mode rejection through LinuxCNC native/source backends | `tests/gcode/linuxcnc_machine_coordinates.ngc`, `tests/gcode/linuxcnc_g53_arc_error.ngc`, `tests/gcode/linuxcnc_g53_incremental_error.ngc` |
| Tool select/change `T... M6` | covered with minimal native tooldata | `tests/gcode/basic_mill.ngc` |
@@ -198,9 +199,9 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu
| RTCP controls `G43.4/G43.5/G49` | covered as simulator-owned control lines | `tests/gcode/linuxcnc_rtcp_controls.ngc` |
| Kinematics switch `M428/M429/M430` | covered as simulator-owned control lines | `tests/gcode/linuxcnc_rtcp_controls.ngc` |
| Spindle, coolant, program stops, and current tool number `M3/M4/M5`, `M7/M8/M9`, `M0/M1/M60/M30`, `M61 Q...` | covered through LinuxCNC native/source backends, including source-linked `convert_m()` rejection of out-of-range `M3/M4/M5 $` spindle selectors and negative `M61 Q` | `tests/gcode/linuxcnc_spindle_direction.ngc`, `tests/gcode/linuxcnc_coolant.ngc`, `tests/gcode/linuxcnc_program_stops.ngc`, `tests/gcode/linuxcnc_tool_number.ngc`, `tests/gcode/linuxcnc_m3_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m4_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m5_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m61_negative_q_error.ngc` |
| Spindle speed mode `G96/G97` | covered with Canon `SET_SPINDLE_MODE` preserved as mode state events, including `G96 D...` max-RPM value and source-linked `check_other_codes()` rejection of missing `S` with `G96` | `tests/gcode/linuxcnc_spindle_modes.ngc`, `tests/gcode/linuxcnc_g96_missing_s_word_error.ngc` |
| Spindle speed mode `G96/G97` | covered with Canon `SET_SPINDLE_MODE` preserved as mode state events, including `G96 D...` max-RPM value and native/source `check_other_codes()` rejection of missing `S` with `G96` | `tests/gcode/linuxcnc_spindle_modes.ngc`, `tests/gcode/linuxcnc_g96_missing_s_word_error.ngc` |
| Spindle orientation `M19 R... P... Q...` | covered with Canon `ORIENT_SPINDLE` and `WAIT_SPINDLE_ORIENT_COMPLETE` preserved as temporary mode state events, including source-linked `check_other_codes()` validation for `P/R` words and `convert_m()` rejection of out-of-range `$` selectors and nonpositive `Q` waits | `tests/gcode/linuxcnc_spindle_orient.ngc`, `tests/gcode/linuxcnc_m19_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m19_p_not_integer_error.ngc`, `tests/gcode/linuxcnc_m19_p_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m19_r_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m19_zero_q_error.ngc` |
| Spindle-synchronized feed and threading `G33/G33.1/G76` | covered through smoke, LinuxCNC native, and source-linked paths with Canon `START_SPEED_FEED_SYNCH`/`STOP_SPEED_FEED_SYNCH` preserved, rigid-tap line numbers normalized, G76 multi-pass threading smoke-covered, source-linked `check_other_codes()` validation for required/disallowed `K/F/P/I/J` words, and source-linked `convert_straight()`/`convert_threading_cycle()` rejection of invalid spindle state, spindle selector, rotary-axis motion, and G76 `I/J/K` geometry | `tests/gcode/linuxcnc_threading_sync.ngc`, `tests/gcode/linuxcnc_threading_cycle.ngc`, `tests/gcode/linuxcnc_g33_missing_k_word_error.ngc`, `tests/gcode/linuxcnc_g33_f_word_error.ngc`, `tests/gcode/linuxcnc_g33_1_missing_k_word_error.ngc`, `tests/gcode/linuxcnc_g33_1_f_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_i_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_j_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_k_word_error.ngc`, `tests/gcode/linuxcnc_g33_stopped_spindle_error.ngc`, `tests/gcode/linuxcnc_g33_1_stopped_spindle_error.ngc`, `tests/gcode/linuxcnc_g33_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_g33_1_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_g76_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_g76_stopped_spindle_error.ngc`, `tests/gcode/linuxcnc_g76_rotary_axis_error.ngc`, `tests/gcode/linuxcnc_g76_i_zero_error.ngc`, `tests/gcode/linuxcnc_g76_j_zero_error.ngc`, `tests/gcode/linuxcnc_g76_k_less_equal_j_error.ngc`, smoke API regression |
| Spindle-synchronized feed and threading `G33/G33.1/G76` | covered through smoke, LinuxCNC native, and source-linked paths with Canon `START_SPEED_FEED_SYNCH`/`STOP_SPEED_FEED_SYNCH` preserved, rigid-tap line numbers normalized, G76 multi-pass threading smoke-covered, native/source `check_other_codes()` validation for required/disallowed `K/F/P/I/J` words, and source-linked `convert_straight()`/`convert_threading_cycle()` rejection of invalid spindle state, spindle selector, rotary-axis motion, and G76 `I/J/K` geometry | `tests/gcode/linuxcnc_threading_sync.ngc`, `tests/gcode/linuxcnc_threading_cycle.ngc`, `tests/gcode/linuxcnc_g33_missing_k_word_error.ngc`, `tests/gcode/linuxcnc_g33_f_word_error.ngc`, `tests/gcode/linuxcnc_g33_1_missing_k_word_error.ngc`, `tests/gcode/linuxcnc_g33_1_f_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_i_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_j_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_k_word_error.ngc`, `tests/gcode/linuxcnc_g33_stopped_spindle_error.ngc`, `tests/gcode/linuxcnc_g33_1_stopped_spindle_error.ngc`, `tests/gcode/linuxcnc_g33_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_g33_1_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_g76_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_g76_stopped_spindle_error.ngc`, `tests/gcode/linuxcnc_g76_rotary_axis_error.ngc`, `tests/gcode/linuxcnc_g76_i_zero_error.ngc`, `tests/gcode/linuxcnc_g76_j_zero_error.ngc`, `tests/gcode/linuxcnc_g76_k_less_equal_j_error.ngc`, smoke API regression |
| Lathe diameter/radius mode `G7/G8` | covered through LinuxCNC native/source backends for same-block X scaling, `G76` I/J/K threading geometry interaction, and `#<_lathe_diameter_mode>`/`#<_lathe_radius_mode>` readonly named-parameter state | `tests/gcode/linuxcnc_lathe_diameter_mode.ngc`, `tests/gcode/linuxcnc_lathe_diameter_g76.ngc` |
| Digital/analog I/O `M62`-`M68` | covered with Canon digital output, analog output, and input wait callbacks preserved as temporary state events, including source-linked `convert_m()` validation for required `P`/`E`, M66 input selection, M66 wait timeout, and analog wait restrictions | `tests/gcode/linuxcnc_io_controls.ngc`, `tests/gcode/linuxcnc_m62_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_m63_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_m64_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_m65_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_m66_missing_input_error.ngc`, `tests/gcode/linuxcnc_m66_both_inputs_error.ngc`, `tests/gcode/linuxcnc_m66_zero_timeout_error.ngc`, `tests/gcode/linuxcnc_m66_analog_wait_error.ngc`, `tests/gcode/linuxcnc_m67_missing_e_word_error.ngc`, `tests/gcode/linuxcnc_m68_missing_e_word_error.ngc` |
| Override controls `M48`-`M53` | covered with Canon feed override, spindle speed override, adaptive feed, and feed hold callbacks preserved as temporary state events | `tests/gcode/linuxcnc_override_controls.ngc` |

View File

@@ -143,6 +143,29 @@ if CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/li
echo "expected linuxcnc_modal_invalidate.ngc to fail" >&2
exit 1
fi
# Source basis: LinuxCNC src/emc/rs274ngc/interp_internal.cc
# enhance_block() assigns motion_to_be and rejects invalid axis use with G80,
# missing axes for G52/G92 or motion codes, bare axis words without active
# motion, and modal-0 G codes that consume axis values on a motion block.
enhance_block_error_cases=(
"linuxcnc_g80_axis_error|Cannot use axis values with g80"
"linuxcnc_g52_missing_axis_error|All axes missing with g52 or g92"
"linuxcnc_g92_missing_axis_error|All axes missing with g52 or g92"
"linuxcnc_motion_missing_axis_error|All axes missing with motion code"
"linuxcnc_axis_without_motion_error|Cannot use axis values without a g code that uses them"
"linuxcnc_motion_with_g92_axis_error|Cannot use two g codes that both use axis values"
)
for case in "${enhance_block_error_cases[@]}"; do
fixture=${case%%|*}
expected=${case#*|}
if CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_dump" "tests/gcode/$fixture.ngc" \
>"$output_dir/cnc_sim_linuxcnc_$fixture.json" 2>"$output_dir/cnc_sim_linuxcnc_$fixture.err"; then
echo "expected $fixture.ngc to fail" >&2
exit 1
fi
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_$fixture.err"
done
# Source basis: LinuxCNC src/emc/rs274ngc/interp_check.cc
# check_g_codes() rejects invalid modal-0 combinations for G4, G10, and G53
# before convert_g() executes motion or coordinate updates.
@@ -287,6 +310,31 @@ for case in "${unused_word_error_cases[@]}"; do
fi
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_$fixture.err"
done
# Source basis: LinuxCNC src/emc/rs274ngc/interp_check.cc
# check_other_codes() enforces required and disallowed words for G96,
# G33/G33.1, and G76 before motion conversion.
threading_check_error_cases=(
"linuxcnc_g96_missing_s_word_error|S word missing with G96"
"linuxcnc_g33_missing_k_word_error|K word missing with g33/g33.1"
"linuxcnc_g33_f_word_error|F word used with a g33/g33.1"
"linuxcnc_g33_1_missing_k_word_error|K word missing with g33/g33.1"
"linuxcnc_g33_1_f_word_error|F word used with a g33/g33.1"
"linuxcnc_g76_missing_p_word_error|P word missing with G76"
"linuxcnc_g76_missing_i_word_error|I J or K words missing with G76"
"linuxcnc_g76_missing_j_word_error|I J or K words missing with G76"
"linuxcnc_g76_missing_k_word_error|I J or K words missing with G76"
)
for case in "${threading_check_error_cases[@]}"; do
fixture=${case%%|*}
expected=${case#*|}
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_dump" "tests/gcode/$fixture.ngc" \
>"$output_dir/cnc_sim_linuxcnc_$fixture.json" 2>"$output_dir/cnc_sim_linuxcnc_$fixture.err"; then
echo "expected $fixture.ngc to fail" >&2
exit 1
fi
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_$fixture.err"
done
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_threading_sync.ngc >"$output_dir/cnc_sim_linuxcnc_threading_sync.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_threading_cycle.ngc >"$output_dir/cnc_sim_linuxcnc_threading_cycle.json"
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc