Skip to content

Commit 8e23025

Browse files
committed
Use timeout command on Linux to limit test run time.
1 parent 430fc90 commit 8e23025

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

test/run-stp-tests.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Perform the complete set of IPP compliance tests specified in the
44
# CUPS Software Test Plan.
55
#
6-
# Copyright © 2020-2023 by OpenPrinting
6+
# Copyright © 2020-2025 by OpenPrinting
77
# Copyright © 2007-2021 by Apple Inc.
88
# Copyright © 1997-2007 by Easy Software Products, all rights reserved.
99
#
@@ -672,11 +672,33 @@ export LC_MESSAGES
672672
# Start the server; run as foreground daemon in the background...
673673
#
674674

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

679-
$runcups $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &
701+
$runcups $WRAPPER ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &
680702

681703
cupsd=$!
682704

0 commit comments

Comments
 (0)