继续按 align-linuxcnc 约束:补工具号查找错误源码覆盖,测试通过
This commit is contained in:
@@ -271,6 +271,24 @@ CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
|||||||
CNC_SIM_RS274_VAR="$var_file" \
|
CNC_SIM_RS274_VAR="$var_file" \
|
||||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_tool_number.ngc \
|
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_tool_number.ngc \
|
||||||
>"$output_dir/cnc_sim_linuxcnc_source_tool_number.json"
|
>"$output_dir/cnc_sim_linuxcnc_source_tool_number.json"
|
||||||
|
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc
|
||||||
|
# convert_tool_select() and convert_m() M61 both route through
|
||||||
|
# src/emc/rs274ngc/interp_find.cc find_tool_index() for tooldata lookup.
|
||||||
|
tool_number_error_cases=(
|
||||||
|
"linuxcnc_t_missing_tool_error|Requested tool 99 not found in the tool table"
|
||||||
|
"linuxcnc_m61_missing_tool_error|Requested tool 99 not found in the tool table"
|
||||||
|
)
|
||||||
|
for case in "${tool_number_error_cases[@]}"; do
|
||||||
|
fixture=${case%%|*}
|
||||||
|
expected=${case#*|}
|
||||||
|
if CNC_SIM_RS274_VAR="$var_file" \
|
||||||
|
"$build_dir/linuxcnc_rs274_source_dump" "tests/gcode/$fixture.ngc" \
|
||||||
|
>"$output_dir/cnc_sim_linuxcnc_source_$fixture.json" 2>"$output_dir/cnc_sim_linuxcnc_source_$fixture.err"; then
|
||||||
|
echo "expected $fixture.ngc to fail" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
|
||||||
|
done
|
||||||
CNC_SIM_RS274_VAR="$var_file" \
|
CNC_SIM_RS274_VAR="$var_file" \
|
||||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_program_stops.ngc \
|
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_program_stops.ngc \
|
||||||
>"$output_dir/cnc_sim_linuxcnc_source_program_stops.json"
|
>"$output_dir/cnc_sim_linuxcnc_source_program_stops.json"
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ grep -F 'tests/gcode/linuxcnc_lathe_diameter_g76.ngc' docs/linuxcnc-porting.md >
|
|||||||
grep -F 'missing source-linked G7 diameter-mode G76 final threading pass' test-linuxcnc-source-link.sh >/dev/null
|
grep -F 'missing source-linked G7 diameter-mode G76 final threading pass' test-linuxcnc-source-link.sh >/dev/null
|
||||||
grep -F 'convert_tool_length_offset() rejects invalid G43.2 H/axis combinations' test-linuxcnc-source-link.sh >/dev/null
|
grep -F 'convert_tool_length_offset() rejects invalid G43.2 H/axis combinations' test-linuxcnc-source-link.sh >/dev/null
|
||||||
grep -F 'linuxcnc_g43_2_missing_h_axis_error|G43.2: No axes specified and H word missing' test-linuxcnc-source-link.sh >/dev/null
|
grep -F 'linuxcnc_g43_2_missing_h_axis_error|G43.2: No axes specified and H word missing' test-linuxcnc-source-link.sh >/dev/null
|
||||||
|
grep -F 'convert_tool_select() and convert_m() M61 both route through' test-linuxcnc-source-link.sh >/dev/null
|
||||||
grep -F 'read_atsign()' test-linuxcnc-source-link.sh >/dev/null
|
grep -F 'read_atsign()' test-linuxcnc-source-link.sh >/dev/null
|
||||||
grep -F 'tests/gcode/linuxcnc_polar_coordinates.ngc' test-linuxcnc-source-link.sh >/dev/null
|
grep -F 'tests/gcode/linuxcnc_polar_coordinates.ngc' test-linuxcnc-source-link.sh >/dev/null
|
||||||
grep -F 'tests/gcode/linuxcnc_polar_coordinate_variants.ngc' test-linuxcnc-source-link.sh >/dev/null
|
grep -F 'tests/gcode/linuxcnc_polar_coordinate_variants.ngc' test-linuxcnc-source-link.sh >/dev/null
|
||||||
|
|||||||
3
tests/gcode/linuxcnc_m61_missing_tool_error.ngc
Normal file
3
tests/gcode/linuxcnc_m61_missing_tool_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
G21 G90 G17
|
||||||
|
M61 Q99
|
||||||
|
M30
|
||||||
3
tests/gcode/linuxcnc_t_missing_tool_error.ngc
Normal file
3
tests/gcode/linuxcnc_t_missing_tool_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
G21 G90 G17
|
||||||
|
T99
|
||||||
|
M30
|
||||||
Reference in New Issue
Block a user