blob: e527dc952eb010553a9dca7b76d2b324b541a44b [file] [log] [blame]
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -07001#!/bin/bash
2#
3# Run a series of 14 tests under KVM. These are not particularly
4# well-selected or well-tuned, but are the current set. Run from the
5# top level of the source tree.
6#
7# Edit the definitions below to set the locations of the various directories,
8# as well as the test duration.
9#
Pranith Kumar3327d922014-07-11 19:47:35 -040010# Usage: kvm.sh [ options ]
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070011#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
Paul E. McKenney0e342a82013-12-03 09:54:18 -080023# along with this program; if not, you can access it online at
24# http://www.gnu.org/licenses/gpl-2.0.html.
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070025#
26# Copyright (C) IBM Corporation, 2011
27#
28# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
29
30scriptname=$0
Paul E. McKenney330a76f2013-09-30 14:49:43 -070031args="$*"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070032
Paul E. McKenney43e38ab2014-01-15 15:48:41 -080033T=/tmp/kvm.sh.$$
34trap 'rm -rf $T' 0
35mkdir $T
36
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070037dur=30
Paul E. McKenneya7582812014-01-17 03:10:16 -080038dryrun=""
Paul E. McKenney73931b52013-10-15 10:42:25 -070039KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
Paul E. McKenney32caccb2013-10-28 08:57:29 -070040PATH=${KVM}/bin:$PATH; export PATH
Paul E. McKenney8c55f222014-02-26 14:28:43 -080041TORTURE_DEFCONFIG=defconfig
Paul E. McKenneyf189cc82014-03-06 14:44:46 -080042TORTURE_BOOT_IMAGE=""
Paul E. McKenney2f66dbc2014-02-26 11:16:07 -080043TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD
Paul E. McKenney58d280b2014-02-26 15:23:21 -080044TORTURE_KMAKE_ARG=""
Paul E. McKenney61010e72014-02-07 10:29:49 -080045TORTURE_SUITE=rcu
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070046resdir=""
Paul E. McKenney4275be82013-09-29 11:13:46 -070047configs=""
Paul E. McKenney43e38ab2014-01-15 15:48:41 -080048cpus=0
Paul E. McKenney847bfd22013-09-28 18:44:11 -070049ds=`date +%Y.%m.%d-%H:%M:%S`
Paul E. McKenneybb918532013-09-28 20:37:45 -070050kversion=""
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070051
Paul E. McKenney32caccb2013-10-28 08:57:29 -070052. functions.sh
53
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070054usage () {
55 echo "Usage: $scriptname optional arguments:"
Paul E. McKenney7dca9272013-10-14 08:19:39 -070056 echo " --bootargs kernel-boot-arguments"
Paul E. McKenneyf189cc82014-03-06 14:44:46 -080057 echo " --bootimage relative-path-to-kernel-boot-image"
Paul E. McKenney11274812013-10-10 14:52:07 -070058 echo " --buildonly"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070059 echo " --configs \"config-file list\""
Paul E. McKenney43e38ab2014-01-15 15:48:41 -080060 echo " --cpus N"
Paul E. McKenney847bfd22013-09-28 18:44:11 -070061 echo " --datestamp string"
Paul E. McKenney8c55f222014-02-26 14:28:43 -080062 echo " --defconfig string"
Paul E. McKenneya7582812014-01-17 03:10:16 -080063 echo " --dryrun sched|script"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070064 echo " --duration minutes"
Paul E. McKenney315c5402013-10-04 13:15:55 -070065 echo " --interactive"
Paul E. McKenney74878fb2013-10-15 11:51:23 -070066 echo " --kmake-arg kernel-make-arguments"
Paul E. McKenneybb918532013-09-28 20:37:45 -070067 echo " --kversion vN.NN"
Paul E. McKenney315c5402013-10-04 13:15:55 -070068 echo " --mac nn:nn:nn:nn:nn:nn"
Paul E. McKenney73931b52013-10-15 10:42:25 -070069 echo " --no-initrd"
Paul E. McKenneye9ce6402013-10-15 09:22:48 -070070 echo " --qemu-args qemu-system-..."
Paul E. McKenney4f8a0312013-09-30 17:17:57 -070071 echo " --qemu-cmd qemu-system-..."
Paul E. McKenney61010e72014-02-07 10:29:49 -080072 echo " --results absolute-pathname"
73 echo " --torture rcu"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070074 exit 1
75}
76
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070077while test $# -gt 0
78do
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070079 case "$1" in
Paul E. McKenney7dca9272013-10-14 08:19:39 -070080 --bootargs)
81 checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--'
Paul E. McKenney98bc8cc2014-02-26 15:28:53 -080082 TORTURE_BOOTARGS="$2"
Paul E. McKenney7dca9272013-10-14 08:19:39 -070083 shift
84 ;;
Paul E. McKenneyf189cc82014-03-06 14:44:46 -080085 --bootimage)
86 checkarg --bootimage "(relative path to kernel boot image)" "$#" "$2" '[a-zA-Z0-9][a-zA-Z0-9_]*' '^--'
87 TORTURE_BOOT_IMAGE="$2"
88 shift
89 ;;
Paul E. McKenney11274812013-10-10 14:52:07 -070090 --buildonly)
Paul E. McKenney805ffee2014-02-26 15:39:41 -080091 TORTURE_BUILDONLY=1
Paul E. McKenney11274812013-10-10 14:52:07 -070092 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070093 --configs)
94 checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--'
95 configs="$2"
96 shift
97 ;;
Paul E. McKenney43e38ab2014-01-15 15:48:41 -080098 --cpus)
99 checkarg --cpus "(number)" "$#" "$2" '^[0-9]*$' '^--'
100 cpus=$2
101 shift
102 ;;
Paul E. McKenney847bfd22013-09-28 18:44:11 -0700103 --datestamp)
104 checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
105 ds=$2
106 shift
107 ;;
Paul E. McKenney8c55f222014-02-26 14:28:43 -0800108 --defconfig)
109 checkarg --defconfig "defconfigtype" "$#" "$2" '^[^/][^/]*$' '^--'
110 TORTURE_DEFCONFIG=$2
111 shift
112 ;;
Paul E. McKenneya7582812014-01-17 03:10:16 -0800113 --dryrun)
114 checkarg --dryrun "sched|script" $# "$2" 'sched\|script' '^--'
115 dryrun=$2
116 shift
117 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700118 --duration)
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700119 checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error'
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700120 dur=$2
121 shift
122 ;;
Paul E. McKenney315c5402013-10-04 13:15:55 -0700123 --interactive)
Paul E. McKenneya0edd472014-02-26 16:38:52 -0800124 TORTURE_QEMU_INTERACTIVE=1; export TORTURE_QEMU_INTERACTIVE
Paul E. McKenney315c5402013-10-04 13:15:55 -0700125 ;;
Paul E. McKenney74878fb2013-10-15 11:51:23 -0700126 --kmake-arg)
127 checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$'
Paul E. McKenney58d280b2014-02-26 15:23:21 -0800128 TORTURE_KMAKE_ARG="$2"
Paul E. McKenney74878fb2013-10-15 11:51:23 -0700129 shift
130 ;;
Paul E. McKenneybb918532013-09-28 20:37:45 -0700131 --kversion)
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700132 checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' '^error'
Paul E. McKenneybb918532013-09-28 20:37:45 -0700133 kversion=$2
134 shift
135 ;;
Paul E. McKenney315c5402013-10-04 13:15:55 -0700136 --mac)
137 checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error
Paul E. McKenney58f724f2014-02-26 16:41:18 -0800138 TORTURE_QEMU_MAC=$2
Paul E. McKenney315c5402013-10-04 13:15:55 -0700139 shift
140 ;;
Paul E. McKenney73931b52013-10-15 10:42:25 -0700141 --no-initrd)
Paul E. McKenney2f66dbc2014-02-26 11:16:07 -0800142 TORTURE_INITRD=""; export TORTURE_INITRD
Paul E. McKenney73931b52013-10-15 10:42:25 -0700143 ;;
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700144 --qemu-args)
145 checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error'
Paul E. McKenneyd1b1e512014-02-26 16:42:46 -0800146 TORTURE_QEMU_ARG="$2"
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700147 shift
148 ;;
Paul E. McKenney4f8a0312013-09-30 17:17:57 -0700149 --qemu-cmd)
150 checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--'
Paul E. McKenney250da312014-02-26 16:44:26 -0800151 TORTURE_QEMU_CMD="$2"
Paul E. McKenney4f8a0312013-09-30 17:17:57 -0700152 shift
153 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700154 --results)
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700155 checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error'
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700156 resdir=$2
157 shift
158 ;;
Paul E. McKenney61010e72014-02-07 10:29:49 -0800159 --torture)
Paul E. McKenney9dfa5b32014-02-07 13:56:37 -0800160 checkarg --torture "(suite name)" "$#" "$2" '^\(lock\|rcu\)$' '^--'
Paul E. McKenney61010e72014-02-07 10:29:49 -0800161 TORTURE_SUITE=$2
162 shift
163 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700164 *)
Paul E. McKenney2bcdf4e2013-10-01 10:14:09 -0700165 echo Unknown argument $1
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700166 usage
167 ;;
168 esac
169 shift
170done
171
Paul E. McKenney61010e72014-02-07 10:29:49 -0800172CONFIGFRAG=${KVM}/configs/${TORTURE_SUITE}; export CONFIGFRAG
Paul E. McKenney4275be82013-09-29 11:13:46 -0700173KVPATH=${CONFIGFRAG}/$kversion; export KVPATH
174
175if test -z "$configs"
176then
177 configs="`cat $CONFIGFRAG/$kversion/CFLIST`"
178fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700179
180if test -z "$resdir"
181then
182 resdir=$KVM/res
Paul E. McKenneydaeda232014-01-27 12:31:20 -0800183fi
184
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800185# Create a file of test-name/#cpus pairs, sorted by decreasing #cpus.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800186touch $T/cfgcpu
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700187for CF in $configs
188do
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800189 if test -f "$CONFIGFRAG/$kversion/$CF"
Paul E. McKenneyf43f8f72013-10-19 06:28:21 -0700190 then
Paul E. McKenneyae867ff2014-07-21 13:35:10 -0700191 cpu_count=`configNR_CPUS.sh $CONFIGFRAG/$kversion/$CF`
192 cpu_count=`configfrag_boot_cpus "$TORTURE_BOOTARGS" "$CONFIGFRAG/$kversion/$CF" "$cpu_count"`
193 echo $CF $cpu_count >> $T/cfgcpu
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800194 else
195 echo "The --configs file $CF does not exist, terminating."
196 exit 1
Paul E. McKenneyf43f8f72013-10-19 06:28:21 -0700197 fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700198done
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800199sort -k2nr $T/cfgcpu > $T/cfgcpu.sort
200
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800201# Use a greedy bin-packing algorithm, sorting the list accordingly.
Paul E. McKenney53954672014-01-17 14:18:05 -0800202awk < $T/cfgcpu.sort > $T/cfgcpu.pack -v ncpus=$cpus '
203BEGIN {
204 njobs = 0;
205}
206
207{
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800208 # Read file of tests and corresponding required numbers of CPUs.
Paul E. McKenney53954672014-01-17 14:18:05 -0800209 cf[njobs] = $1;
210 cpus[njobs] = $2;
211 njobs++;
212}
213
214END {
215 alldone = 0;
216 batch = 0;
217 nc = -1;
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800218
219 # Each pass through the following loop creates on test batch
220 # that can be executed concurrently given ncpus. Note that a
221 # given test that requires more than the available CPUs will run in
222 # their own batch. Such tests just have to make do with what
223 # is available.
Paul E. McKenney53954672014-01-17 14:18:05 -0800224 while (nc != ncpus) {
225 batch++;
226 nc = ncpus;
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800227
228 # Each pass through the following loop considers one
229 # test for inclusion in the current batch.
Paul E. McKenney53954672014-01-17 14:18:05 -0800230 for (i = 0; i < njobs; i++) {
231 if (done[i])
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800232 continue; # Already part of a batch.
Paul E. McKenney53954672014-01-17 14:18:05 -0800233 if (nc >= cpus[i] || nc == ncpus) {
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800234
235 # This test fits into the current batch.
Paul E. McKenney53954672014-01-17 14:18:05 -0800236 done[i] = batch;
237 nc -= cpus[i];
238 if (nc <= 0)
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800239 break; # Too-big test in its own batch.
Paul E. McKenney53954672014-01-17 14:18:05 -0800240 }
241 }
242 }
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800243
244 # Dump out the tests in batch order.
Paul E. McKenney53954672014-01-17 14:18:05 -0800245 for (b = 1; b <= batch; b++)
246 for (i = 0; i < njobs; i++)
247 if (done[i] == b)
248 print cf[i], cpus[i];
249}'
250
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800251# Generate a script to execute the tests in appropriate batches.
Paul E. McKenney61010e72014-02-07 10:29:49 -0800252cat << ___EOF___ > $T/script
Paul E. McKenney14d9d842014-02-27 20:26:57 -0800253CONFIGFRAG="$CONFIGFRAG"; export CONFIGFRAG
254KVM="$KVM"; export KVM
255KVPATH="$KVPATH"; export KVPATH
256PATH="$PATH"; export PATH
Paul E. McKenneyf189cc82014-03-06 14:44:46 -0800257TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE
Paul E. McKenney14d9d842014-02-27 20:26:57 -0800258TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY
Paul E. McKenney8c55f222014-02-26 14:28:43 -0800259TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG
Paul E. McKenney14d9d842014-02-27 20:26:57 -0800260TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD
261TORTURE_KMAKE_ARG="$TORTURE_KMAKE_ARG"; export TORTURE_KMAKE_ARG
262TORTURE_QEMU_CMD="$TORTURE_QEMU_CMD"; export TORTURE_QEMU_CMD
263TORTURE_QEMU_INTERACTIVE="$TORTURE_QEMU_INTERACTIVE"; export TORTURE_QEMU_INTERACTIVE
264TORTURE_QEMU_MAC="$TORTURE_QEMU_MAC"; export TORTURE_QEMU_MAC
265TORTURE_SUITE="$TORTURE_SUITE"; export TORTURE_SUITE
Paul E. McKenney1f5d0922014-02-27 17:11:11 -0800266if ! test -e $resdir
267then
268 mkdir -p "$resdir" || :
269fi
270mkdir $resdir/$ds
271echo Results directory: $resdir/$ds
272echo $scriptname $args
273touch $resdir/$ds/log
274echo $scriptname $args >> $resdir/$ds/log
275echo ${TORTURE_SUITE} > $resdir/$ds/TORTURE_SUITE
276pwd > $resdir/$ds/testid.txt
277if test -d .git
278then
279 git status >> $resdir/$ds/testid.txt
280 git rev-parse HEAD >> $resdir/$ds/testid.txt
Paul E. McKenney8be7f502014-03-24 13:15:49 -0700281 if ! git diff HEAD > $T/git-diff 2>&1
282 then
283 cp $T/git-diff $resdir/$ds
284 fi
Paul E. McKenney1f5d0922014-02-27 17:11:11 -0800285fi
Paul E. McKenney61010e72014-02-07 10:29:49 -0800286___EOF___
Paul E. McKenney53954672014-01-17 14:18:05 -0800287awk < $T/cfgcpu.pack \
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800288 -v CONFIGDIR="$CONFIGFRAG/$kversion/" \
289 -v KVM="$KVM" \
290 -v ncpus=$cpus \
291 -v rd=$resdir/$ds/ \
292 -v dur=$dur \
Paul E. McKenney06188732014-03-06 13:20:54 -0800293 -v TORTURE_QEMU_ARG="$TORTURE_QEMU_ARG" \
294 -v TORTURE_BOOTARGS="$TORTURE_BOOTARGS" \
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800295'BEGIN {
296 i = 0;
297}
298
299{
300 cf[i] = $1;
301 cpus[i] = $2;
302 i++;
303}
304
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800305# Dump out the scripting required to run one test batch.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800306function dump(first, pastlast)
307{
Paul E. McKenney73fa8672014-02-11 12:16:14 -0800308 print "echo ----Start batch: `date`";
309 print "echo ----Start batch: `date` >> " rd "/log";
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800310 jn=1
311 for (j = first; j < pastlast; j++) {
312 builddir=KVM "/b" jn
Paul E. McKenney0ae3f732014-01-17 03:29:12 -0800313 cpusr[jn] = cpus[j];
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800314 if (cfrep[cf[j]] == "") {
Paul E. McKenney0ae3f732014-01-17 03:29:12 -0800315 cfr[jn] = cf[j];
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800316 cfrep[cf[j]] = 1;
317 } else {
318 cfrep[cf[j]]++;
Paul E. McKenney0ae3f732014-01-17 03:29:12 -0800319 cfr[jn] = cf[j] "." cfrep[cf[j]];
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800320 }
Paul E. McKenneydf1cc812014-01-17 22:08:09 -0800321 if (cpusr[jn] > ncpus && ncpus != 0)
322 ovf = "(!)";
323 else
324 ovf = "";
Paul E. McKenney3c626232014-01-30 15:29:29 -0800325 print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date`";
Paul E. McKenney73fa8672014-02-11 12:16:14 -0800326 print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date` >> " rd "/log";
Paul E. McKenney0ae3f732014-01-17 03:29:12 -0800327 print "rm -f " builddir ".*";
328 print "touch " builddir ".wait";
329 print "mkdir " builddir " > /dev/null 2>&1 || :";
330 print "mkdir " rd cfr[jn] " || :";
Paul E. McKenneyd1b1e512014-02-26 16:42:46 -0800331 print "kvm-test-1-run.sh " CONFIGDIR cf[j], builddir, rd cfr[jn], dur " \"" TORTURE_QEMU_ARG "\" \"" TORTURE_BOOTARGS "\" > " rd cfr[jn] "/kvm-test-1-run.sh.out 2>&1 &"
Paul E. McKenney73fa8672014-02-11 12:16:14 -0800332 print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date`";
333 print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` >> " rd "/log";
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800334 print "while test -f " builddir ".wait"
335 print "do"
336 print "\tsleep 1"
337 print "done"
Paul E. McKenney73fa8672014-02-11 12:16:14 -0800338 print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date`";
339 print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` >> " rd "/log";
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800340 jn++;
341 }
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800342 for (j = 1; j < jn; j++) {
343 builddir=KVM "/b" j
344 print "rm -f " builddir ".ready"
Paul E. McKenney9bee2c62014-04-29 09:53:34 -0700345 print "if test -z \"$TORTURE_BUILDONLY\""
346 print "then"
347 print "\techo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date`";
348 print "\techo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date` >> " rd "/log";
349 print "fi"
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800350 }
351 print "wait"
Paul E. McKenney9bee2c62014-04-29 09:53:34 -0700352 print "if test -z \"$TORTURE_BUILDONLY\""
353 print "then"
354 print "\techo ---- All kernel runs complete. `date`";
355 print "\techo ---- All kernel runs complete. `date` >> " rd "/log";
356 print "fi"
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800357 for (j = 1; j < jn; j++) {
358 builddir=KVM "/b" j
Paul E. McKenney73fa8672014-02-11 12:16:14 -0800359 print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results:";
360 print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results: >> " rd "/log";
361 print "cat " rd cfr[j] "/kvm-test-1-run.sh.out";
362 print "cat " rd cfr[j] "/kvm-test-1-run.sh.out >> " rd "/log";
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800363 }
364}
365
366END {
367 njobs = i;
368 nc = ncpus;
369 first = 0;
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800370
371 # Each pass through the following loop considers one test.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800372 for (i = 0; i < njobs; i++) {
373 if (ncpus == 0) {
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800374 # Sequential test specified, each test its own batch.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800375 dump(i, i + 1);
376 first = i;
377 } else if (nc < cpus[i] && i != 0) {
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800378 # Out of CPUs, dump out a batch.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800379 dump(first, i);
380 first = i;
381 nc = ncpus;
382 }
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800383 # Account for the CPUs needed by the current test.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800384 nc -= cpus[i];
385 }
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800386 # Dump the last batch.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800387 if (ncpus != 0)
388 dump(first, i);
Paul E. McKenney61010e72014-02-07 10:29:49 -0800389}' >> $T/script
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800390
Paul E. McKenney1f5d0922014-02-27 17:11:11 -0800391cat << ___EOF___ >> $T/script
392echo
393echo
394echo " --- `date` Test summary:"
395echo Results directory: $resdir/$ds
Paul E. McKenney9bee2c62014-04-29 09:53:34 -0700396kvm-recheck.sh $resdir/$ds
Paul E. McKenney1f5d0922014-02-27 17:11:11 -0800397___EOF___
398
Paul E. McKenneya7582812014-01-17 03:10:16 -0800399if test "$dryrun" = script
400then
Paul E. McKenneya7582812014-01-17 03:10:16 -0800401 cat $T/script
402 exit 0
403elif test "$dryrun" = sched
404then
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800405 # Extract the test run schedule from the script.
Paul E. McKenney9352ad12014-02-26 09:10:26 -0800406 egrep 'Start batch|Starting build\.' $T/script |
407 grep -v ">>" |
Paul E. McKenneya7582812014-01-17 03:10:16 -0800408 sed -e 's/:.*$//' -e 's/^echo //'
409 exit 0
410else
Paul E. McKenney9bee2c62014-04-29 09:53:34 -0700411 # Not a dryrun, so run the script.
Paul E. McKenneya7582812014-01-17 03:10:16 -0800412 sh $T/script
413fi
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800414
Paul E. McKenney782ab4c2013-10-15 12:11:24 -0700415# Tracing: trace_event=rcu:rcu_grace_period,rcu:rcu_future_grace_period,rcu:rcu_grace_period_init,rcu:rcu_nocb_wake,rcu:rcu_preempt_task,rcu:rcu_unlock_preempted_task,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_kfree_callback,rcu:rcu_batch_start,rcu:rcu_invoke_callback,rcu:rcu_invoke_kfree_callback,rcu:rcu_batch_end,rcu:rcu_torture_read,rcu:rcu_barrier