Commit 0bca7c33 authored by Paul E. McKenney's avatar Paul E. McKenney

torture: Use elapsed time to detect hangs

The kvm-test-1-run.sh currently counts "sleep 1" commands to detect
hangs.  This can fail spectacularly on busy systems, where "sleep 1"
might take far longer than one second to complete.  This commit
therefore changes hang detection to use elapsed time measurements.
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: default avatarJosh Triplett <josh@joshtriplett.org>
parent d0d0606e
...@@ -167,14 +167,18 @@ fi ...@@ -167,14 +167,18 @@ fi
qemu_pid=$! qemu_pid=$!
commandcompleted=0 commandcompleted=0
echo Monitoring qemu job at pid $qemu_pid echo Monitoring qemu job at pid $qemu_pid
for ((i=0;i<$seconds;i++)) while :
do do
kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
if kill -0 $qemu_pid > /dev/null 2>&1 if kill -0 $qemu_pid > /dev/null 2>&1
then then
if test $kruntime -ge $seconds
then
break;
fi
sleep 1 sleep 1
else else
commandcompleted=1 commandcompleted=1
kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
if test $kruntime -lt $seconds if test $kruntime -lt $seconds
then then
echo Completed in $kruntime vs. $seconds >> $resdir/Warnings 2>&1 echo Completed in $kruntime vs. $seconds >> $resdir/Warnings 2>&1
...@@ -194,20 +198,22 @@ done ...@@ -194,20 +198,22 @@ done
if test $commandcompleted -eq 0 if test $commandcompleted -eq 0
then then
echo Grace period for qemu job at pid $qemu_pid echo Grace period for qemu job at pid $qemu_pid
for ((i=0;i<=$grace;i++)) while :
do do
kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
if kill -0 $qemu_pid > /dev/null 2>&1 if kill -0 $qemu_pid > /dev/null 2>&1
then then
sleep 1 :
else else
break break
fi fi
if test $i -eq $grace if test $kruntime -ge $((seconds + grace))
then then
kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }'`
echo "!!! Hang at $kruntime vs. $seconds seconds" >> $resdir/Warnings 2>&1 echo "!!! Hang at $kruntime vs. $seconds seconds" >> $resdir/Warnings 2>&1
kill -KILL $qemu_pid kill -KILL $qemu_pid
break
fi fi
sleep 1
done done
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment