torture: Capture qemu output
authorPaul E. McKenney <paulmck@linux.ibm.com>
Wed, 24 Apr 2019 11:39:10 +0000 (04:39 -0700)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Tue, 28 May 2019 16:06:09 +0000 (09:06 -0700)
Currently qemu output appears on standard output, but is inaccessible
later on.  This commit therefore captures this output and causes
kvm-recheck.sh to output this output if QEMU gave a non-zero non-137
exit code.  (And exit code of 137 indicates that QEMU was killed, in
which case we want to know about the hang rather than the fact that
QEMU was killed.)

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
tools/testing/selftests/rcutorture/bin/kvm-recheck.sh
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh

index 2297ddc2d4c5b06507332ad02f5ed71ff6ac78c2..e5edd5198725977859513a09113a1b316aef69d0 100755 (executable)
@@ -30,8 +30,16 @@ do
                TORTURE_SUITE="`cat $i/../TORTURE_SUITE`"
                rm -f $i/console.log.*.diags
                kvm-recheck-${TORTURE_SUITE}.sh $i
-               if test -f "$i/console.log"
+               if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -ne 0 && test "`cat $i/qemu-retval`" -ne 137
                then
+                       echo QEMU error, output:
+                       cat $i/qemu-output
+               elif test -f "$i/console.log"
+               then
+                       if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -eq 137
+                       then
+                               echo QEMU killed
+                       fi
                        configcheck.sh $i/.config $i/ConfigFragment
                        if test -r $i/Make.oldconfig.err
                        then
index 0eb1ec16d78a1e2863bf1408f8b591d93ec7a47c..003511494fd9a7a292318814018c0fd36947e2a0 100755 (executable)
@@ -165,7 +165,7 @@ then
 fi
 echo "NOTE: $QEMU either did not run or was interactive" > $resdir/console.log
 echo $QEMU $qemu_args -m $TORTURE_QEMU_MEM -kernel $KERNEL -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd
-( $QEMU $qemu_args -m $TORTURE_QEMU_MEM -kernel $KERNEL -append "$qemu_append $boot_args"& echo $! > $resdir/qemu_pid; wait `cat  $resdir/qemu_pid`; echo $? > $resdir/qemu-retval ) &
+( $QEMU $qemu_args -m $TORTURE_QEMU_MEM -kernel $KERNEL -append "$qemu_append $boot_args" > $resdir/qemu-output 2>&1 & echo $! > $resdir/qemu_pid; wait `cat  $resdir/qemu_pid`; echo $? > $resdir/qemu-retval ) &
 commandcompleted=0
 sleep 10 # Give qemu's pid a chance to reach the file
 if test -s "$resdir/qemu_pid"