Lines Matching +full:0 +full:- +full:9 +full:a +full:- +full:z
2 # SPDX-License-Identifier: GPL-2.0+
4 # Run a kvm-based test of the specified tree on the specified configs.
7 # Execute this in the source tree. Do not run it as a background task
10 # Usage: kvm-test-1-run.sh config builddir resdir seconds qemu-args boot_args
12 # qemu-args defaults to "-enable-kvm -nographic", along with arguments
18 # Anything you specify for either qemu-args or boot_args is appended to
19 # the default values. The "-smp" value is deduced from the contents of
28 T=${TMPDIR-/tmp}/kvm-test-1-run.sh.$$
29 trap 'rm -rf $T' 0
36 config_dir=`echo $config_template | sed -e 's,/[^/]*$,,'`
37 title=`echo $config_template | sed -e 's/^.*\///'`
40 if test -z "$resdir" -o ! -d "$resdir" -o ! -w "$resdir"
42 echo "kvm-test-1-run.sh :$resdir: Not a writable directory, cannot store results into it"
45 echo ' ---' `date`: Starting build
46 echo ' ---' Kconfig fragment at: $config_template >> $resdir/log
51 # second the to-be-updated file within $T, and the third and final the
52 # list of additional Kconfig options. Note that a $2.tmp file is
55 if test -n "$3"
57 echo $3 | sed -e 's/^ *//' -e 's/ *$//' | tr -s " " "\012" > $T/Kconfig_args
58 echo " --- $1" >> $resdir/ConfigFragment.input
69 config_override_param "--gdb options" KcList "$TORTURE_KCONFIG_GDB_ARG"
70 config_override_param "--kasan options" KcList "$TORTURE_KCONFIG_KASAN_ARG"
71 config_override_param "--kcsan options" KcList "$TORTURE_KCONFIG_KCSAN_ARG"
72 config_override_param "--kconfig argument" KcList "$TORTURE_KCONFIG_ARG"
75 base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'`
76 if test "$base_resdir" != "$resdir" -a -f $base_resdir/bzImage -a -f $base_resdir/vmlinux
82 ln -s $base_resdir/Make*.out $resdir # for kvm-recheck.sh
83 ln -s $base_resdir/.config $resdir # for kvm-recheck.sh
84 # Arch-independent indicator
86 elif kvm-build.sh $T/KcList $resdir
88 # Had to build a kernel for this test.
95 if test -n "$BOOT_IMAGE"
99 # Arch-independent indicator
105 parse-build.sh $resdir/Make.out $title
110 if test -f $builddir.wait
116 if test -f $builddir.wait
120 while test -f $builddir.ready
129 if test -z "$TORTURE_BUILDONLY"
131 echo ' ---' `date`: Starting kernel
134 # Generate -smp qemu argument.
135 qemu_args="-enable-kvm -nographic $qemu_args"
138 if test "$cpu_count" -gt "$TORTURE_ALLOTED_CPUS"
140 echo CPU count limited from $cpu_count to $TORTURE_ALLOTED_CPUS | tee -a $resdir/Warnings
146 # Generate architecture-specific and interaction-specific qemu arguments
149 # Generate qemu -append arguments
152 # Pull in Kconfig-fragment boot parameters
154 # Generate kernel-version-specific boot parameters
156 if test -n "$TORTURE_BOOT_GDB_ARG"
160 …cho $QEMU $qemu_args -m $TORTURE_QEMU_MEM -kernel $KERNEL -append \"$qemu_append $boot_args\" $TOR…
162 if test -n "$TORTURE_BUILDONLY"
164 echo Build-only run specified, boot/test omitted.
166 exit 0
169 # Decorate qemu-cmd with redirection, backgrounding, and PID capture
170 sed -e 's/$/ 2>\&1 \&/' < $resdir/qemu-cmd > $T/qemu-cmd
171 echo 'echo $! > $resdir/qemu_pid' >> $T/qemu-cmd
177 ( . $T/qemu-cmd; wait `cat $resdir/qemu_pid`; echo $? > $resdir/qemu-retval ) &
178 commandcompleted=0
179 if test -z "$TORTURE_KCONFIG_GDB_ARG"
181 sleep 10 # Give qemu's pid a chance to reach the file
182 if test -s "$resdir/qemu_pid"
188 echo Monitoring qemu job at yet-as-unknown pid
191 if test -n "$TORTURE_KCONFIG_GDB_ARG"
193 echo Waiting for you to attach a debug session, for example: > /dev/tty
202 if test -z "$qemu_pid" -a -s "$resdir/qemu_pid"
206 kruntime=`gawk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
207 if test -z "$qemu_pid" || kill -0 "$qemu_pid" > /dev/null 2>&1
209 if test $kruntime -ge $seconds -o -f "$TORTURE_STOPFILE"
216 if test $kruntime -lt $seconds
219 grep "^(qemu) qemu:" $resdir/kvm-test-1-run.sh.out >> $resdir/Warnings 2>&1
220 …killpid="`sed -n "s/^(qemu) qemu: terminating on signal [0-9]* from pid \([0-9]*\).*$/\1/p" $resdi…
221 if test -n "$killpid"
223 echo "ps -fp $killpid" >> $resdir/Warnings 2>&1
224 ps -fp $killpid >> $resdir/Warnings 2>&1
227 echo ' ---' `date`: "Kernel done"
232 if test -z "$qemu_pid" -a -s "$resdir/qemu_pid"
236 if test $commandcompleted -eq 0 -a -n "$qemu_pid"
238 if ! test -f "$TORTURE_STOPFILE"
245 if test -f "$TORTURE_STOPFILE"
248 kill -KILL $qemu_pid
251 kruntime=`gawk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
252 if kill -0 $qemu_pid > /dev/null 2>&1
260 if test "$newline" != "$oldline" && echo $newline | grep -q ' [0-9]\+us : '
264 …last_ts="`tail $resdir/console.log | grep '^\[ *[0-9]\+\.[0-9]\+]' | tail -1 | sed -e 's/^\[ *//' …
265 if test -z "$last_ts"
267 last_ts=0
269 if test "$newline" != "$oldline" -a "$last_ts" -lt $((seconds + $TORTURE_SHUTDOWN_GRACE))
273 if test $must_continue = no -a $kruntime -ge $((seconds + $TORTURE_SHUTDOWN_GRACE))
276 kill -KILL $qemu_pid
282 elif test -z "$qemu_pid"
287 parse-console.sh $resdir/console.log $title