Expand LinuxCNC smoke coverage
This commit is contained in:
@@ -43,9 +43,12 @@ CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linux
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_coolant.ngc >/tmp/cnc_sim_linuxcnc_coolant.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_feed_modes.ngc >/tmp/cnc_sim_linuxcnc_feed_modes.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_motion_modes.ngc >/tmp/cnc_sim_linuxcnc_motion_modes.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_tool_length.ngc >/tmp/cnc_sim_linuxcnc_tool_length.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_canned_cycle.ngc >/tmp/cnc_sim_linuxcnc_canned_cycle.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_canned_cycles_extended.ngc >/tmp/cnc_sim_linuxcnc_canned_cycles_extended.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_comments.ngc >/tmp/cnc_sim_linuxcnc_comments.json
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_probe_no_error.ngc >/tmp/cnc_sim_linuxcnc_probe_no_error.json
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/smoke_oword_subprogram.ngc >/tmp/cnc_sim_linuxcnc_oword_subprogram.json
|
||||
cp "$base_var_file" "$var_file"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_coordinate_offsets.ngc >/tmp/cnc_sim_linuxcnc_coordinate_offsets.json
|
||||
cp "$base_var_file" "$var_file"
|
||||
@@ -147,6 +150,24 @@ for expected in [(2, 611, 0), (3, 612, 0), (4, 640, 0.05)]:
|
||||
if expected not in motion_mode_states:
|
||||
raise SystemExit(f"missing motion mode state {expected!r}")
|
||||
|
||||
tool_length = json.loads(Path("/tmp/cnc_sim_linuxcnc_tool_length.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "comment" and
|
||||
event["line"] == 2 and
|
||||
event["reserved"] == 430 and
|
||||
event["start"]["z"] == 0
|
||||
for event in tool_length
|
||||
):
|
||||
raise SystemExit("missing G43 H1 tool length offset event")
|
||||
if not any(
|
||||
event["type"] == "comment" and
|
||||
event["line"] == 3 and
|
||||
event["reserved"] == 430 and
|
||||
event["start"]["z"] == 0
|
||||
for event in tool_length
|
||||
):
|
||||
raise SystemExit("missing G49 tool length clear event")
|
||||
|
||||
cycle = json.loads(Path("/tmp/cnc_sim_linuxcnc_canned_cycle.json").read_text())
|
||||
motions = [event for event in cycle if event["type"] in {"rapid", "linear-feed"}]
|
||||
expected_cycle = [
|
||||
@@ -160,6 +181,38 @@ actual_cycle = [(event["type"], event["end"]["x"], event["end"]["y"], event["end
|
||||
if actual_cycle != expected_cycle:
|
||||
raise SystemExit(f"unexpected G81/G80 expansion: {actual_cycle!r}")
|
||||
|
||||
extended_cycle = json.loads(Path("/tmp/cnc_sim_linuxcnc_canned_cycles_extended.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 3 and
|
||||
event["end"]["x"] == 10 and
|
||||
event["end"]["z"] == -2
|
||||
for event in extended_cycle
|
||||
):
|
||||
raise SystemExit("missing G82 feed to bottom")
|
||||
if not any(
|
||||
event["type"] == "dwell" and
|
||||
event["line"] == 3 and
|
||||
event["dwellSeconds"] == 0.25
|
||||
for event in extended_cycle
|
||||
):
|
||||
raise SystemExit("missing G82 dwell at bottom")
|
||||
g83_feed_depths = [
|
||||
event["end"]["z"]
|
||||
for event in extended_cycle
|
||||
if event["type"] == "linear-feed" and event["line"] == 4
|
||||
]
|
||||
if g83_feed_depths != [1, 0, -1, -2, -3]:
|
||||
raise SystemExit(f"unexpected G83 peck depths: {g83_feed_depths!r}")
|
||||
if not any(
|
||||
event["type"] == "rapid" and
|
||||
event["line"] == 4 and
|
||||
event["end"]["x"] == 20 and
|
||||
event["end"]["z"] == 2
|
||||
for event in extended_cycle
|
||||
):
|
||||
raise SystemExit("missing G83 final retract to R plane")
|
||||
|
||||
comments = json.loads(Path("/tmp/cnc_sim_linuxcnc_comments.json").read_text())
|
||||
if not any(event["type"] == "comment" and event["line"] == 2 for event in comments):
|
||||
raise SystemExit("missing LinuxCNC comment line event")
|
||||
@@ -177,6 +230,31 @@ if not any(
|
||||
if any(event["type"] == "linear-feed" and event["line"] == 4 for event in probe):
|
||||
raise SystemExit("G38.3 probe should not be emitted as linear-feed")
|
||||
|
||||
oword = json.loads(Path("/tmp/cnc_sim_linuxcnc_oword_subprogram.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 8 and
|
||||
event["start"]["x"] == 0 and
|
||||
event["end"]["x"] == 7
|
||||
for event in oword
|
||||
):
|
||||
raise SystemExit("missing LinuxCNC O-word expression motion")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 9 and
|
||||
event["start"]["y"] == 0 and
|
||||
event["end"]["y"] == 2
|
||||
for event in oword
|
||||
):
|
||||
raise SystemExit("missing LinuxCNC O-word #2 argument motion")
|
||||
if any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 11 and
|
||||
event["end"]["x"] == 99
|
||||
for event in oword
|
||||
):
|
||||
raise SystemExit("LinuxCNC O-word return should skip remaining subprogram body")
|
||||
|
||||
coords = json.loads(Path("/tmp/cnc_sim_linuxcnc_coordinate_offsets.json").read_text())
|
||||
g5x = [event for event in coords if event["type"] == "set-g5x-offset"]
|
||||
g92 = [event for event in coords if event["type"] == "set-g92-offset"]
|
||||
@@ -228,8 +306,11 @@ echo "dumped /tmp/cnc_sim_linuxcnc_program_stops.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_coolant.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_feed_modes.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_motion_modes.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_tool_length.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_canned_cycle.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_canned_cycles_extended.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_comments.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_probe_no_error.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_oword_subprogram.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_coordinate_offsets.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_coordinate_l20.json"
|
||||
|
||||
Reference in New Issue
Block a user