Expand LinuxCNC interpreter regression coverage

This commit is contained in:
2026-06-09 14:54:54 +08:00
parent 50757e45ba
commit 5bd8f12872
143 changed files with 10895 additions and 219 deletions

View File

@@ -209,8 +209,21 @@ check_exitcode linuxcnc_interp_minimal_harness.interp_exists.run
check_exitcode linuxcnc_interp_minimal_harness.return_value.run
check_exitcode linuxcnc_interp_minimal_harness.subs_follow_main.run
check_exitcode linuxcnc_interp_minimal_harness.fractional_linenumbers.run
check_exitcode linuxcnc_interp_minimal_harness.cam_nisley_bare.run
check_exitcode linuxcnc_interp_minimal_harness.cam_nisley.run
check_exitcode linuxcnc_interp_minimal_harness.crazy_paths.run
check_exitcode linuxcnc_interp_minimal_harness.namedparam_bug424.run
check_exitcode linuxcnc_interp_minimal_harness.flowsnake.run
check_exitcode linuxcnc_interp_minimal_harness.inside_corners.run
check_exitcode linuxcnc_interp_minimal_harness.inverse_time_with_comp.run
check_exitcode linuxcnc_interp_minimal_harness.ccomp_lathe_comp.run
check_exitcode linuxcnc_interp_minimal_harness.ccomp_mill_g90g91g92.run
check_exitcode linuxcnc_interp_minimal_harness.ccomp_mill_line_arc_entry.run
check_exitcode linuxcnc_interp_minimal_harness.ccomp_mill_zchanges.run
check_exitcode linuxcnc_interp_minimal_harness.bad_a_in_canned_cycle.run
check_exitcode linuxcnc_interp_minimal_harness.bad_a_in_canned_cycle2.run
check_exitcode linuxcnc_interp_minimal_harness.bad_ccomp_arcexit.run
check_exitcode linuxcnc_interp_minimal_harness.bad_ccomp_gouging.run
check_exitcode linuxcnc_interp_minimal_harness.bad_exists_1.run
check_exitcode linuxcnc_interp_minimal_harness.bad_exists_2.run
check_exitcode linuxcnc_interp_minimal_harness.bad_exists_3.run
@@ -249,6 +262,8 @@ check_exitcode linuxcnc_interp_minimal_harness.sim_axis_foam.run
check_exitcode linuxcnc_interp_minimal_harness.sim_bridgemill.run
check_exitcode linuxcnc_interp_minimal_harness.sim_geometry_xyzc.run
check_exitcode linuxcnc_interp_minimal_harness.sim_external_offsets_dyn.run
check_exitcode linuxcnc_interp_minimal_harness.g92_persistence_enabled.run
check_exitcode linuxcnc_interp_minimal_harness.g92_persistence_disabled.run
check_exitcode linuxcnc_parameter_file_harness
check_exitcode linuxcnc_parameter_file_harness.run
check_exitcode linuxcnc_interp_init_harness
@@ -1131,6 +1146,47 @@ grep -Fq "canon_event=SET_SPINDLE_SPEED spindle=0 speed=600" "$FRACTIONAL_LINENU
grep -Fq "canon_event=SET_SPINDLE_SPEED spindle=0 speed=1200" "$FRACTIONAL_LINENUMBERS_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$FRACTIONAL_LINENUMBERS_STDOUT"
CAM_NISLEY_BARE_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.cam_nisley_bare.run.stdout.log"
grep -Fq "file_open=0" "$CAM_NISLEY_BARE_STDOUT"
grep -Fq "file_read_count=57" "$CAM_NISLEY_BARE_STDOUT"
grep -Fq "file_execute_count=57" "$CAM_NISLEY_BARE_STDOUT"
grep -Fq "file_saw_error=1" "$CAM_NISLEY_BARE_STDOUT"
grep -Fq "file_error_text=Requested tool 1 not found in the tool table" "$CAM_NISLEY_BARE_STDOUT"
CAM_NISLEY_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.cam_nisley.run.stdout.log"
grep -Fq "file_open=0" "$CAM_NISLEY_STDOUT"
grep -Fq "file_read_count=1584" "$CAM_NISLEY_STDOUT"
grep -Fq "file_execute_count=1584" "$CAM_NISLEY_STDOUT"
grep -Fq "file_saw_error=0" "$CAM_NISLEY_STDOUT"
grep -Fq "error_text=Bad character '%' used" "$CAM_NISLEY_STDOUT"
grep -Fq "canon_event=COMMENT: Ed Nisley - Nov 2006 - Mar 2007" "$CAM_NISLEY_STDOUT"
grep -Fq "canon_event=SELECT_TOOL tool=1" "$CAM_NISLEY_STDOUT"
grep -Fq "canon_event=CHANGE_TOOL" "$CAM_NISLEY_STDOUT"
grep -Fq "canon_event=START_SPINDLE_CLOCKWISE spindle=0" "$CAM_NISLEY_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation on right" "$CAM_NISLEY_STDOUT"
grep -Fq "canon_event=ARC_FEED line=223 first_end=1.91351e-18 second_end=-15.1438" "$CAM_NISLEY_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=241 x=75 y=0 z=75" "$CAM_NISLEY_STDOUT"
grep -Fq "canon_event=MESSAGE: Done!" "$CAM_NISLEY_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$CAM_NISLEY_STDOUT"
if grep -Fq "file_error_text=Requested tool 1 not found in the tool table" "$CAM_NISLEY_STDOUT"; then
echo "cam-nisley with upstream tool table unexpectedly failed tool lookup" >&2
exit 1
fi
CRAZY_PATHS_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.crazy_paths.run.stdout.log"
grep -Fq "file_open=0" "$CRAZY_PATHS_STDOUT"
grep -Fq "file_read_count=1526" "$CRAZY_PATHS_STDOUT"
grep -Fq "file_execute_count=1526" "$CRAZY_PATHS_STDOUT"
grep -Fq "file_saw_error=0" "$CRAZY_PATHS_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation on right" "$CRAZY_PATHS_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation on left" "$CRAZY_PATHS_STDOUT"
grep -Fq "canon_event=ARC_FEED line=8 first_end=-99.2047 second_end=-102.892 first_axis=-98.9043 second_axis=-102.097 rotation=-1 axis_end_point=0" "$CRAZY_PATHS_STDOUT"
grep -Fq "canon_event=ARC_FEED line=103 first_end=-40.3437 second_end=-103.278 first_axis=-45.0196 second_axis=-102.442 rotation=-1 axis_end_point=0" "$CRAZY_PATHS_STDOUT"
grep -Fq "canon_event=STRAIGHT_FEED line=260 x=3.58919 y=30.3694 z=0" "$CRAZY_PATHS_STDOUT"
grep -Fq "canon_event=ARC_FEED line=445 first_end=101.539 second_end=44.5843 first_axis=100.896 second_axis=46.212 rotation=1 axis_end_point=0" "$CRAZY_PATHS_STDOUT"
grep -Fq "canon_event=STRAIGHT_FEED line=469 x=98.8154 y=102.176 z=0" "$CRAZY_PATHS_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$CRAZY_PATHS_STDOUT"
NAMEDPARAM_BUG424_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.namedparam_bug424.run.stdout.log"
grep -Fq "file_open=0" "$NAMEDPARAM_BUG424_STDOUT"
grep -Fq "file_read_count=6" "$NAMEDPARAM_BUG424_STDOUT"
@@ -1158,6 +1214,68 @@ grep -Fq "setup.current_x=0.25" "$FLOWSNAKE_STDOUT"
grep -Fq "setup.current_y=1" "$FLOWSNAKE_STDOUT"
grep -Fq "setup.current_z=1" "$FLOWSNAKE_STDOUT"
INSIDE_CORNERS_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.inside_corners.run.stdout.log"
grep -Fq "file_open=0" "$INSIDE_CORNERS_STDOUT"
grep -Fq "file_read_count=397" "$INSIDE_CORNERS_STDOUT"
grep -Fq "file_execute_count=397" "$INSIDE_CORNERS_STDOUT"
grep -Fq "file_saw_error=0" "$INSIDE_CORNERS_STDOUT"
grep -Fq "canon_event=PROGRAM_STOP" "$INSIDE_CORNERS_STDOUT"
grep -Fq "canon_event=DWELL seconds=3" "$INSIDE_CORNERS_STDOUT"
grep -Fq "canon_event=SELECT_PLANE plane=1" "$INSIDE_CORNERS_STDOUT"
grep -Fq "canon_event=SELECT_PLANE plane=3" "$INSIDE_CORNERS_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation on left" "$INSIDE_CORNERS_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation on right" "$INSIDE_CORNERS_STDOUT"
grep -Fq "canon_event=ARC_FEED line=16 first_end=1.2281 second_end=1.3456 first_axis=0.628 second_axis=1.0458 rotation=1 axis_end_point=-0.1" "$INSIDE_CORNERS_STDOUT"
grep -Fq "canon_event=STRAIGHT_FEED line=14 x=0.701154 y=0.162499 z=-0.1" "$INSIDE_CORNERS_STDOUT"
grep -Fq "canon_event=ARC_FEED line=74 first_end=0.298564 second_end=1.82077 first_axis=0.3459 second_axis=1.7626 rotation=1 axis_end_point=0" "$INSIDE_CORNERS_STDOUT"
grep -Fq "canon_event=STRAIGHT_FEED line=107 x=0 y=0 z=1" "$INSIDE_CORNERS_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$INSIDE_CORNERS_STDOUT"
CCOMP_LATHE_COMP_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.ccomp_lathe_comp.run.stdout.log"
grep -Fq "file_open=0" "$CCOMP_LATHE_COMP_STDOUT"
grep -Fq "file_read_count=49" "$CCOMP_LATHE_COMP_STDOUT"
grep -Fq "file_execute_count=49" "$CCOMP_LATHE_COMP_STDOUT"
grep -Fq "file_saw_error=0" "$CCOMP_LATHE_COMP_STDOUT"
grep -Fq "canon_event=SELECT_PLANE plane=3" "$CCOMP_LATHE_COMP_STDOUT"
grep -Fq "canon_event=SELECT_TOOL tool=2" "$CCOMP_LATHE_COMP_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation on left" "$CCOMP_LATHE_COMP_STDOUT"
grep -Fq "canon_event=SELECT_TOOL tool=7" "$CCOMP_LATHE_COMP_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation on right" "$CCOMP_LATHE_COMP_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$CCOMP_LATHE_COMP_STDOUT"
CCOMP_MILL_G90G91G92_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.ccomp_mill_g90g91g92.run.stdout.log"
grep -Fq "file_open=0" "$CCOMP_MILL_G90G91G92_STDOUT"
grep -Fq "file_read_count=28" "$CCOMP_MILL_G90G91G92_STDOUT"
grep -Fq "file_execute_count=28" "$CCOMP_MILL_G90G91G92_STDOUT"
grep -Fq "file_saw_error=0" "$CCOMP_MILL_G90G91G92_STDOUT"
grep -Fq "canon_event=SELECT_TOOL tool=3" "$CCOMP_MILL_G90G91G92_STDOUT"
grep -Fq "canon_event=SET_G92_OFFSET x=0 y=0 z=0.5" "$CCOMP_MILL_G90G91G92_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation on left" "$CCOMP_MILL_G90G91G92_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation off" "$CCOMP_MILL_G90G91G92_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$CCOMP_MILL_G90G91G92_STDOUT"
CCOMP_MILL_LINE_ARC_ENTRY_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.ccomp_mill_line_arc_entry.run.stdout.log"
grep -Fq "file_open=0" "$CCOMP_MILL_LINE_ARC_ENTRY_STDOUT"
grep -Fq "file_read_count=33" "$CCOMP_MILL_LINE_ARC_ENTRY_STDOUT"
grep -Fq "file_execute_count=33" "$CCOMP_MILL_LINE_ARC_ENTRY_STDOUT"
grep -Fq "file_saw_error=0" "$CCOMP_MILL_LINE_ARC_ENTRY_STDOUT"
grep -Fq "canon_event=SELECT_TOOL tool=4" "$CCOMP_MILL_LINE_ARC_ENTRY_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation on left" "$CCOMP_MILL_LINE_ARC_ENTRY_STDOUT"
grep -Fq "canon_event=ARC_FEED line=23 first_end=2 second_end=3.01969" "$CCOMP_MILL_LINE_ARC_ENTRY_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation off" "$CCOMP_MILL_LINE_ARC_ENTRY_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$CCOMP_MILL_LINE_ARC_ENTRY_STDOUT"
CCOMP_MILL_ZCHANGES_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.ccomp_mill_zchanges.run.stdout.log"
grep -Fq "file_open=0" "$CCOMP_MILL_ZCHANGES_STDOUT"
grep -Fq "file_read_count=81" "$CCOMP_MILL_ZCHANGES_STDOUT"
grep -Fq "file_execute_count=81" "$CCOMP_MILL_ZCHANGES_STDOUT"
grep -Fq "file_saw_error=0" "$CCOMP_MILL_ZCHANGES_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation on left" "$CCOMP_MILL_ZCHANGES_STDOUT"
grep -Fq "canon_event=ARC_FEED line=15 first_end=0.5 second_end=0.752461" "$CCOMP_MILL_ZCHANGES_STDOUT"
grep -Fq "canon_event=STRAIGHT_FEED line=54 x=0.49826 y=-0.24826 z=0" "$CCOMP_MILL_ZCHANGES_STDOUT"
grep -Fq "canon_event=COMMENT: interpreter: cutter radius compensation off" "$CCOMP_MILL_ZCHANGES_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$CCOMP_MILL_ZCHANGES_STDOUT"
check_bad_file_fixture() {
local name="$1"
local read_count="$2"
@@ -1173,6 +1291,10 @@ check_bad_file_fixture() {
grep -Fq "canon_event=ON_RESET" "$stdout_file"
}
check_bad_file_fixture bad_a_in_canned_cycle 3 2 "Cannot put an a in canned cycle"
check_bad_file_fixture bad_a_in_canned_cycle2 2 1 "Cannot put an a in canned cycle"
check_bad_file_fixture bad_ccomp_arcexit 7 7 "The move just after exiting cutter compensation mode must be straight, not an arc"
check_bad_file_fixture bad_ccomp_gouging 7 7 "Straight feed in concave corner cannot be reached by the tool without gouging"
check_bad_file_fixture bad_exists_1 2 1 "Expected # reading parameter"
check_bad_file_fixture bad_exists_2 2 1 "Expected ] reading bracketed parameter"
check_bad_file_fixture bad_exists_3 3 2 "Parameter number out of range"
@@ -1394,6 +1516,101 @@ grep -Fq "Q MAIN/FANUC: POST-M98: 1=13.010000; 30=13.300000; 31=13.310000" "$M
grep -Fq "Q MAIN/RS274NGC: POST-O-CALL: 1=42.010000; 30=42.300000; 31=13.310000" "$M98M99_02_VARIABLES_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_02_VARIABLES_STDOUT"
M98M99_03_ERROR_M98_NO_P_WORD_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_03_error_m98_no_p_word.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_03_ERROR_M98_NO_P_WORD_STDOUT"
grep -Fq "file_read_count=3" "$M98M99_03_ERROR_M98_NO_P_WORD_STDOUT"
grep -Fq "file_execute_count=2" "$M98M99_03_ERROR_M98_NO_P_WORD_STDOUT"
grep -Fq "file_saw_error=1" "$M98M99_03_ERROR_M98_NO_P_WORD_STDOUT"
grep -Fq "file_error_text=Found 'm98' code with no P-word" \
"$M98M99_03_ERROR_M98_NO_P_WORD_STDOUT"
grep -Fq "run_step phase=read step=3 rc=5 line=4" "$M98M99_03_ERROR_M98_NO_P_WORD_STDOUT"
grep -Fq "statement_uri=M98" "$M98M99_03_ERROR_M98_NO_P_WORD_STDOUT"
grep -Fq "canon_event=COMMENT: Fanuc M98 requires P-word " \
"$M98M99_03_ERROR_M98_NO_P_WORD_STDOUT"
M98M99_04_M98_BUT_NO_SUB_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_04_m98_but_no_sub.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_04_M98_BUT_NO_SUB_STDOUT"
grep -Fq "file_read_count=5" "$M98M99_04_M98_BUT_NO_SUB_STDOUT"
grep -Fq "file_execute_count=4" "$M98M99_04_M98_BUT_NO_SUB_STDOUT"
grep -Fq "file_saw_error=1" "$M98M99_04_M98_BUT_NO_SUB_STDOUT"
grep -Fq "file_error_text=Failed to find sub 'O1' before EOF" \
"$M98M99_04_M98_BUT_NO_SUB_STDOUT"
grep -Fq "run_step phase=read step=5 rc=5 line=4" "$M98M99_04_M98_BUT_NO_SUB_STDOUT"
grep -Fq "statement_uri=%25" "$M98M99_04_M98_BUT_NO_SUB_STDOUT"
grep -Fq "canon_event=COMMENT: M98 call non-existant sub " \
"$M98M99_04_M98_BUT_NO_SUB_STDOUT"
M98M99_05_M98_LOOPS_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_05_m98_loops.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_05_M98_LOOPS_STDOUT"
grep -Fq "file_read_count=102" "$M98M99_05_M98_LOOPS_STDOUT"
grep -Fq "file_execute_count=102" "$M98M99_05_M98_LOOPS_STDOUT"
grep -Fq "file_saw_error=0" "$M98M99_05_M98_LOOPS_STDOUT"
grep -Fq "X MAIN 10LOOP PARAM1 = 10.000000" "$M98M99_05_M98_LOOPS_STDOUT"
grep -Fq "X MAIN 0LOOP PARAM1 = 0.000000" "$M98M99_05_M98_LOOPS_STDOUT"
grep -Fq "X MAIN 2LOOP PARAM1 = 2.000000" "$M98M99_05_M98_LOOPS_STDOUT"
grep -Fq "X SUB O1 PARAM1 = 10.000000" "$M98M99_05_M98_LOOPS_STDOUT"
grep -Fq "canon_event=COMMENT: A simple O sub example " "$M98M99_05_M98_LOOPS_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_05_M98_LOOPS_STDOUT"
if ! awk '
/statement_uri=M98%20P1%20L0/ { in_l0 = 1; saw_sub = 0; next }
in_l0 && /X SUB O1 PARAM1/ { saw_sub = 1 }
in_l0 && /X MAIN 0LOOP PARAM1 = 0\.000000/ && !saw_sub { found = 1; in_l0 = 0 }
END { exit(found ? 0 : 1) }
' "$M98M99_05_M98_LOOPS_STDOUT"; then
echo "unexpected m98m99 M98 L0 loop execution" >&2
exit 1
fi
M98M99_06_CALLED_WITH_O_CALL_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_06_called_with_o_call.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_06_CALLED_WITH_O_CALL_STDOUT"
grep -Fq "file_read_count=5" "$M98M99_06_CALLED_WITH_O_CALL_STDOUT"
grep -Fq "file_execute_count=5" "$M98M99_06_CALLED_WITH_O_CALL_STDOUT"
grep -Fq "file_saw_error=1" "$M98M99_06_CALLED_WITH_O_CALL_STDOUT"
grep -Fq "file_error_text=Fanuc 'O....' subroutine must be called with 'M98'" \
"$M98M99_06_CALLED_WITH_O_CALL_STDOUT"
grep -Fq "run_step phase=execute step=5 rc=5 line=4" "$M98M99_06_CALLED_WITH_O_CALL_STDOUT"
grep -Fq "statement_uri=O1" "$M98M99_06_CALLED_WITH_O_CALL_STDOUT"
grep -Fq "canon_event=COMMENT: Fanuc 'O...' sub must be called with M98 " \
"$M98M99_06_CALLED_WITH_O_CALL_STDOUT"
M98M99_06_ENDED_WITH_O_ENDSUB_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_06_ended_with_o_endsub.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_06_ENDED_WITH_O_ENDSUB_STDOUT"
grep -Fq "file_read_count=7" "$M98M99_06_ENDED_WITH_O_ENDSUB_STDOUT"
grep -Fq "file_execute_count=7" "$M98M99_06_ENDED_WITH_O_ENDSUB_STDOUT"
grep -Fq "file_saw_error=1" "$M98M99_06_ENDED_WITH_O_ENDSUB_STDOUT"
grep -Fq "file_error_text=Fanuc 'O....' subroutine definition must end with 'M99'" \
"$M98M99_06_ENDED_WITH_O_ENDSUB_STDOUT"
grep -Fq "run_step phase=execute step=7 rc=5 line=4" "$M98M99_06_ENDED_WITH_O_ENDSUB_STDOUT"
grep -Fq "statement_uri=O1%20endsub" "$M98M99_06_ENDED_WITH_O_ENDSUB_STDOUT"
grep -Fq "X FANUC" "$M98M99_06_ENDED_WITH_O_ENDSUB_STDOUT"
grep -Fq "canon_event=COMMENT: Fanuc 'O...' sub must end with M99 " \
"$M98M99_06_ENDED_WITH_O_ENDSUB_STDOUT"
M98M99_06_SUB_CALLED_WITH_M98_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_06_sub_called_with_m98.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_06_SUB_CALLED_WITH_M98_STDOUT"
grep -Fq "file_read_count=5" "$M98M99_06_SUB_CALLED_WITH_M98_STDOUT"
grep -Fq "file_execute_count=5" "$M98M99_06_SUB_CALLED_WITH_M98_STDOUT"
grep -Fq "file_saw_error=1" "$M98M99_06_SUB_CALLED_WITH_M98_STDOUT"
grep -Fq "file_error_text='O.... sub' subroutine must be called with 'O.... call'" \
"$M98M99_06_SUB_CALLED_WITH_M98_STDOUT"
grep -Fq "run_step phase=execute step=5 rc=5 line=4" "$M98M99_06_SUB_CALLED_WITH_M98_STDOUT"
grep -Fq "statement_uri=O1%20sub" "$M98M99_06_SUB_CALLED_WITH_M98_STDOUT"
grep -Fq "canon_event=COMMENT: RS274NGC 'O...' sub must not be called with M98 " \
"$M98M99_06_SUB_CALLED_WITH_M98_STDOUT"
M98M99_06_SUB_ENDED_WITH_M99_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_06_sub_ended_with_m99.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_06_SUB_ENDED_WITH_M99_STDOUT"
grep -Fq "file_read_count=7" "$M98M99_06_SUB_ENDED_WITH_M99_STDOUT"
grep -Fq "file_execute_count=7" "$M98M99_06_SUB_ENDED_WITH_M99_STDOUT"
grep -Fq "file_saw_error=1" "$M98M99_06_SUB_ENDED_WITH_M99_STDOUT"
grep -Fq "file_error_text='O.... endsub' or 'O.... return' must follow 'O.... sub' subroutine definition" \
"$M98M99_06_SUB_ENDED_WITH_M99_STDOUT"
grep -Fq "run_step phase=execute step=7 rc=5 line=4" "$M98M99_06_SUB_ENDED_WITH_M99_STDOUT"
grep -Fq "statement_uri=M99" "$M98M99_06_SUB_ENDED_WITH_M99_STDOUT"
grep -Fq "X FANUC" "$M98M99_06_SUB_ENDED_WITH_M99_STDOUT"
grep -Fq "canon_event=COMMENT: RS274NGC 'O... sub' sub must not end with M99 " \
"$M98M99_06_SUB_ENDED_WITH_M99_STDOUT"
M98M99_07_NESTED_SUBS_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_07_nested_subs.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_07_NESTED_SUBS_STDOUT"
grep -Fq "file_read_count=163" "$M98M99_07_NESTED_SUBS_STDOUT"
@@ -1412,6 +1629,65 @@ grep -Fq "X IN O1" "$M98M99_08_SUB_FOLLOWS_MAIN_STDOUT"
grep -Fq "canon_event=COMMENT: Fanuc-style subs may follow main program " "$M98M99_08_SUB_FOLLOWS_MAIN_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_08_SUB_FOLLOWS_MAIN_STDOUT"
check_m98m99_09_fanuc_pass() {
local stdout_file="$1"
grep -Fq "file_open=0" "$stdout_file"
grep -Fq "file_read_count=22" "$stdout_file"
grep -Fq "file_execute_count=22" "$stdout_file"
grep -Fq "file_saw_error=0" "$stdout_file"
grep -Fq "canon_event=COMMENT: A simple O sub example " "$stdout_file"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=10 x=3 y=0 z=0.25" "$stdout_file"
grep -Fq "canon_event=STRAIGHT_FEED line=11 x=3 y=0 z=-1" "$stdout_file"
grep -Fq "canon_event=PROGRAM_END" "$stdout_file"
if grep -Fq "file_error_text=DISABLE_FANUC_STYLE_SUB" "$stdout_file"; then
echo "unexpected disabled Fanuc sub error in $stdout_file" >&2
exit 1
fi
}
check_m98m99_09_rs274ngc_pass() {
local stdout_file="$1"
grep -Fq "file_open=0" "$stdout_file"
grep -Fq "file_read_count=15" "$stdout_file"
grep -Fq "file_execute_count=15" "$stdout_file"
grep -Fq "file_saw_error=0" "$stdout_file"
grep -Fq "canon_event=COMMENT: A simple O sub example " "$stdout_file"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=5 x=1 y=0 z=0.25" "$stdout_file"
grep -Fq "canon_event=STRAIGHT_FEED line=6 x=1 y=0 z=-1" "$stdout_file"
grep -Fq "canon_event=PROGRAM_END" "$stdout_file"
if grep -Fq "file_error_text=DISABLE_FANUC_STYLE_SUB" "$stdout_file"; then
echo "unexpected disabled Fanuc sub error in $stdout_file" >&2
exit 1
fi
}
check_m98m99_09_fanuc_pass \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_09_fanuc_ini.run.stdout.log"
check_m98m99_09_rs274ngc_pass \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_09_rs274ngc_ini.run.stdout.log"
check_m98m99_09_rs274ngc_pass \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_09_rs274ngc_no_fanuc.run.stdout.log"
check_m98m99_09_fanuc_pass \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_09_fanuc_default.run.stdout.log"
check_m98m99_09_rs274ngc_pass \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_09_rs274ngc_default.run.stdout.log"
M98M99_09_FANUC_NO_FANUC_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_09_fanuc_no_fanuc.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_09_FANUC_NO_FANUC_STDOUT"
grep -Fq "file_read_count=5" "$M98M99_09_FANUC_NO_FANUC_STDOUT"
grep -Fq "file_execute_count=4" "$M98M99_09_FANUC_NO_FANUC_STDOUT"
grep -Fq "file_saw_error=1" "$M98M99_09_FANUC_NO_FANUC_STDOUT"
grep -Fq "file_error_text=DISABLE_FANUC_STYLE_SUB set in INI file, but found m98" \
"$M98M99_09_FANUC_NO_FANUC_STDOUT"
grep -Fq "run_step phase=read step=5 rc=5 line=6" "$M98M99_09_FANUC_NO_FANUC_STDOUT"
grep -Fq "statement_uri=M98%20P1%20L3" "$M98M99_09_FANUC_NO_FANUC_STDOUT"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=5 x=0 y=0 z=0.25" \
"$M98M99_09_FANUC_NO_FANUC_STDOUT"
if grep -Fq "canon_event=PROGRAM_END" "$M98M99_09_FANUC_NO_FANUC_STDOUT"; then
echo "unexpected m98m99 disabled Fanuc sub program end" >&2
exit 1
fi
M98M99_10_M98_P001_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_10_m98_p001.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_10_M98_P001_STDOUT"
grep -Fq "file_read_count=8" "$M98M99_10_M98_P001_STDOUT"
@@ -1429,6 +1705,74 @@ if awk '
exit 1
fi
check_m98m99_11_legal() {
local stdout_file="$1"
local read_count="$2"
local first_line="$3"
local sub_line="$4"
grep -Fq "file_open=0" "$stdout_file"
grep -Fq "file_read_count=$read_count" "$stdout_file"
grep -Fq "file_execute_count=$read_count" "$stdout_file"
grep -Fq "file_saw_error=0" "$stdout_file"
grep -Fq "canon_event=COMMENT: legal example" "$stdout_file"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=$first_line x=1 y=2 z=0" "$stdout_file"
grep -Fq "canon_event=STRAIGHT_TRAVERSE line=$sub_line x=1 y=2 z=3" "$stdout_file"
if grep -Fq "should never get here" "$stdout_file"; then
echo "unexpected m98m99 main-program fallthrough in $stdout_file" >&2
exit 1
fi
}
check_m98m99_11_legal \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_11_legal_m2.run.stdout.log" \
17 4 13
grep -Fq "canon_event=PROGRAM_END" \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_11_legal_m2.run.stdout.log"
check_m98m99_11_legal \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_11_legal_m02.run.stdout.log" \
17 4 13
grep -Fq "canon_event=PROGRAM_END" \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_11_legal_m02.run.stdout.log"
check_m98m99_11_legal \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_11_legal_m30.run.stdout.log" \
17 4 13
grep -Fq "canon_event=PROGRAM_END" \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_11_legal_m30.run.stdout.log"
check_m98m99_11_legal \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_11_legal_percent.run.stdout.log" \
20 11 6
grep -Fq "canon_event=FINISH" \
"$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_11_legal_percent.run.stdout.log"
M98M99_11_ILLEGAL_EOF_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_11_illegal_eof.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_11_ILLEGAL_EOF_STDOUT"
grep -Fq "file_read_count=21" "$M98M99_11_ILLEGAL_EOF_STDOUT"
grep -Fq "file_execute_count=20" "$M98M99_11_ILLEGAL_EOF_STDOUT"
grep -Fq "file_saw_error=1" "$M98M99_11_ILLEGAL_EOF_STDOUT"
grep -Fq "file_error_text=File ended with no percent sign (%) or program end (M2)" \
"$M98M99_11_ILLEGAL_EOF_STDOUT"
grep -Fq "canon_event=COMMENT: end of main signaled by EOF" \
"$M98M99_11_ILLEGAL_EOF_STDOUT"
M98M99_11_ILLEGAL_NO_M30_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_11_illegal_no_m30.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_11_ILLEGAL_NO_M30_STDOUT"
grep -Fq "file_read_count=18" "$M98M99_11_ILLEGAL_NO_M30_STDOUT"
grep -Fq "file_execute_count=18" "$M98M99_11_ILLEGAL_NO_M30_STDOUT"
grep -Fq "file_saw_error=1" "$M98M99_11_ILLEGAL_NO_M30_STDOUT"
grep -Fq "sub: o|2| found in illegal location" "$M98M99_11_ILLEGAL_NO_M30_STDOUT"
grep -Fq "statement_uri=O2%20sub%20%28subprogram%20begin%29" \
"$M98M99_11_ILLEGAL_NO_M30_STDOUT"
M98M99_11_ILLEGAL_SUB_AFTER_PERCENT_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_11_illegal_sub_after_percent.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_11_ILLEGAL_SUB_AFTER_PERCENT_STDOUT"
grep -Fq "file_read_count=8" "$M98M99_11_ILLEGAL_SUB_AFTER_PERCENT_STDOUT"
grep -Fq "file_execute_count=7" "$M98M99_11_ILLEGAL_SUB_AFTER_PERCENT_STDOUT"
grep -Fq "file_saw_error=1" "$M98M99_11_ILLEGAL_SUB_AFTER_PERCENT_STDOUT"
grep -Fq "file_error_text=Failed to find sub 'O2' before EOF" \
"$M98M99_11_ILLEGAL_SUB_AFTER_PERCENT_STDOUT"
grep -Fq "canon_event=FINISH" "$M98M99_11_ILLEGAL_SUB_AFTER_PERCENT_STDOUT"
M98M99_13_NAMED_PROGRAM_NAMED_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.m98m99_13_named_program_named.run.stdout.log"
grep -Fq "file_open=0" "$M98M99_13_NAMED_PROGRAM_NAMED_STDOUT"
grep -Fq "file_read_count=4" "$M98M99_13_NAMED_PROGRAM_NAMED_STDOUT"
@@ -1456,6 +1800,93 @@ grep -Fq "In sub 100" "$M98M99_14_O_EXPRESSION_CALL_STDOUT"
grep -Fq "In sub 200" "$M98M99_14_O_EXPRESSION_CALL_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$M98M99_14_O_EXPRESSION_CALL_STDOUT"
G10_L1_L10_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.g10_l1_l10.run.stdout.log"
grep -Fq "file_open=0" "$G10_L1_L10_STDOUT"
grep -Fq "file_read_count=115" "$G10_L1_L10_STDOUT"
grep -Fq "file_execute_count=115" "$G10_L1_L10_STDOUT"
grep -Fq "file_saw_error=0" "$G10_L1_L10_STDOUT"
grep -Fq "canon_event=MESSAGE: G10 L1: set tool offsets direct" "$G10_L1_L10_STDOUT"
grep -Fq "canon_event=MESSAGE: G10 L10: set tool offsets relative to position + 45 deg. rotation" "$G10_L1_L10_STDOUT"
grep -Fq "canon_event=MESSAGE: Model B contract: M6 alone and G10 alone do not change tool offset params" "$G10_L1_L10_STDOUT"
grep -Fq "canon_event=MESSAGE: G10 alone does not apply offset, should still be 0 0 0: 0.000000 0.000000 0.000000" "$G10_L1_L10_STDOUT"
grep -Fq "canon_event=USE_TOOL_LENGTH_OFFSET x=8 y=6 z=7" "$G10_L1_L10_STDOUT"
grep -Fq "canon_event=SET_XY_ROTATION rotation=45" "$G10_L1_L10_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$G10_L1_L10_STDOUT"
G10_L11_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.g10_l11.run.stdout.log"
grep -Fq "file_open=0" "$G10_L11_STDOUT"
grep -Fq "file_read_count=41" "$G10_L11_STDOUT"
grep -Fq "file_execute_count=41" "$G10_L11_STDOUT"
grep -Fq "file_saw_error=0" "$G10_L11_STDOUT"
grep -Fq "canon_event=SET_G5X_OFFSET index=1 x=1 y=2 z=-3" "$G10_L11_STDOUT"
grep -Fq "canon_event=SET_G92_OFFSET x=-41.1962 y=-46.1962 z=-72" "$G10_L11_STDOUT"
grep -Fq "canon_event=USE_TOOL_LENGTH_OFFSET x=0 y=0 z=-4" "$G10_L11_STDOUT"
grep -Fq "canon_event=MESSAGE: -101.600000" "$G10_L11_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$G10_L11_STDOUT"
G10_L2_WHILE_ACTIVE_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.g10_l2_while_active.run.stdout.log"
grep -Fq "file_open=0" "$G10_L2_WHILE_ACTIVE_STDOUT"
grep -Fq "file_read_count=24" "$G10_L2_WHILE_ACTIVE_STDOUT"
grep -Fq "file_execute_count=24" "$G10_L2_WHILE_ACTIVE_STDOUT"
grep -Fq "file_saw_error=0" "$G10_L2_WHILE_ACTIVE_STDOUT"
grep -Fq "canon_event=SET_G5X_OFFSET index=1 x=1 y=0 z=0" "$G10_L2_WHILE_ACTIVE_STDOUT"
grep -Fq "canon_event=SET_XY_ROTATION rotation=-45" "$G10_L2_WHILE_ACTIVE_STDOUT"
grep -Fq "canon_event=MESSAGE: Should be 0 1.414214: 0.000000 1.414214" "$G10_L2_WHILE_ACTIVE_STDOUT"
grep -Fq "canon_event=SET_XY_ROTATION rotation=90" "$G10_L2_WHILE_ACTIVE_STDOUT"
grep -Fq "canon_event=MESSAGE: Should be 1 1: 1.000000 1.000000" "$G10_L2_WHILE_ACTIVE_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$G10_L2_WHILE_ACTIVE_STDOUT"
G10_L20_WHILE_ACTIVE_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.g10_l20_while_active.run.stdout.log"
grep -Fq "file_open=0" "$G10_L20_WHILE_ACTIVE_STDOUT"
grep -Fq "file_read_count=20" "$G10_L20_WHILE_ACTIVE_STDOUT"
grep -Fq "file_execute_count=20" "$G10_L20_WHILE_ACTIVE_STDOUT"
grep -Fq "file_saw_error=0" "$G10_L20_WHILE_ACTIVE_STDOUT"
grep -Fq "canon_event=SET_XY_ROTATION rotation=45" "$G10_L20_WHILE_ACTIVE_STDOUT"
grep -Fq "canon_event=MESSAGE: Should be -1 0: -1.000000 0.000000" "$G10_L20_WHILE_ACTIVE_STDOUT"
grep -Fq "canon_event=MESSAGE: Should be 0 -1: 0.000000 -1.000000" "$G10_L20_WHILE_ACTIVE_STDOUT"
grep -Fq "canon_event=MESSAGE: Should be 1 1: 1.000000 1.000000" "$G10_L20_WHILE_ACTIVE_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$G10_L20_WHILE_ACTIVE_STDOUT"
G10_WITH_G92_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.g10_with_g92.run.stdout.log"
grep -Fq "file_open=0" "$G10_WITH_G92_STDOUT"
grep -Fq "file_read_count=61" "$G10_WITH_G92_STDOUT"
grep -Fq "file_execute_count=61" "$G10_WITH_G92_STDOUT"
grep -Fq "file_saw_error=0" "$G10_WITH_G92_STDOUT"
grep -Fq "canon_event=SET_G5X_OFFSET index=9 x=25 y=26 z=27" "$G10_WITH_G92_STDOUT"
grep -Fq "canon_event=SET_G92_OFFSET x=-0.1 y=-0.2 z=-10.3" "$G10_WITH_G92_STDOUT"
grep -Fq "canon_event=MESSAGE: X0.100000 Y0.200000 Z0.300000" "$G10_WITH_G92_STDOUT"
grep -Fq "canon_event=MESSAGE: X-23.900000 Y-23.800000 Z-23.700000" "$G10_WITH_G92_STDOUT"
grep -Fq "canon_event=SET_G92_OFFSET x=0 y=0 z=0" "$G10_WITH_G92_STDOUT"
grep -Fq "canon_event=MESSAGE: X-24.000000 Y-24.000000 Z-34.000000" "$G10_WITH_G92_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$G10_WITH_G92_STDOUT"
G52_G92_INTERACTION_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.g52_g92_interaction.run.stdout.log"
grep -Fq "file_open=0" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "file_read_count=39" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "file_execute_count=39" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "file_saw_error=0" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "canon_event=COMMENT: G52 and G92 param #5210 setting behavior" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "G92 params: 1.000000 -25.400000 -50.800000" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "G92 params: 0.000000 -25.400000 -50.800000" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "G92 params: 1.000000 50.800000 76.200000" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "G92 params: 1.000000 0.000000 0.000000" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "canon_event=SET_G92_OFFSET x=-1 y=-2 z=0" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "canon_event=SET_G92_OFFSET x=2 y=3 z=0" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "canon_event=PALLET_SHUTTLE" "$G52_G92_INTERACTION_STDOUT"
grep -Fq "canon_event=PROGRAM_END" "$G52_G92_INTERACTION_STDOUT"
G92_PERSISTENCE_ENABLED_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.g92_persistence_enabled.run.stdout.log"
grep -Fq "file_open=0" "$G92_PERSISTENCE_ENABLED_STDOUT"
grep -Fq "file_saw_error=0" "$G92_PERSISTENCE_ENABLED_STDOUT"
grep -Fq "Startup G92 params: 1.000000 1.250000 2.500000 3.750000" "$G92_PERSISTENCE_ENABLED_STDOUT"
grep -Fq "canon_event=SET_G92_OFFSET x=1.25 y=2.5 z=3.75" "$G92_PERSISTENCE_ENABLED_STDOUT"
G92_PERSISTENCE_DISABLED_STDOUT="$BUILD_DIR/linuxcnc_interp_minimal_harness.g92_persistence_disabled.run.stdout.log"
grep -Fq "file_open=0" "$G92_PERSISTENCE_DISABLED_STDOUT"
grep -Fq "file_saw_error=0" "$G92_PERSISTENCE_DISABLED_STDOUT"
grep -Fq "Startup G92 params: 0.000000 0.000000 0.000000 0.000000" "$G92_PERSISTENCE_DISABLED_STDOUT"
grep -Fq "canon_event=SET_G92_OFFSET x=0 y=0 z=0" "$G92_PERSISTENCE_DISABLED_STDOUT"
for fixture in "$GCODE_FIXTURE_DIR"/*.ngc; do
name="$(basename "$fixture" .ngc)"
if [[ "$name" == "disable_fanuc_style_sub_m98" ]]; then