Skip to content

Commit 515a48f

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
torture: Add kvm-series.sh to test commit/scenario combination
This commit adds a kvm-series.sh script that takes a list of scenarios and a list of commits, and then runs each scenario on all of the commits. A given scenario is run on all the commits before advancing to the next scenario to minimize build times. The successes and failures are summarized at the end of the run. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
1 parent 34e8256 commit 515a48f

1 file changed

Lines changed: 116 additions & 0 deletions

File tree

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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+
18+
T="`mktemp -d ${TMPDIR-/tmp}/kvm-series.sh.XXXXXX`"
19+
trap 'rm -rf $T' 0
20+
21+
scriptname=$0
22+
args="$*"
23+
24+
config_list="${1}"
25+
if test -z "${config_list}"
26+
then
27+
echo "$0: Need a quoted list of --config arguments for first argument."
28+
exit 1
29+
fi
30+
if test -z "${config_list}" || echo "${config_list}" | grep -q '\*'
31+
then
32+
echo "$0: Repetition ('*') not allowed in config list."
33+
exit 1
34+
fi
35+
36+
commit_list="${2}"
37+
if test -z "${commit_list}"
38+
then
39+
echo "$0: Need a list of commits (e.g., HEAD^^^..) for second argument."
40+
exit 2
41+
fi
42+
git log --pretty=format:"%h" "${commit_list}" > $T/commits
43+
ret=$?
44+
if test "${ret}" -ne 0
45+
then
46+
echo "$0: Invalid commit list ('${commit_list}')."
47+
exit 2
48+
fi
49+
sha1_list=`cat $T/commits`
50+
51+
shift
52+
shift
53+
54+
RCUTORTURE="`pwd`/tools/testing/selftests/rcutorture"; export RCUTORTURE
55+
PATH=${RCUTORTURE}/bin:$PATH; export PATH
56+
. functions.sh
57+
58+
ret=0
59+
nfail=0
60+
nsuccess=0
61+
faillist=
62+
successlist=
63+
cursha1="`git rev-parse --abbrev-ref HEAD`"
64+
ds="`date +%Y.%m.%d-%H.%M.%S`-series"
65+
startdate="`date`"
66+
starttime="`get_starttime`"
67+
68+
echo " --- " $scriptname $args | tee -a $T/log
69+
echo " --- Results directory: " $ds | tee -a $T/log
70+
71+
for config in ${config_list}
72+
do
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
97+
done
98+
git checkout "${cursha1}"
99+
100+
echo ${nsuccess} SUCCESSES: | tee -a $T/log
101+
echo ${successlist} | fmt | tee -a $T/log
102+
echo | tee -a $T/log
103+
echo ${nfail} FAILURES: | tee -a $T/log
104+
echo ${faillist} | fmt | tee -a $T/log
105+
if test -n "${faillist}"
106+
then
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
111+
fi
112+
echo Started at $startdate, ended at `date`, duration `get_starttime_duration $starttime`. | tee -a $T/log
113+
echo Summary: Successes: ${nsuccess} Failures: ${nfail} | tee -a $T/log
114+
cp $T/log tools/testing/selftests/rcutorture/res/${ds}
115+
116+
exit "${ret}"

0 commit comments

Comments
 (0)