aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh')
-rwxr-xr-xtools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh47
1 files changed, 33 insertions, 14 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 94b28bb37d36..27e544e29510 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
@@ -94,9 +94,17 @@ fi
94# CONFIG_YENTA=n 94# CONFIG_YENTA=n
95if kvm-build.sh $config_template $builddir $T 95if kvm-build.sh $config_template $builddir $T
96then 96then
97 QEMU="`identify_qemu $builddir/vmlinux`"
98 BOOT_IMAGE="`identify_boot_image $QEMU`"
97 cp $builddir/Make*.out $resdir 99 cp $builddir/Make*.out $resdir
98 cp $builddir/.config $resdir 100 cp $builddir/.config $resdir
99 cp $builddir/arch/x86/boot/bzImage $resdir 101 if test -n "$BOOT_IMAGE"
102 then
103 cp $builddir/$BOOT_IMAGE $resdir
104 else
105 echo No identifiable boot image, not running KVM, see $resdir.
106 echo Do the torture scripts know about your architecture?
107 fi
100 parse-build.sh $resdir/Make.out $title 108 parse-build.sh $resdir/Make.out $title
101 if test -f $builddir.wait 109 if test -f $builddir.wait
102 then 110 then
@@ -104,6 +112,7 @@ then
104 fi 112 fi
105else 113else
106 cp $builddir/Make*.out $resdir 114 cp $builddir/Make*.out $resdir
115 cp $builddir/.config $resdir || :
107 echo Build failed, not running KVM, see $resdir. 116 echo Build failed, not running KVM, see $resdir.
108 if test -f $builddir.wait 117 if test -f $builddir.wait
109 then 118 then
@@ -124,9 +133,6 @@ cd $KVM
124kstarttime=`awk 'BEGIN { print systime() }' < /dev/null` 133kstarttime=`awk 'BEGIN { print systime() }' < /dev/null`
125echo ' ---' `date`: Starting kernel 134echo ' ---' `date`: Starting kernel
126 135
127# Determine the appropriate flavor of qemu command.
128QEMU="`identify_qemu $builddir/vmlinux`"
129
130# Generate -smp qemu argument. 136# Generate -smp qemu argument.
131qemu_args="-nographic $qemu_args" 137qemu_args="-nographic $qemu_args"
132cpu_count=`configNR_CPUS.sh $config_template` 138cpu_count=`configNR_CPUS.sh $config_template`
@@ -151,27 +157,38 @@ boot_args="`configfrag_boot_params "$boot_args" "$config_template"`"
151# Generate kernel-version-specific boot parameters 157# Generate kernel-version-specific boot parameters
152boot_args="`per_version_boot_params "$boot_args" $builddir/.config $seconds`" 158boot_args="`per_version_boot_params "$boot_args" $builddir/.config $seconds`"
153 159
154echo $QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd 160echo $QEMU $qemu_args -m 512 -kernel $builddir/$BOOT_IMAGE -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd
155if test -n "$RCU_BUILDONLY" 161if test -n "$TORTURE_BUILDONLY"
156then 162then
157 echo Build-only run specified, boot/test omitted. 163 echo Build-only run specified, boot/test omitted.
158 exit 0 164 exit 0
159fi 165fi
160$QEMU $qemu_args -m 512 -kernel $builddir/arch/x86/boot/bzImage -append "$qemu_append $boot_args" & 166( $QEMU $qemu_args -m 512 -kernel $builddir/$BOOT_IMAGE -append "$qemu_append $boot_args"; echo $? > $resdir/qemu-retval ) &
161qemu_pid=$! 167qemu_pid=$!
162commandcompleted=0 168commandcompleted=0
163echo Monitoring qemu job at pid $qemu_pid 169echo Monitoring qemu job at pid $qemu_pid
164for ((i=0;i<$seconds;i++)) 170while :
165do 171do
172 kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
166 if kill -0 $qemu_pid > /dev/null 2>&1 173 if kill -0 $qemu_pid > /dev/null 2>&1
167 then 174 then
175 if test $kruntime -ge $seconds
176 then
177 break;
178 fi
168 sleep 1 179 sleep 1
169 else 180 else
170 commandcompleted=1 181 commandcompleted=1
171 kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
172 if test $kruntime -lt $seconds 182 if test $kruntime -lt $seconds
173 then 183 then
174 echo Completed in $kruntime vs. $seconds >> $resdir/Warnings 2>&1 184 echo Completed in $kruntime vs. $seconds >> $resdir/Warnings 2>&1
185 grep "^(qemu) qemu:" $resdir/kvm-test-1-run.sh.out >> $resdir/Warnings 2>&1
186 killpid="`sed -n "s/^(qemu) qemu: terminating on signal [0-9]* from pid \([0-9]*\).*$/\1/p" $resdir/Warnings`"
187 if test -n "$killpid"
188 then
189 echo "ps -fp $killpid" >> $resdir/Warnings 2>&1
190 ps -fp $killpid >> $resdir/Warnings 2>&1
191 fi
175 else 192 else
176 echo ' ---' `date`: Kernel done 193 echo ' ---' `date`: Kernel done
177 fi 194 fi
@@ -181,23 +198,25 @@ done
181if test $commandcompleted -eq 0 198if test $commandcompleted -eq 0
182then 199then
183 echo Grace period for qemu job at pid $qemu_pid 200 echo Grace period for qemu job at pid $qemu_pid
184 for ((i=0;i<=$grace;i++)) 201 while :
185 do 202 do
203 kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
186 if kill -0 $qemu_pid > /dev/null 2>&1 204 if kill -0 $qemu_pid > /dev/null 2>&1
187 then 205 then
188 sleep 1 206 :
189 else 207 else
190 break 208 break
191 fi 209 fi
192 if test $i -eq $grace 210 if test $kruntime -ge $((seconds + grace))
193 then 211 then
194 kruntime=`awk 'BEGIN { print systime() - '"$kstarttime"' }'`
195 echo "!!! Hang at $kruntime vs. $seconds seconds" >> $resdir/Warnings 2>&1 212 echo "!!! Hang at $kruntime vs. $seconds seconds" >> $resdir/Warnings 2>&1
196 kill -KILL $qemu_pid 213 kill -KILL $qemu_pid
214 break
197 fi 215 fi
216 sleep 1
198 done 217 done
199fi 218fi
200 219
201cp $builddir/console.log $resdir 220cp $builddir/console.log $resdir
202parse-${TORTURE_SUITE}torture.sh $resdir/console.log $title 221parse-torture.sh $resdir/console.log $title
203parse-console.sh $resdir/console.log $title 222parse-console.sh $resdir/console.log $title