1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0+ 3# 4# Usage: kvm-series.sh config-list commit-id-list [ kvm.sh parameters ] 5# 6# Tests the specified list of unadorned configs ("TREE01 SRCU-P" but not 7# "CFLIST" or "3*TRACE01") and an indication of a set of commits to test, 8# then runs each commit through the specified list of commits using kvm.sh. 9# The runs are grouped into a -series/config/commit directory tree. 10# Each run defaults to a duration of one minute. 11# 12# Run in top-level Linux source directory. Please note that this is in 13# no way a replacement for "git bisect"!!! 14# 15# This script is intended to replace kvm-check-branches.sh by providing 16# ease of use and faster execution. 17 18T="`mktemp -d ${TMPDIR-/tmp}/kvm-series.sh.XXXXXX`" 19trap 'rm -rf $T' 0 20 21scriptname=$0 22args="$*" 23 24config_list="${1}" 25if test -z "${config_list}" 26then 27 echo "$0: Need a quoted list of --config arguments for first argument." 28 exit 1 29fi 30if test -z "${config_list}" || echo "${config_list}" | grep -q '\*' 31then 32 echo "$0: Repetition ('*') not allowed in config list." 33 exit 1 34fi 35 36commit_list="${2}" 37if test -z "${commit_list}" 38then 39 echo "$0: Need a list of commits (e.g., HEAD^^^..) for second argument." 40 exit 2 41fi 42git log --pretty=format:"%h" "${commit_list}" > $T/commits 43ret=$? 44if test "${ret}" -ne 0 45then 46 echo "$0: Invalid commit list ('${commit_list}')." 47 exit 2 48fi 49sha1_list=`cat $T/commits` 50 51shift 52shift 53 54RCUTORTURE="`pwd`/tools/testing/selftests/rcutorture"; export RCUTORTURE 55PATH=${RCUTORTURE}/bin:$PATH; export PATH 56. functions.sh 57 58ret=0 59nfail=0 60nsuccess=0 61faillist= 62successlist= 63cursha1="`git rev-parse --abbrev-ref HEAD`" 64ds="`date +%Y.%m.%d-%H.%M.%S`-series" 65startdate="`date`" 66starttime="`get_starttime`" 67 68echo " --- " $scriptname $args | tee -a $T/log 69echo " --- Results directory: " $ds | tee -a $T/log 70 71for config in ${config_list} 72do 73 sha_n=0 74 for sha in ${sha1_list} 75 do 76 sha1=${sha_n}.${sha} # Enable "sort -k1nr" to list commits in order. 77 echo Starting ${config}/${sha1} at `date` | tee -a $T/log 78 git checkout "${sha}" 79 time tools/testing/selftests/rcutorture/bin/kvm.sh --configs "$config" --datestamp "$ds/${config}/${sha1}" --duration 1 "$@" 80 curret=$? 81 if test "${curret}" -ne 0 82 then 83 nfail=$((nfail+1)) 84 faillist="$faillist ${config}/${sha1}(${curret})" 85 else 86 nsuccess=$((nsuccess+1)) 87 successlist="$successlist ${config}/${sha1}" 88 # Successful run, so remove large files. 89 rm -f ${RCUTORTURE}/$ds/${config}/${sha1}/{vmlinux,bzImage,System.map,Module.symvers} 90 fi 91 if test "${ret}" -eq 0 92 then 93 ret=${curret} 94 fi 95 sha_n=$((sha_n+1)) 96 done 97done 98git checkout "${cursha1}" 99 100echo ${nsuccess} SUCCESSES: | tee -a $T/log 101echo ${successlist} | fmt | tee -a $T/log 102echo | tee -a $T/log 103echo ${nfail} FAILURES: | tee -a $T/log 104echo ${faillist} | fmt | tee -a $T/log 105if test -n "${faillist}" 106then 107 echo | tee -a $T/log 108 echo Failures across commits: | tee -a $T/log 109 echo ${faillist} | tr ' ' '\012' | sed -e 's,^[^/]*/,,' -e 's/([0-9]*)//' | 110 sort | uniq -c | sort -k2n | tee -a $T/log 111fi 112echo Started at $startdate, ended at `date`, duration `get_starttime_duration $starttime`. | tee -a $T/log 113echo Summary: Successes: ${nsuccess} Failures: ${nfail} | tee -a $T/log 114cp $T/log tools/testing/selftests/rcutorture/res/${ds} 115 116exit "${ret}" 117