lkml.org 
[lkml]   [2014]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH tip/core/rcu 21/45] torture: Report diagnostics from qemu
On Mon, Apr 28, 2014 at 05:25:09PM -0700, Paul E. McKenney wrote:
> From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
>
> The current script does record qemu diagnostics, but the user has to
> know where to look for them. This commit therefore puts them into the
> Warnings file so that kvm-recheck.sh will display them. This change is
> especially useful if you are in the habit of killing the qemu process
> when you realize that you messed something up, but then later on wonder
> why the process terminated early.
>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

A couple of issues below.

> @@ -172,6 +172,14 @@ do
> if test $kruntime -lt $seconds
> then
> echo Completed in $kruntime vs. $seconds >> $resdir/Warnings 2>&1
> + grep "^(qemu) qemu:" $resdir/kvm-test-1-run.sh.out >> $resdir/Warnings 2>&1
> + killpid="`grep "^(qemu) qemu: terminating on signal [0-9]* from pid" $resdir/kvm-test-1-run.sh.out`"

You already searched for lines like this and put them in Warnings in the
previous line, so you don't need to search the entire output. Also, you
use grep here and sed below; you could just use sed here to directly
obtain the PID:

killpid="$(sed -n "s/^(qemu) qemu: terminating on signal [0-9]* from pid \([0-9]*\).*$/\1/p" $resdir/Warnings)"

> + if test -n "$killpid"
> + then
> + pscmd="`echo $killpid | sed -e 's/^.*from pid/ps -ef | grep/'`"
> + echo $pscmd >> $resdir/Warnings
> + echo $pscmd | sh >> $resdir/Warnings 2>&1
> + fi

Grepping for a PID is a bad idea; it'll turn up anything that contains
that PID anywhere on the line, including as a substring. Given the
above change to obtain a numeric $killpid, you can instead pass the PID
to ps directly:
if test -n "$killpid"
then
ps -fp $killpid >> $resdir/Warnings 2>&1
fi



\
 
 \ /
  Last update: 2014-05-09 05:41    [W:0.536 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site