aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-03-18 13:34:18 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-05-14 12:46:18 -0400
commit0bca7c33ba7785083f38324cc221dfaa35c1c7cf (patch)
tree5e420f26c0271575d896812dbdfb7426acedf609 /tools/testing
parentd0d0606e2c13ad445a58b9d9547de617429cabf9 (diff)
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: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh18
1 files changed, 12 insertions, 6 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
index 2bfdb48cd920..27e544e29510 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
@@ -167,14 +167,18 @@ fi
167qemu_pid=$! 167qemu_pid=$!
168commandcompleted=0 168commandcompleted=0
169echo Monitoring qemu job at pid $qemu_pid 169echo Monitoring qemu job at pid $qemu_pid
170for ((i=0;i<$seconds;i++)) 170while :
171do 171do
172 kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
172 if kill -0 $qemu_pid > /dev/null 2>&1 173 if kill -0 $qemu_pid > /dev/null 2>&1
173 then 174 then
175 if test $kruntime -ge $seconds
176 then
177 break;
178 fi
174 sleep 1 179 sleep 1
175 else 180 else
176 commandcompleted=1 181 commandcompleted=1
177 kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
178 if test $kruntime -lt $seconds 182 if test $kruntime -lt $seconds
179 then 183 then
180 echo Completed in $kruntime vs. $seconds >> $resdir/Warnings 2>&1 184 echo Completed in $kruntime vs. $seconds >> $resdir/Warnings 2>&1
@@ -194,20 +198,22 @@ done
194if test $commandcompleted -eq 0 198if test $commandcompleted -eq 0
195then 199then
196 echo Grace period for qemu job at pid $qemu_pid 200 echo Grace period for qemu job at pid $qemu_pid
197 for ((i=0;i<=$grace;i++)) 201 while :
198 do 202 do
203 kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
199 if kill -0 $qemu_pid > /dev/null 2>&1 204 if kill -0 $qemu_pid > /dev/null 2>&1
200 then 205 then
201 sleep 1 206 :
202 else 207 else
203 break 208 break
204 fi 209 fi
205 if test $i -eq $grace 210 if test $kruntime -ge $((seconds + grace))
206 then 211 then
207 kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }'`
208 echo "!!! Hang at $kruntime vs. $seconds seconds" >> $resdir/Warnings 2>&1 212 echo "!!! Hang at $kruntime vs. $seconds seconds" >> $resdir/Warnings 2>&1
209 kill -KILL $qemu_pid 213 kill -KILL $qemu_pid
214 break
210 fi 215 fi
216 sleep 1
211 done 217 done
212fi 218fi
213 219