tests/run.sh: Use the "timeout" command
coreutils provides a timeout command. Use that instead of (badly) inventing our own version of it. This "timeout" command seems to be new. Let's hope everyone has it and think about alternative solutions only when needed. Fixes: https://github.com/awesomeWM/awesome/issues/1075 Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
62d0961994
commit
60ee10cfff
10
tests/run.sh
10
tests/run.sh
|
@ -182,7 +182,8 @@ fi
|
|||
start_awesome() {
|
||||
export DISPLAY="$D"
|
||||
cd $build_dir
|
||||
DISPLAY="$D" "$AWESOME" -c "$RC_FILE" $AWESOME_OPTIONS > $awesome_log 2>&1 &
|
||||
# Kill awesome after $timeout_stale seconds (e.g. for errors during test setup).
|
||||
DISPLAY="$D" timeout $timeout_stale "$AWESOME" -c "$RC_FILE" $AWESOME_OPTIONS > $awesome_log 2>&1 &
|
||||
awesome_pid=$!
|
||||
cd - >/dev/null
|
||||
|
||||
|
@ -209,13 +210,6 @@ for f in $tests; do
|
|||
# Send the test file to awesome.
|
||||
cat $f | DISPLAY=$D "$AWESOME_CLIENT" 2>&1
|
||||
|
||||
# Kill awesome after 1 minute (e.g. with errors during test setup).
|
||||
(sleep $timeout_stale
|
||||
if [ "$(ps -o comm= $awesome_pid)" = "${AWESOME##*/}" ]; then
|
||||
echo "Killing (stale?!) awesome (PID $awesome_pid) after $timeout_stale seconds."
|
||||
kill $awesome_pid
|
||||
fi) &
|
||||
|
||||
# Tail the log and quit, when awesome quits.
|
||||
tail -n 100000 -f --pid $awesome_pid $awesome_log
|
||||
|
||||
|
|
Loading…
Reference in New Issue