Lines Matching +full:remote +full:- +full:pid

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=${TMPDIR-/tmp}/kvm-test-1-run-qemu.sh.$$
21 trap 'rm -rf $T' 0
25 if ! test -d "$resdir"
30 if ! test -f "$resdir/qemu-cmd"
32 echo $0: Nonexistent qemu-cmd file: $resdir/qemu-cmd
36 echo ' ---' `date`: Starting kernel, PID $$
38 # Obtain settings from the qemu-cmd file.
39 grep '^#' $resdir/qemu-cmd | sed -e 's/^# //' > $T/qemu-cmd-settings
40 . $T/qemu-cmd-settings
42 # Decorate qemu-cmd with affinity, redirection, backgrounding, and PID capture
44 if test -n "$TORTURE_AFFINITY"
46 taskset_command="taskset -c $TORTURE_AFFINITY "
48 sed -e 's/^[^#].*$/'"$taskset_command"'& 2>\&1 \&/' < $resdir/qemu-cmd > $T/qemu-cmd
49 echo 'qemu_pid=$!' >> $T/qemu-cmd
50 echo 'echo $qemu_pid > $resdir/qemu-pid' >> $T/qemu-cmd
51 echo 'taskset -c -p $qemu_pid > $resdir/qemu-affinity' >> $T/qemu-cmd
58 ( . $T/qemu-cmd; wait `cat $resdir/qemu-pid`; echo $? > $resdir/qemu-retval ) &
60 if test -z "$TORTURE_KCONFIG_GDB_ARG"
62 sleep 10 # Give qemu's pid a chance to reach the file
63 if test -s "$resdir/qemu-pid"
65 qemu_pid=`cat "$resdir/qemu-pid"`
66 echo Monitoring qemu job at pid $qemu_pid `date`
69 echo Monitoring qemu job at yet-as-unknown pid `date`
72 if test -n "$TORTURE_KCONFIG_GDB_ARG"
74 base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'`
75 if ! test -f $base_resdir/vmlinux
77 base_resdir="`cat re-run`/$resdir"
78 if ! test -f $base_resdir/vmlinux
86 echo " target remote :1234" > /dev/tty
92 if test -z "$qemu_pid" && test -s "$resdir/qemu-pid"
94 qemu_pid=`cat "$resdir/qemu-pid"`
96 kruntime=`gawk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
97 if test -z "$qemu_pid" || kill -0 "$qemu_pid" > /dev/null 2>&1
99 if test -n "$TORTURE_KCONFIG_GDB_ARG"
102 elif test $kruntime -ge $seconds || test -f "$resdir/../STOP.1"
109 if test $kruntime -lt $seconds
112 grep "^(qemu) qemu:" $resdir/kvm-test-1-run.sh.out >> $resdir/Warnings 2>&1
113 …killpid="`sed -n "s/^(qemu) qemu: terminating on signal [0-9]* from pid \([0-9]*\).*$/\1/p" $resdi…
114 if test -n "$killpid"
116 echo "ps -fp $killpid" >> $resdir/Warnings 2>&1
117 ps -fp $killpid >> $resdir/Warnings 2>&1
120 echo ' ---' `date`: "Kernel done"
125 if test -z "$qemu_pid" && test -s "$resdir/qemu-pid"
127 qemu_pid=`cat "$resdir/qemu-pid"`
129 if test $commandcompleted -eq 0 && test -n "$qemu_pid"
131 if ! test -f "$resdir/../STOP.1"
133 echo Grace period for qemu job at pid $qemu_pid `date`
138 if test -f "$resdir/../STOP.1"
140 echo "PID $qemu_pid killed due to run STOP.1 request `date`" >> $resdir/Warnings 2>&1
141 kill -KILL $qemu_pid
144 kruntime=`gawk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
145 if kill -0 $qemu_pid > /dev/null 2>&1
153 if test "$newline" != "$oldline" && echo $newline | grep -q ' [0-9]\+us : '
157 …last_ts="`tail $resdir/console.log | grep '^\[ *[0-9]\+\.[0-9]\+]' | tail -1 | sed -e 's/^\[ *//'
158 if test -z "$last_ts"
162 … "$newline" != "$oldline" && test "$last_ts" -lt $((seconds + $TORTURE_SHUTDOWN_GRACE)) && test "$…
165 if test $kruntime -ge $((seconds + $TORTURE_SHUTDOWN_GRACE))
167 echo Continuing at console.log time $last_ts \"`tail -n 1 $resdir/console.log`\" `date`
170 if test $must_continue = no && test $kruntime -ge $((seconds + $TORTURE_SHUTDOWN_GRACE))
172 echo "!!! PID $qemu_pid hung at $kruntime vs. $seconds seconds `date`" >> $resdir/Warnings 2>&1
173 kill -KILL $qemu_pid
179 elif test -z "$qemu_pid"
181 echo Unknown PID, cannot kill qemu command
185 rm -f $resdir/build.run