继续按 align-linuxcnc 约束:补 M98 与增量圆弧源码覆盖,测试通过
This commit is contained in:
@@ -178,6 +178,12 @@ CNC_SIM_RS274_VAR="$var_file" \
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/basic_mill.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_basic_mill.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc
|
||||
# convert_distance_mode() updates G90/G91 state, and convert_arc() routes
|
||||
# R-format arcs through src/emc/rs274ngc/interp_find.cc arc-center math.
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/incremental_and_r_arc.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_incremental_and_r_arc.json"
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_block_delete.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_block_delete_off.json"
|
||||
@@ -686,6 +692,12 @@ CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_named_oword_subprogram.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_named_oword_subprogram.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc read_m() marks
|
||||
# Fanuc-style M98/M99 subprogram blocks, and interp_o_word.cc execute_call()
|
||||
# handles L-word repeat counts and return-to-caller position.
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/smoke_subprogram_m98.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_m98_subprogram.json"
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_oword_control_flow.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_oword_control_flow.json"
|
||||
@@ -2169,6 +2181,37 @@ expected_arc_centers = [(5, 5, 0), (7, 15, 0), (9, 25, 0)]
|
||||
if arc_centers != expected_arc_centers:
|
||||
raise SystemExit(f"unexpected source-linked G90.1/G91.1 arc centers: {arc_centers!r}")
|
||||
|
||||
incremental_r_arc = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_incremental_and_r_arc.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 4 and
|
||||
event["start"]["x"] == 0 and
|
||||
event["end"]["x"] == 10
|
||||
for event in incremental_r_arc
|
||||
):
|
||||
raise SystemExit("missing source-linked G91 incremental X feed move")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 5 and
|
||||
event["start"]["y"] == 0 and
|
||||
event["end"]["y"] == 10
|
||||
for event in incremental_r_arc
|
||||
):
|
||||
raise SystemExit("missing source-linked modal incremental Y feed move")
|
||||
if not any(
|
||||
event["type"] == "arc-feed" and
|
||||
event["line"] == 7 and
|
||||
event["start"]["x"] == 10 and
|
||||
event["start"]["y"] == 10 and
|
||||
event["end"]["x"] == 20 and
|
||||
event["end"]["y"] == 10 and
|
||||
event["center"]["x"] == 15 and
|
||||
event["center"]["y"] == 10 and
|
||||
event["arcTurns"] == -1
|
||||
for event in incremental_r_arc
|
||||
):
|
||||
raise SystemExit("missing source-linked absolute R-format clockwise arc")
|
||||
|
||||
polar_coordinates = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_polar_coordinates.json").read_text())
|
||||
polar_linear_events = [
|
||||
event
|
||||
@@ -2326,6 +2369,23 @@ if any(
|
||||
):
|
||||
raise SystemExit("source-linked O-word return should skip remaining subprogram body")
|
||||
|
||||
m98_subprogram = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_m98_subprogram.json").read_text())
|
||||
m98_sub_moves = [
|
||||
(event["line"], event["start"]["x"], event["end"]["x"])
|
||||
for event in m98_subprogram
|
||||
if event["type"] == "linear-feed" and event["line"] == 8
|
||||
]
|
||||
if m98_sub_moves != [(8, 0, 5), (8, 5, 10)]:
|
||||
raise SystemExit(f"unexpected source-linked M98 repeated subprogram moves: {m98_sub_moves!r}")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 5 and
|
||||
event["start"]["x"] == 10 and
|
||||
event["end"]["x"] == 20
|
||||
for event in m98_subprogram
|
||||
):
|
||||
raise SystemExit("missing source-linked M98 return-to-caller motion")
|
||||
|
||||
named_oword = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_named_oword_subprogram.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
@@ -3195,6 +3255,7 @@ PY
|
||||
echo "linuxcnc rs274 source link smoke passed (${#objects[@]} local objects)"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_basic_motion.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_basic_mill.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_incremental_and_r_arc.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_rtcp_controls.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_spindle_direction.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_spindle_modes.json"
|
||||
@@ -3227,6 +3288,7 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_source_comments.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_probe_no_error.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_oword_subprogram.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_named_oword_subprogram.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_m98_subprogram.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_oword_control_flow.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_named_parameter_exists.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_indexed_parameters.json"
|
||||
|
||||
Reference in New Issue
Block a user