继续按 align-linuxcnc 约束:补 G53 校验 native 覆盖,测试通过

This commit is contained in:
cnc
2026-06-02 23:11:47 +08:00
parent c25b0eff22
commit ecec27aa64
2 changed files with 25 additions and 1 deletions

View File

@@ -192,7 +192,7 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu
| --- | --- | --- |
| 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` |
| 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`, and incremental-mode rejection in smoke parser | `tests/gcode/linuxcnc_machine_coordinates.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` |
| Tool length offset `G43/G43.1/G43.2/G49` | covered with nonzero tool-table offset, dynamic replacement, additive axis offsets, `G43.2 H...`, and clear through LinuxCNC native/source backends | `tests/gcode/linuxcnc_tool_length.ngc`, `tests/gcode/linuxcnc_dynamic_tool_length.ngc` |
| RTCP controls `G43.4/G43.5/G49` | covered as simulator-owned control lines | `tests/gcode/linuxcnc_rtcp_controls.ngc` |

View File

@@ -143,6 +143,30 @@ 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_check.cc
# check_g_codes() rejects invalid modal-0 combinations for G4, G10, and G53
# before convert_g() executes motion or coordinate updates.
check_g_code_error_cases=(
"linuxcnc_g4_missing_p_error|Dwell time missing with g4"
"linuxcnc_g4_arc_p_conflict_error|G4 not allowed with G2 or G3 because they both use P"
"linuxcnc_g10_invalid_l_error|Line with G10 does not have L0, L1, L10, L11, L2, or L20"
"linuxcnc_g10_p_non_integer_error|P value not an integer with G10"
"linuxcnc_g10_l2_p_out_of_range_error|P value out of range (0-9) with G10 L2"
"linuxcnc_g10_l1_p_out_of_range_error|P value out of range with G10 L1"
"linuxcnc_g53_arc_error|Must use g0 or g1 with g53"
"linuxcnc_g53_incremental_error|Cannot use g53 incremental"
)
for case in "${check_g_code_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
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