Skip to content

Commit 9867302

Browse files
committed
Use timeout command on Linux to limit test run time.
1 parent 985d6d8 commit 9867302

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

test/run-stp-tests.sh

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,11 +666,33 @@ export LC_MESSAGES
666666
# Start the server; run as foreground daemon in the background...
667667
#
668668

669+
if test "x$VALGRIND" != x; then
670+
# Wrap cupsd with Valgrind
671+
WRAPPER="$VALGRIND"
672+
elif test "x$testtype" = x0; then
673+
# Don't limit run time...
674+
WRAPPER=""
675+
elif test -x /usr/bin/timeout; then
676+
# Limit run time to 5 minutes
677+
echo "Limiting run time to 5 minutes..."
678+
echo ""
679+
680+
WRAPPER="/usr/bin/timeout --foreground 5m"
681+
else
682+
# No timeout command, just try limiting CPU time...
683+
echo "Limiting CPU time to 5 minutes (300 seconds):"
684+
echo " limit -t 300"
685+
echo ""
686+
687+
limit -t 300
688+
WRAPPER=""
689+
fi
690+
669691
echo "Starting scheduler:"
670-
echo " $runcups $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &"
692+
echo " $runcups $WRAPPER ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &"
671693
echo ""
672694

673-
$runcups $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &
695+
$runcups $WRAPPER ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &
674696

675697
cupsd=$!
676698

0 commit comments

Comments
 (0)