Skip to content

Commit

Permalink
Add another G71 endless loop test
Browse files Browse the repository at this point in the history
A stripped down version of the problem in
<LinuxCNC#2844>, code structure is
copied from 'g71-endless-loop'. The test is marked as skipped, since it
does not always terminates correctly.
  • Loading branch information
havardAasen committed Feb 7, 2024
1 parent 0f3bd00 commit 83acada
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/interp/g71-endless-loop2/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_XY_ROTATION(0.0000)
N..... SET_FEED_REFERENCE(CANON_XYZ)
N..... ON_RESET()
N..... COMMENT("interpreter: feed mode set to units per revolution")
N..... SET_FEED_MODE(0, 1)
N..... SET_FEED_RATE(0.0000)
N..... SELECT_PLANE(CANON_PLANE_XZ)
N..... SET_SPINDLE_MODE(0 700.0000)
N..... SET_SPINDLE_SPEED(0, 250.0000)
N..... START_SPINDLE_CLOCKWISE(0)
N..... SET_FEED_RATE(0.2400)
N..... STRAIGHT_TRAVERSE(168.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... STRAIGHT_TRAVERSE(168.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... STRAIGHT_FEED(168.0000, 0.0000, -333.0000, 0.0000, 0.0000, 0.0000)
N..... STRAIGHT_FEED(170.0000, 0.0000, -333.0000, 0.0000, 0.0000, 0.0000)
N..... STRAIGHT_FEED(170.0000, 0.0000, -415.0000, 0.0000, 0.0000, 0.0000)
N..... STRAIGHT_TRAVERSE(300.0000, 0.0000, 10.0000, 0.0000, 0.0000, 0.0000)
N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
N..... SET_XY_ROTATION(0.0000)
N..... SELECT_PLANE(CANON_PLANE_XY)
N..... SET_FEED_MODE(0, 0)
N..... SET_FEED_RATE(0.0000)
N..... STOP_SPINDLE_TURNING(0)
N..... SET_SPINDLE_MODE(0 0.0000)
N..... PALLET_SHUTTLE()
N..... PROGRAM_END()
N..... ON_RESET()
N..... ON_RESET()
12 changes: 12 additions & 0 deletions tests/interp/g71-endless-loop2/g71-endless-loop2.ngc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
G18G95
G96 M3 S250 D700

O2 SUB
Z-333
G1 X170
Z-415
O2 ENDSUB
G71 Q2 X168 Z0 F.24

G0 X300 Z10
M30
Empty file.
25 changes: 25 additions & 0 deletions tests/interp/g71-endless-loop2/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
#
# Demonstrate endless loop when an additinal segment is added in the G71 call.
# This is a subset of a file that was supplied in
# https://github.com/LinuxCNC/linuxcnc/issues/2844 and which worked up to and
# including 2.9.1~pre1. It entered an endless loop after
# https://github.com/LinuxCNC/linuxcnc/pull/2677

rs274 -g g71-endless-loop2.ngc | awk '{$1=""; print}' > result &
pid=$!

# Give it 5 seconds to complete
count=5
while [ 0 -lt $count ] && kill -0 $pid > /dev/null 2>&1 ; do
sleep 1
count=$(($count - 1))
done

if kill -0 $pid > /dev/null 2>&1; then
kill -9 $pid
echo "error: g71-endless-loop2.ngc program seem to be stuck, killing"
exit 1
fi

exit 0
Empty file.

0 comments on commit 83acada

Please sign in to comment.