18c2ecf20Sopenharmony_ci#!/bin/bash 28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0+ 38c2ecf20Sopenharmony_ci# 48c2ecf20Sopenharmony_ci# Given the results directories for previous KVM-based torture runs, 58c2ecf20Sopenharmony_ci# check the build and console output for errors. Given a directory 68c2ecf20Sopenharmony_ci# containing results directories, this recursively checks them all. 78c2ecf20Sopenharmony_ci# 88c2ecf20Sopenharmony_ci# Usage: kvm-recheck.sh resdir ... 98c2ecf20Sopenharmony_ci# 108c2ecf20Sopenharmony_ci# Returns status reflecting the success or not of the last run specified. 118c2ecf20Sopenharmony_ci# 128c2ecf20Sopenharmony_ci# Copyright (C) IBM Corporation, 2011 138c2ecf20Sopenharmony_ci# 148c2ecf20Sopenharmony_ci# Authors: Paul E. McKenney <paulmck@linux.ibm.com> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciT=/tmp/kvm-recheck.sh.$$ 178c2ecf20Sopenharmony_citrap 'rm -f $T' 0 2 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciPATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH 208c2ecf20Sopenharmony_ci. functions.sh 218c2ecf20Sopenharmony_cifor rd in "$@" 228c2ecf20Sopenharmony_cido 238c2ecf20Sopenharmony_ci firsttime=1 248c2ecf20Sopenharmony_ci dirs=`find $rd -name Make.defconfig.out -print | sort | sed -e 's,/[^/]*$,,' | sort -u` 258c2ecf20Sopenharmony_ci for i in $dirs 268c2ecf20Sopenharmony_ci do 278c2ecf20Sopenharmony_ci if test -n "$firsttime" 288c2ecf20Sopenharmony_ci then 298c2ecf20Sopenharmony_ci firsttime="" 308c2ecf20Sopenharmony_ci resdir=`echo $i | sed -e 's,/$,,' -e 's,/[^/]*$,,'` 318c2ecf20Sopenharmony_ci head -1 $resdir/log 328c2ecf20Sopenharmony_ci fi 338c2ecf20Sopenharmony_ci TORTURE_SUITE="`cat $i/../TORTURE_SUITE`" 348c2ecf20Sopenharmony_ci configfile=`echo $i | sed -e 's,^.*/,,'` 358c2ecf20Sopenharmony_ci rm -f $i/console.log.*.diags 368c2ecf20Sopenharmony_ci kvm-recheck-${TORTURE_SUITE}.sh $i 378c2ecf20Sopenharmony_ci if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -ne 0 && test "`cat $i/qemu-retval`" -ne 137 388c2ecf20Sopenharmony_ci then 398c2ecf20Sopenharmony_ci echo QEMU error, output: 408c2ecf20Sopenharmony_ci cat $i/qemu-output 418c2ecf20Sopenharmony_ci elif test -f "$i/console.log" 428c2ecf20Sopenharmony_ci then 438c2ecf20Sopenharmony_ci if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -eq 137 448c2ecf20Sopenharmony_ci then 458c2ecf20Sopenharmony_ci echo QEMU killed 468c2ecf20Sopenharmony_ci fi 478c2ecf20Sopenharmony_ci configcheck.sh $i/.config $i/ConfigFragment > $T 2>&1 488c2ecf20Sopenharmony_ci cat $T 498c2ecf20Sopenharmony_ci if test -r $i/Make.oldconfig.err 508c2ecf20Sopenharmony_ci then 518c2ecf20Sopenharmony_ci cat $i/Make.oldconfig.err 528c2ecf20Sopenharmony_ci fi 538c2ecf20Sopenharmony_ci parse-build.sh $i/Make.out $configfile 548c2ecf20Sopenharmony_ci parse-console.sh $i/console.log $configfile 558c2ecf20Sopenharmony_ci if test -r $i/Warnings 568c2ecf20Sopenharmony_ci then 578c2ecf20Sopenharmony_ci cat $i/Warnings 588c2ecf20Sopenharmony_ci fi 598c2ecf20Sopenharmony_ci else 608c2ecf20Sopenharmony_ci if test -f "$i/buildonly" 618c2ecf20Sopenharmony_ci then 628c2ecf20Sopenharmony_ci echo Build-only run, no boot/test 638c2ecf20Sopenharmony_ci configcheck.sh $i/.config $i/ConfigFragment 648c2ecf20Sopenharmony_ci parse-build.sh $i/Make.out $configfile 658c2ecf20Sopenharmony_ci elif test -f "$i/qemu-cmd" 668c2ecf20Sopenharmony_ci then 678c2ecf20Sopenharmony_ci print_bug qemu failed 688c2ecf20Sopenharmony_ci echo " $i" 698c2ecf20Sopenharmony_ci else 708c2ecf20Sopenharmony_ci print_bug Build failed 718c2ecf20Sopenharmony_ci echo " $i" 728c2ecf20Sopenharmony_ci fi 738c2ecf20Sopenharmony_ci fi 748c2ecf20Sopenharmony_ci done 758c2ecf20Sopenharmony_ci if test -f "$rd/kcsan.sum" 768c2ecf20Sopenharmony_ci then 778c2ecf20Sopenharmony_ci if grep -q CONFIG_KCSAN=y $T 788c2ecf20Sopenharmony_ci then 798c2ecf20Sopenharmony_ci echo "Compiler or architecture does not support KCSAN!" 808c2ecf20Sopenharmony_ci echo Did you forget to switch your compiler with '--kmake-arg CC=<cc-that-supports-kcsan>'? 818c2ecf20Sopenharmony_ci elif test -s "$rd/kcsan.sum" 828c2ecf20Sopenharmony_ci then 838c2ecf20Sopenharmony_ci echo KCSAN summary in $rd/kcsan.sum 848c2ecf20Sopenharmony_ci else 858c2ecf20Sopenharmony_ci echo Clean KCSAN run in $rd 868c2ecf20Sopenharmony_ci fi 878c2ecf20Sopenharmony_ci fi 888c2ecf20Sopenharmony_cidone 898c2ecf20Sopenharmony_ciEDITOR=echo kvm-find-errors.sh "${@: -1}" > $T 2>&1 908c2ecf20Sopenharmony_ciret=$? 918c2ecf20Sopenharmony_cibuilderrors="`tr ' ' '\012' < $T | grep -c '/Make.out.diags'`" 928c2ecf20Sopenharmony_ciif test "$builderrors" -gt 0 938c2ecf20Sopenharmony_cithen 948c2ecf20Sopenharmony_ci echo $builderrors runs with build errors. 958c2ecf20Sopenharmony_cifi 968c2ecf20Sopenharmony_cirunerrors="`tr ' ' '\012' < $T | grep -c '/console.log.diags'`" 978c2ecf20Sopenharmony_ciif test "$runerrors" -gt 0 988c2ecf20Sopenharmony_cithen 998c2ecf20Sopenharmony_ci echo $runerrors runs with runtime errors. 1008c2ecf20Sopenharmony_cifi 1018c2ecf20Sopenharmony_ciexit $ret 102