1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0+ 3# 4# Given the results directories for previous KVM-based torture runs, 5# check the build and console output for errors. Given a directory 6# containing results directories, this recursively checks them all. 7# 8# Usage: kvm-recheck.sh resdir ... 9# 10# Returns status reflecting the success or not of the last run specified. 11# 12# Copyright (C) IBM Corporation, 2011 13# 14# Authors: Paul E. McKenney <paulmck@linux.ibm.com> 15 16T=/tmp/kvm-recheck.sh.$$ 17trap 'rm -f $T' 0 2 18 19PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH 20. functions.sh 21for rd in "$@" 22do 23 firsttime=1 24 dirs=`find $rd -name Make.defconfig.out -print | sort | sed -e 's,/[^/]*$,,' | sort -u` 25 for i in $dirs 26 do 27 if test -n "$firsttime" 28 then 29 firsttime="" 30 resdir=`echo $i | sed -e 's,/$,,' -e 's,/[^/]*$,,'` 31 head -1 $resdir/log 32 fi 33 TORTURE_SUITE="`cat $i/../TORTURE_SUITE`" 34 rm -f $i/console.log.*.diags 35 kvm-recheck-${TORTURE_SUITE}.sh $i 36 if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -ne 0 && test "`cat $i/qemu-retval`" -ne 137 37 then 38 echo QEMU error, output: 39 cat $i/qemu-output 40 elif test -f "$i/console.log" 41 then 42 if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -eq 137 43 then 44 echo QEMU killed 45 fi 46 configcheck.sh $i/.config $i/ConfigFragment 47 if test -r $i/Make.oldconfig.err 48 then 49 cat $i/Make.oldconfig.err 50 fi 51 parse-build.sh $i/Make.out $configfile 52 parse-console.sh $i/console.log $configfile 53 if test -r $i/Warnings 54 then 55 cat $i/Warnings 56 fi 57 else 58 if test -f "$i/qemu-cmd" 59 then 60 print_bug qemu failed 61 echo " $i" 62 elif test -f "$i/buildonly" 63 then 64 echo Build-only run, no boot/test 65 configcheck.sh $i/.config $i/ConfigFragment 66 parse-build.sh $i/Make.out $configfile 67 else 68 print_bug Build failed 69 echo " $i" 70 fi 71 fi 72 done 73done 74EDITOR=echo kvm-find-errors.sh "${@: -1}" > $T 2>&1 75ret=$? 76builderrors="`tr ' ' '\012' < $T | grep -c '/Make.out.diags'`" 77if test "$builderrors" -gt 0 78then 79 echo $builderrors runs with build errors. 80fi 81runerrors="`tr ' ' '\012' < $T | grep -c '/console.log.diags'`" 82if test "$runerrors" -gt 0 83then 84 echo $runerrors runs with runtime errors. 85fi 86exit $ret 87