Cover modal modes in source link tests

This commit is contained in:
cnc
2026-05-22 17:42:30 +08:00
parent 49c2581292
commit 63ecbb6577
2 changed files with 37 additions and 0 deletions

View File

@@ -103,6 +103,12 @@ CNC_SIM_RS274_VAR="$var_file" \
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_rtcp_controls.ngc \
>/tmp/cnc_sim_linuxcnc_source_rtcp_controls.json
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_feed_modes.ngc \
>/tmp/cnc_sim_linuxcnc_source_feed_modes.json
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_motion_modes.ngc \
>/tmp/cnc_sim_linuxcnc_source_motion_modes.json
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_tool_length.ngc \
>/tmp/cnc_sim_linuxcnc_source_tool_length.json
@@ -163,6 +169,34 @@ rtcp = [event for event in controls if event["type"] == "rtcp-state"]
if [(event["line"], event["tool"], event["feed"]) for event in rtcp] != [(3, 0, 0), (4, 7, 1)]:
raise SystemExit("unexpected source-linked RTCP state sequence")
feed_modes = json.loads(Path("/tmp/cnc_sim_linuxcnc_source_feed_modes.json").read_text())
feed_mode_comments = [
(event["line"], event["reserved"])
for event in feed_modes
if event["type"] == "comment"
]
for expected in [(2, 93), (3, 94), (4, 95)]:
if expected not in feed_mode_comments:
raise SystemExit(f"missing source-linked feed mode comment state {expected!r}")
feed_mode_events = [
(event["line"], event["reserved"])
for event in feed_modes
if event["type"] == "set-feed"
]
for expected in [(3, 0), (4, 0)]:
if expected not in feed_mode_events:
raise SystemExit(f"missing source-linked feed mode event {expected!r}")
motion_modes = json.loads(Path("/tmp/cnc_sim_linuxcnc_source_motion_modes.json").read_text())
motion_mode_states = [
(event["line"], event["reserved"], event["feed"])
for event in motion_modes
if event["type"] == "comment"
]
for expected in [(2, 611, 0), (3, 612, 0), (4, 640, 0.05)]:
if expected not in motion_mode_states:
raise SystemExit(f"missing source-linked motion mode state {expected!r}")
tool_length = json.loads(Path("/tmp/cnc_sim_linuxcnc_source_tool_length.json").read_text())
if not any(
event["type"] == "comment" and
@@ -336,6 +370,8 @@ PY
echo "linuxcnc rs274 source link smoke passed (${#objects[@]} local objects)"
echo "dumped /tmp/cnc_sim_linuxcnc_source_basic_mill.json"
echo "dumped /tmp/cnc_sim_linuxcnc_source_rtcp_controls.json"
echo "dumped /tmp/cnc_sim_linuxcnc_source_feed_modes.json"
echo "dumped /tmp/cnc_sim_linuxcnc_source_motion_modes.json"
echo "dumped /tmp/cnc_sim_linuxcnc_source_tool_length.json"
echo "dumped /tmp/cnc_sim_linuxcnc_source_canned_cycle.json"
echo "dumped /tmp/cnc_sim_linuxcnc_source_canned_cycles_extended.json"