参考所有分组:补 program end source 覆盖,测试通过
This commit is contained in:
@@ -545,6 +545,14 @@ for case in "${tool_number_error_cases[@]}"; do
|
||||
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_program_stops.ngc >"$output_dir/cnc_sim_linuxcnc_program_stops.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc convert_stop()
|
||||
# sends M2 through the reset plus PROGRAM_END branch without the M30-only
|
||||
# PALLET_SHUTTLE call.
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_program_end_m2.ngc >"$output_dir/cnc_sim_linuxcnc_program_end_m2.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_internal.hh defaults
|
||||
# loop_on_main_m99 false; interp_convert.cc convert_stop() then treats
|
||||
# main-program M99 as the same reset plus PROGRAM_END branch.
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_program_end_m99.ngc >"$output_dir/cnc_sim_linuxcnc_program_end_m99.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_check.cc treats exactly
|
||||
# P-1.0 as a missing G4 dwell P word, while interp_convert.cc convert_dwell()
|
||||
# and interp_queue.cc enqueue_DWELL() pass neighboring values through.
|
||||
@@ -1370,6 +1378,26 @@ for expected in [(2, 1), (3, 2), (4, 3), (4, 1), (5, 0)]:
|
||||
if expected not in stop_states:
|
||||
raise SystemExit(f"missing program stop state {expected!r}")
|
||||
|
||||
for output_name, label in [
|
||||
("cnc_sim_linuxcnc_program_end_m2.json", "M2"),
|
||||
("cnc_sim_linuxcnc_program_end_m99.json", "M99"),
|
||||
]:
|
||||
events = load(output_name)
|
||||
line4 = [event for event in events if event["line"] == 4]
|
||||
line4_types = {event["type"] for event in line4}
|
||||
for expected_type in {"set-g5x-offset", "set-xy-rotation", "set-feed", "set-spindle", "program-end"}:
|
||||
if expected_type not in line4_types:
|
||||
raise SystemExit(f"missing native {label} reset event {expected_type}")
|
||||
program_end_states = [
|
||||
event["reserved"]
|
||||
for event in line4
|
||||
if event["type"] == "program-end"
|
||||
]
|
||||
if program_end_states != [0]:
|
||||
raise SystemExit(f"unexpected native {label} program-end states: {program_end_states!r}")
|
||||
if any(event["type"] == "program-end" and event["reserved"] == 3 for event in line4):
|
||||
raise SystemExit(f"unexpected native {label} pallet shuttle event")
|
||||
|
||||
g4_boundaries = load("cnc_sim_linuxcnc_g4_dwell_boundaries.json")
|
||||
g4_dwell_states = [
|
||||
(event["line"], event["dwellSeconds"])
|
||||
@@ -2791,6 +2819,8 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_lathe_diameter_g76.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_g76only.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_tool_number.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_program_stops.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_program_end_m2.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_program_end_m99.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_coolant.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_feed_modes.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_motion_modes.json"
|
||||
|
||||
@@ -298,6 +298,18 @@ done
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_program_stops.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_program_stops.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc convert_stop()
|
||||
# sends M2 through the reset plus PROGRAM_END branch without the M30-only
|
||||
# PALLET_SHUTTLE call.
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_program_end_m2.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_program_end_m2.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_internal.hh defaults
|
||||
# loop_on_main_m99 false; interp_convert.cc convert_stop() then treats
|
||||
# main-program M99 as the same reset plus PROGRAM_END branch.
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_program_end_m99.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_program_end_m99.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_check.cc treats exactly
|
||||
# P-1.0 as a missing G4 dwell P word, while interp_convert.cc convert_dwell()
|
||||
# and interp_queue.cc enqueue_DWELL() pass neighboring values through.
|
||||
@@ -1922,6 +1934,26 @@ for expected in [(2, 1), (3, 2), (4, 3), (4, 1), (5, 0)]:
|
||||
if expected not in stop_states:
|
||||
raise SystemExit(f"missing source-linked program stop state {expected!r}")
|
||||
|
||||
for output_name, label in [
|
||||
("cnc_sim_linuxcnc_source_program_end_m2.json", "M2"),
|
||||
("cnc_sim_linuxcnc_source_program_end_m99.json", "M99"),
|
||||
]:
|
||||
events = load(output_name)
|
||||
line4 = [event for event in events if event["line"] == 4]
|
||||
line4_types = {event["type"] for event in line4}
|
||||
for expected_type in {"set-g5x-offset", "set-xy-rotation", "set-feed", "set-spindle", "program-end"}:
|
||||
if expected_type not in line4_types:
|
||||
raise SystemExit(f"missing source-linked {label} reset event {expected_type}")
|
||||
program_end_states = [
|
||||
event["reserved"]
|
||||
for event in line4
|
||||
if event["type"] == "program-end"
|
||||
]
|
||||
if program_end_states != [0]:
|
||||
raise SystemExit(f"unexpected source-linked {label} program-end states: {program_end_states!r}")
|
||||
if any(event["type"] == "program-end" and event["reserved"] == 3 for event in line4):
|
||||
raise SystemExit(f"unexpected source-linked {label} pallet shuttle event")
|
||||
|
||||
g4_boundaries = load("cnc_sim_linuxcnc_source_g4_dwell_boundaries.json")
|
||||
g4_dwell_states = [
|
||||
(event["line"], event["dwellSeconds"])
|
||||
@@ -3497,6 +3529,8 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_source_lathe_diameter_mode.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_lathe_diameter_g76.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_tool_number.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_program_stops.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_program_end_m2.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_program_end_m99.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_coolant.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_feed_modes.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_motion_modes.json"
|
||||
|
||||
5
tests/gcode/linuxcnc_program_end_m2.ngc
Normal file
5
tests/gcode/linuxcnc_program_end_m2.ngc
Normal file
@@ -0,0 +1,5 @@
|
||||
G21 G90 G17
|
||||
(Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc convert_stop handles M2 in the reset plus PROGRAM_END branch.)
|
||||
(Unlike M30 in the same branch, M2 does not call PALLET_SHUTTLE before PROGRAM_END.)
|
||||
M2
|
||||
M30
|
||||
5
tests/gcode/linuxcnc_program_end_m99.ngc
Normal file
5
tests/gcode/linuxcnc_program_end_m99.ngc
Normal file
@@ -0,0 +1,5 @@
|
||||
G21 G90 G17
|
||||
(Source basis: LinuxCNC src/emc/rs274ngc/interp_internal.hh defaults loop_on_main_m99 false.)
|
||||
(Source basis: src/emc/rs274ngc/interp_convert.cc convert_stop treats main-program M99 like M2/M30 when looping is disabled.)
|
||||
M99
|
||||
M30
|
||||
Reference in New Issue
Block a user