diff --git a/test-linuxcnc-rs274-native.sh b/test-linuxcnc-rs274-native.sh index f30fb57..9ea8dec 100755 --- a/test-linuxcnc-rs274-native.sh +++ b/test-linuxcnc-rs274-native.sh @@ -525,6 +525,25 @@ for case in "${threading_convert_error_cases[@]}"; do fi grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_$fixture.err" done +# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc convert_probe() +# rejects zero feed, feed-per-revolution mode, and degenerate probe moves before +# issuing STRAIGHT_PROBE(). +probe_convert_error_cases=( + "linuxcnc_probe_zero_feed_error|Cannot probe with zero feed rate" + "linuxcnc_probe_feed_per_rev_error|Cannot probe with feed per rev mode" + "linuxcnc_probe_start_too_close_error|Start point too close to probe point" +) +for case in "${probe_convert_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 diff --git a/test-linuxcnc-source-link.sh b/test-linuxcnc-source-link.sh index c026dc5..43cb323 100755 --- a/test-linuxcnc-source-link.sh +++ b/test-linuxcnc-source-link.sh @@ -1182,6 +1182,25 @@ for case in "${threading_convert_error_cases[@]}"; do fi grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err" done +# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc convert_probe() +# rejects zero feed, feed-per-revolution mode, and degenerate probe moves before +# issuing STRAIGHT_PROBE(). +probe_convert_error_cases=( + "linuxcnc_probe_zero_feed_error|Cannot probe with zero feed rate" + "linuxcnc_probe_feed_per_rev_error|Cannot probe with feed per rev mode" + "linuxcnc_probe_start_too_close_error|Start point too close to probe point" +) +for case in "${probe_convert_error_cases[@]}"; do + fixture=${case%%|*} + expected=${case#*|} + if CNC_SIM_RS274_FILE_MODE=1 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 # Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc # read_items() only consumes a leading N word before item dispatch; # read_one_item() then uses the default reader table from interp_array.cc diff --git a/tests/gcode/linuxcnc_probe_feed_per_rev_error.ngc b/tests/gcode/linuxcnc_probe_feed_per_rev_error.ngc new file mode 100644 index 0000000..f09d310 --- /dev/null +++ b/tests/gcode/linuxcnc_probe_feed_per_rev_error.ngc @@ -0,0 +1,4 @@ +G21 G90 G17 +G95 +F1 +G38.2 Z1 diff --git a/tests/gcode/linuxcnc_probe_start_too_close_error.ngc b/tests/gcode/linuxcnc_probe_start_too_close_error.ngc new file mode 100644 index 0000000..360f5fa --- /dev/null +++ b/tests/gcode/linuxcnc_probe_start_too_close_error.ngc @@ -0,0 +1,4 @@ +G21 G90 G17 +G0 Z0 +F100 +G38.2 Z0 diff --git a/tests/gcode/linuxcnc_probe_zero_feed_error.ngc b/tests/gcode/linuxcnc_probe_zero_feed_error.ngc new file mode 100644 index 0000000..22c9580 --- /dev/null +++ b/tests/gcode/linuxcnc_probe_zero_feed_error.ngc @@ -0,0 +1,2 @@ +G21 G90 G17 +G38.2 Z1