139 lines · bash
1#!/bin/bash2# 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 directory6# 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, 201113#14# Authors: Paul E. McKenney <paulmck@linux.ibm.com>15 16T="`mktemp ${TMPDIR-/tmp}/kvm-recheck.sh.XXXXXX`"17trap 'rm -f $T' 0 218 19configerrors=020 21PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH22. functions.sh23for rd in "$@"24do25 firsttime=126 dirs=`find $rd -name Make.defconfig.out -print | sort | sed -e 's,/[^/]*$,,' | sort -u`27 for i in $dirs28 do29 if test -n "$firsttime"30 then31 firsttime=""32 resdir=`echo $i | sed -e 's,/$,,' -e 's,/[^/]*$,,'`33 head -1 $resdir/log34 fi35 TORTURE_SUITE="`cat $i/../torture_suite`" ; export TORTURE_SUITE36 configfile=`echo $i | sed -e 's,^.*/,,'`37 rm -f $i/console.log.*.diags $i/ConfigFragment.diags38 case "${TORTURE_SUITE}" in39 X*)40 ;;41 *)42 kvm-recheck-${TORTURE_SUITE}.sh $i43 esac44 if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -ne 0 && test "`cat $i/qemu-retval`" -ne 13745 then46 echo QEMU error, output:47 cat $i/qemu-output48 elif test -f "$i/console.log"49 then50 if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -eq 13751 then52 echo QEMU killed53 fi54 configcheck.sh $i/.config $i/ConfigFragment > $i/ConfigFragment.diags 2>&155 if grep -q '^CONFIG_KCSAN=y$' $i/ConfigFragment.input56 then57 # KCSAN forces a number of Kconfig options, so remove58 # complaints about those Kconfig options in KCSAN runs.59 mv $i/ConfigFragment.diags $i/ConfigFragment.diags.kcsan60 grep -v -E 'CONFIG_PROVE_RCU|CONFIG_PREEMPT_COUNT' $i/ConfigFragment.diags.kcsan > $i/ConfigFragment.diags61 fi62 if test -s $i/ConfigFragment.diags63 then64 cat $i/ConfigFragment.diags65 configerrors=$((configerrors+1))66 else67 rm $i/ConfigFragment.diags68 fi69 if test -r $i/Make.oldconfig.err70 then71 cat $i/Make.oldconfig.err72 fi73 parse-build.sh $i/Make.out $configfile74 parse-console.sh $i/console.log $configfile75 if test -r $i/Warnings76 then77 cat $i/Warnings78 fi79 else80 if test -f "$i/buildonly"81 then82 echo Build-only run, no boot/test83 configcheck.sh $i/.config $i/ConfigFragment > $i/ConfigFragment.diags 2>&184 if test -s $i/ConfigFragment.diags85 then86 cat $i/ConfigFragment.diags87 configerrors=$((configerrors+1))88 else89 rm $i/ConfigFragment.diags90 fi91 parse-build.sh $i/Make.out $configfile92 elif test -f "$i/qemu-cmd"93 then94 print_bug qemu failed95 echo " $i"96 else97 print_bug Build failed98 echo " $i"99 fi100 fi101 done102 if test -f "$rd/kcsan.sum"103 then104 if ! test -f $i/ConfigFragment.diags105 then106 :107 elif grep -q CONFIG_KCSAN=y $i/ConfigFragment.diags108 then109 echo "Compiler or architecture does not support KCSAN!"110 echo Did you forget to switch your compiler with '--kmake-arg CC=<cc-that-supports-kcsan>'?111 elif test -s "$rd/kcsan.sum"112 then113 echo KCSAN summary in $rd/kcsan.sum114 else115 echo Clean KCSAN run in $rd116 fi117 fi118done119 120if test "$configerrors" -gt 0121then122 echo $configerrors runs with .config errors.123 ret=1124fi125EDITOR=echo kvm-find-errors.sh "${@: -1}" > $T 2>&1126builderrors="`tr ' ' '\012' < $T | grep -c '/Make.out.diags'`"127if test "$builderrors" -gt 0128then129 echo $builderrors runs with build errors.130 ret=2131fi132runerrors="`tr ' ' '\012' < $T | grep -c '/console.log.diags'`"133if test "$runerrors" -gt 0134then135 echo $runerrors runs with runtime errors.136 ret=3137fi138exit $ret139