diff options
| author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-03-18 13:34:18 -0400 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-05-14 12:46:18 -0400 |
| commit | 0bca7c33ba7785083f38324cc221dfaa35c1c7cf (patch) | |
| tree | 5e420f26c0271575d896812dbdfb7426acedf609 /tools/testing | |
| parent | d0d0606e2c13ad445a58b9d9547de617429cabf9 (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-x | tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 18 |
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 | |||
| 167 | qemu_pid=$! | 167 | qemu_pid=$! |
| 168 | commandcompleted=0 | 168 | commandcompleted=0 |
| 169 | echo Monitoring qemu job at pid $qemu_pid | 169 | echo Monitoring qemu job at pid $qemu_pid |
| 170 | for ((i=0;i<$seconds;i++)) | 170 | while : |
| 171 | do | 171 | do |
| 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 | |||
| 194 | if test $commandcompleted -eq 0 | 198 | if test $commandcompleted -eq 0 |
| 195 | then | 199 | then |
| 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 |
| 212 | fi | 218 | fi |
| 213 | 219 | ||
