Lines Matching +full:0 +full:- +full:9 +full:a +full:- +full:z

2 # SPDX-License-Identifier: GPL-2.0+
4 # Carry out a kvm-based run for the specified qemu-cmd file, which might
5 # have been generated by --build-only kvm.sh run.
7 # Usage: kvm-test-1-run-qemu.sh qemu-cmd-dir
9 # qemu-cmd-dir provides the directory containing qemu-cmd file.
11 # "ds" is the top-level date-stamped directory and "scenario"
13 # must have been made by the caller. The shell-command comments
14 # at the end of the qemu-cmd file are not optional.
20 T="`mktemp -d ${TMPDIR-/tmp}/kvm-test-1-run-qemu.sh.XXXXXX`"
21 trap 'rm -rf $T' 0
24 if ! test -d "$resdir"
26 echo $0: Nonexistent directory: $resdir
29 if ! test -f "$resdir/qemu-cmd"
31 echo $0: Nonexistent qemu-cmd file: $resdir/qemu-cmd
35 echo ' ---' `date`: Starting kernel, PID $$
37 # Obtain settings from the qemu-cmd file.
38 grep '^#' $resdir/qemu-cmd | sed -e 's/^# //' > $T/qemu-cmd-settings
39 . $T/qemu-cmd-settings
41 # Decorate qemu-cmd with affinity, redirection, backgrounding, and PID capture
43 if test -n "$TORTURE_AFFINITY"
45 taskset_command="taskset -c $TORTURE_AFFINITY "
47 sed -e 's/^[^#].*$/'"$taskset_command"'& 2>\&1 \&/' < $resdir/qemu-cmd > $T/qemu-cmd
48 echo 'qemu_pid=$!' >> $T/qemu-cmd
49 echo 'echo $qemu_pid > $resdir/qemu-pid' >> $T/qemu-cmd
50 echo 'taskset -c -p $qemu_pid > $resdir/qemu-affinity' >> $T/qemu-cmd
57 ( . $T/qemu-cmd; wait `cat $resdir/qemu-pid`; echo $? > $resdir/qemu-retval ) &
58 commandcompleted=0
59 if test -z "$TORTURE_KCONFIG_GDB_ARG"
61 sleep 10 # Give qemu's pid a chance to reach the file
62 if test -s "$resdir/qemu-pid"
64 qemu_pid=`cat "$resdir/qemu-pid"`
68 echo Monitoring qemu job at yet-as-unknown pid `date`
71 if test -n "$TORTURE_KCONFIG_GDB_ARG"
73 base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'`
74 if ! test -f $base_resdir/vmlinux
76 base_resdir="`cat re-run`/$resdir"
77 if ! test -f $base_resdir/vmlinux
82 echo Waiting for you to attach a debug session, for example: > /dev/tty
91 if test -z "$qemu_pid" && test -s "$resdir/qemu-pid"
93 qemu_pid=`cat "$resdir/qemu-pid"`
95 kruntime=`gawk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
96 if test -z "$qemu_pid" || kill -0 "$qemu_pid" > /dev/null 2>&1
98 if test -n "$TORTURE_KCONFIG_GDB_ARG"
101 elif test $kruntime -ge $seconds || test -f "$resdir/../STOP.1"
108 if test $kruntime -lt $seconds
111 grep "^(qemu) qemu:" $resdir/kvm-test-1-run*.sh.out >> $resdir/Warnings 2>&1
112 …killpid="`sed -n "s/^(qemu) qemu: terminating on signal [0-9]* from pid \([0-9]*\).*$/\1/p" $resdi…
113 if test -n "$killpid"
115 echo "ps -fp $killpid" >> $resdir/Warnings 2>&1
116 ps -fp $killpid >> $resdir/Warnings 2>&1
119 echo ' ---' `date`: "Kernel done"
124 if test -z "$qemu_pid" && test -s "$resdir/qemu-pid"
126 qemu_pid=`cat "$resdir/qemu-pid"`
128 if test $commandcompleted -eq 0 && test -n "$qemu_pid"
130 if ! test -f "$resdir/../STOP.1"
137 if test -f "$resdir/../STOP.1"
140 kill -KILL $qemu_pid
143 kruntime=`gawk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
144 if kill -0 $qemu_pid > /dev/null 2>&1
152 if test "$newline" != "$oldline" && echo $newline | grep -q ' [0-9]\+us : '
156 …last_ts="`tail $resdir/console.log | grep '^\[ *[0-9]\+\.[0-9]\+]' | tail -1 | sed -e 's/^\[ *//'
157 if test -z "$last_ts"
159 last_ts=0
161 … "$newline" != "$oldline" && test "$last_ts" -lt $((seconds + $TORTURE_SHUTDOWN_GRACE)) && test "$…
164 if test $kruntime -ge $((seconds + $TORTURE_SHUTDOWN_GRACE))
166 echo Continuing at console.log time $last_ts \"`tail -n 1 $resdir/console.log`\" `date`
169 if test $must_continue = no && test $kruntime -ge $((seconds + $TORTURE_SHUTDOWN_GRACE))
172 kill -KILL $qemu_pid
178 elif test -z "$qemu_pid"
184 rm -f $resdir/build.run