Cover coordinate offsets in source link tests
This commit is contained in:
@@ -93,7 +93,9 @@ done
|
||||
-o "$build_dir/linuxcnc_rs274_source_dump"
|
||||
|
||||
var_file="$build_dir/rs274ngc-source.var"
|
||||
cp "$linuxcnc_root/tests/halui/jogging/sim.var" "$var_file"
|
||||
base_var_file="$build_dir/rs274ngc-source-base.var"
|
||||
cp "$linuxcnc_root/tests/halui/jogging/sim.var" "$base_var_file"
|
||||
cp "$base_var_file" "$var_file"
|
||||
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/basic_mill.ngc \
|
||||
@@ -116,6 +118,14 @@ 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/smoke_oword_subprogram.ngc \
|
||||
>/tmp/cnc_sim_linuxcnc_source_oword_subprogram.json
|
||||
cp "$base_var_file" "$var_file"
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_coordinate_offsets.ngc \
|
||||
>/tmp/cnc_sim_linuxcnc_source_coordinate_offsets.json
|
||||
cp "$base_var_file" "$var_file"
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_coordinate_l20.ngc \
|
||||
>/tmp/cnc_sim_linuxcnc_source_coordinate_l20.json
|
||||
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
@@ -265,6 +275,46 @@ if any(
|
||||
for event in oword
|
||||
):
|
||||
raise SystemExit("source-linked O-word return should skip remaining subprogram body")
|
||||
|
||||
coords = json.loads(Path("/tmp/cnc_sim_linuxcnc_source_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"]
|
||||
rot = [event for event in coords if event["type"] == "set-xy-rotation"]
|
||||
if not any(
|
||||
event["line"] == 2 and
|
||||
event["tool"] == 1 and
|
||||
event["start"]["x"] == 12.5 and
|
||||
event["start"]["y"] == -3 and
|
||||
event["start"]["z"] == 4
|
||||
for event in g5x
|
||||
):
|
||||
raise SystemExit("missing source-linked G10 L2 G5X offset event")
|
||||
if not any(event["feed"] == 30 for event in rot):
|
||||
raise SystemExit("missing source-linked G10 L2 XY rotation event")
|
||||
if not any(
|
||||
event["line"] == 4 and
|
||||
event["start"]["x"] == 0 and
|
||||
event["start"]["y"] == 0 and
|
||||
event["start"]["z"] == 0
|
||||
for event in g92
|
||||
):
|
||||
raise SystemExit("missing source-linked G92.1 clear offset event")
|
||||
if not any(event["type"] == "program-end" and event["line"] == 5 for event in coords):
|
||||
raise SystemExit("missing source-linked coordinate program end line number")
|
||||
|
||||
l20 = json.loads(Path("/tmp/cnc_sim_linuxcnc_source_coordinate_l20.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "set-g5x-offset" and
|
||||
event["line"] == 4 and
|
||||
event["tool"] == 2 and
|
||||
event["start"]["x"] == 4 and
|
||||
event["start"]["y"] == 4 and
|
||||
event["start"]["z"] == 4
|
||||
for event in l20
|
||||
):
|
||||
raise SystemExit("missing source-linked G10 L20 P2 offset event after G55 selection")
|
||||
if not any(event["type"] == "program-end" and event["line"] == 5 for event in l20):
|
||||
raise SystemExit("missing source-linked G10 L20 program end line number")
|
||||
PY
|
||||
|
||||
echo "linuxcnc rs274 source link smoke passed (${#objects[@]} local objects)"
|
||||
@@ -275,3 +325,5 @@ echo "dumped /tmp/cnc_sim_linuxcnc_source_canned_cycle.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_source_canned_cycles_extended.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_source_cutter_comp.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_source_oword_subprogram.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_source_coordinate_offsets.json"
|
||||
echo "dumped /tmp/cnc_sim_linuxcnc_source_coordinate_l20.json"
|
||||
|
||||
Reference in New Issue
Block a user