blob: 36534f9938ca5d91571b7ea1969db743ac83d3a3 [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. McKenney43e38ab2014-01-15 15:48:41 -0800191 echo $CF `configNR_CPUS.sh $CONFIGFRAG/$kversion/$CF` >> $T/cfgcpu
192 else
193 echo "The --configs file $CF does not exist, terminating."
194 exit 1
Paul E. McKenneyf43f8f72013-10-19 06:28:21 -0700195 fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700196done
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800197sort -k2nr $T/cfgcpu > $T/cfgcpu.sort
198
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800199# Use a greedy bin-packing algorithm, sorting the list accordingly.
Paul E. McKenney53954672014-01-17 14:18:05 -0800200awk < $T/cfgcpu.sort > $T/cfgcpu.pack -v ncpus=$cpus '
201BEGIN {
202 njobs = 0;
203}
204
205{
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800206 # Read file of tests and corresponding required numbers of CPUs.
Paul E. McKenney53954672014-01-17 14:18:05 -0800207 cf[njobs] = $1;
208 cpus[njobs] = $2;
209 njobs++;
210}
211
212END {
213 alldone = 0;
214 batch = 0;
215 nc = -1;
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800216
217 # Each pass through the following loop creates on test batch
218 # that can be executed concurrently given ncpus. Note that a
219 # given test that requires more than the available CPUs will run in
220 # their own batch. Such tests just have to make do with what
221 # is available.
Paul E. McKenney53954672014-01-17 14:18:05 -0800222 while (nc != ncpus) {
223 batch++;
224 nc = ncpus;
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800225
226 # Each pass through the following loop considers one
227 # test for inclusion in the current batch.
Paul E. McKenney53954672014-01-17 14:18:05 -0800228 for (i = 0; i < njobs; i++) {
229 if (done[i])
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800230 continue; # Already part of a batch.
Paul E. McKenney53954672014-01-17 14:18:05 -0800231 if (nc >= cpus[i] || nc == ncpus) {
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800232
233 # This test fits into the current batch.
Paul E. McKenney53954672014-01-17 14:18:05 -0800234 done[i] = batch;
235 nc -= cpus[i];
236 if (nc <= 0)
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800237 break; # Too-big test in its own batch.
Paul E. McKenney53954672014-01-17 14:18:05 -0800238 }
239 }
240 }
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800241
242 # Dump out the tests in batch order.
Paul E. McKenney53954672014-01-17 14:18:05 -0800243 for (b = 1; b <= batch; b++)
244 for (i = 0; i < njobs; i++)
245 if (done[i] == b)
246 print cf[i], cpus[i];
247}'
248
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800249# Generate a script to execute the tests in appropriate batches.
Paul E. McKenney61010e72014-02-07 10:29:49 -0800250cat << ___EOF___ > $T/script
Paul E. McKenney14d9d842014-02-27 20:26:57 -0800251CONFIGFRAG="$CONFIGFRAG"; export CONFIGFRAG
252KVM="$KVM"; export KVM
253KVPATH="$KVPATH"; export KVPATH
254PATH="$PATH"; export PATH
Paul E. McKenneyf189cc82014-03-06 14:44:46 -0800255TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE
Paul E. McKenney14d9d842014-02-27 20:26:57 -0800256TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY
Paul E. McKenney8c55f222014-02-26 14:28:43 -0800257TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG
Paul E. McKenney14d9d842014-02-27 20:26:57 -0800258TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD
259TORTURE_KMAKE_ARG="$TORTURE_KMAKE_ARG"; export TORTURE_KMAKE_ARG
260TORTURE_QEMU_CMD="$TORTURE_QEMU_CMD"; export TORTURE_QEMU_CMD
261TORTURE_QEMU_INTERACTIVE="$TORTURE_QEMU_INTERACTIVE"; export TORTURE_QEMU_INTERACTIVE
262TORTURE_QEMU_MAC="$TORTURE_QEMU_MAC"; export TORTURE_QEMU_MAC
263TORTURE_SUITE="$TORTURE_SUITE"; export TORTURE_SUITE
Paul E. McKenney1f5d0922014-02-27 17:11:11 -0800264if ! test -e $resdir
265then
266 mkdir -p "$resdir" || :
267fi
268mkdir $resdir/$ds
269echo Results directory: $resdir/$ds
270echo $scriptname $args
271touch $resdir/$ds/log
272echo $scriptname $args >> $resdir/$ds/log
273echo ${TORTURE_SUITE} > $resdir/$ds/TORTURE_SUITE
274pwd > $resdir/$ds/testid.txt
275if test -d .git
276then
277 git status >> $resdir/$ds/testid.txt
278 git rev-parse HEAD >> $resdir/$ds/testid.txt
Paul E. McKenney8be7f502014-03-24 13:15:49 -0700279 if ! git diff HEAD > $T/git-diff 2>&1
280 then
281 cp $T/git-diff $resdir/$ds
282 fi
Paul E. McKenney1f5d0922014-02-27 17:11:11 -0800283fi
Paul E. McKenney61010e72014-02-07 10:29:49 -0800284___EOF___
Paul E. McKenney53954672014-01-17 14:18:05 -0800285awk < $T/cfgcpu.pack \
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800286 -v CONFIGDIR="$CONFIGFRAG/$kversion/" \
287 -v KVM="$KVM" \
288 -v ncpus=$cpus \
289 -v rd=$resdir/$ds/ \
290 -v dur=$dur \
Paul E. McKenney06188732014-03-06 13:20:54 -0800291 -v TORTURE_QEMU_ARG="$TORTURE_QEMU_ARG" \
292 -v TORTURE_BOOTARGS="$TORTURE_BOOTARGS" \
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800293'BEGIN {
294 i = 0;
295}
296
297{
298 cf[i] = $1;
299 cpus[i] = $2;
300 i++;
301}
302
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800303# Dump out the scripting required to run one test batch.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800304function dump(first, pastlast)
305{
Paul E. McKenney73fa8672014-02-11 12:16:14 -0800306 print "echo ----Start batch: `date`";
307 print "echo ----Start batch: `date` >> " rd "/log";
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800308 jn=1
309 for (j = first; j < pastlast; j++) {
310 builddir=KVM "/b" jn
Paul E. McKenney0ae3f732014-01-17 03:29:12 -0800311 cpusr[jn] = cpus[j];
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800312 if (cfrep[cf[j]] == "") {
Paul E. McKenney0ae3f732014-01-17 03:29:12 -0800313 cfr[jn] = cf[j];
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800314 cfrep[cf[j]] = 1;
315 } else {
316 cfrep[cf[j]]++;
Paul E. McKenney0ae3f732014-01-17 03:29:12 -0800317 cfr[jn] = cf[j] "." cfrep[cf[j]];
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800318 }
Paul E. McKenneydf1cc812014-01-17 22:08:09 -0800319 if (cpusr[jn] > ncpus && ncpus != 0)
320 ovf = "(!)";
321 else
322 ovf = "";
Paul E. McKenney3c626232014-01-30 15:29:29 -0800323 print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date`";
Paul E. McKenney73fa8672014-02-11 12:16:14 -0800324 print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date` >> " rd "/log";
Paul E. McKenney0ae3f732014-01-17 03:29:12 -0800325 print "rm -f " builddir ".*";
326 print "touch " builddir ".wait";
327 print "mkdir " builddir " > /dev/null 2>&1 || :";
328 print "mkdir " rd cfr[jn] " || :";
Paul E. McKenneyd1b1e512014-02-26 16:42:46 -0800329 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 -0800330 print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date`";
331 print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` >> " rd "/log";
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800332 print "while test -f " builddir ".wait"
333 print "do"
334 print "\tsleep 1"
335 print "done"
Paul E. McKenney73fa8672014-02-11 12:16:14 -0800336 print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date`";
337 print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` >> " rd "/log";
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800338 jn++;
339 }
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800340 for (j = 1; j < jn; j++) {
341 builddir=KVM "/b" j
342 print "rm -f " builddir ".ready"
Paul E. McKenney9bee2c62014-04-29 09:53:34 -0700343 print "if test -z \"$TORTURE_BUILDONLY\""
344 print "then"
345 print "\techo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date`";
346 print "\techo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date` >> " rd "/log";
347 print "fi"
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800348 }
349 print "wait"
Paul E. McKenney9bee2c62014-04-29 09:53:34 -0700350 print "if test -z \"$TORTURE_BUILDONLY\""
351 print "then"
352 print "\techo ---- All kernel runs complete. `date`";
353 print "\techo ---- All kernel runs complete. `date` >> " rd "/log";
354 print "fi"
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800355 for (j = 1; j < jn; j++) {
356 builddir=KVM "/b" j
Paul E. McKenney73fa8672014-02-11 12:16:14 -0800357 print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results:";
358 print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results: >> " rd "/log";
359 print "cat " rd cfr[j] "/kvm-test-1-run.sh.out";
360 print "cat " rd cfr[j] "/kvm-test-1-run.sh.out >> " rd "/log";
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800361 }
362}
363
364END {
365 njobs = i;
366 nc = ncpus;
367 first = 0;
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800368
369 # Each pass through the following loop considers one test.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800370 for (i = 0; i < njobs; i++) {
371 if (ncpus == 0) {
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800372 # Sequential test specified, each test its own batch.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800373 dump(i, i + 1);
374 first = i;
375 } else if (nc < cpus[i] && i != 0) {
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800376 # Out of CPUs, dump out a batch.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800377 dump(first, i);
378 first = i;
379 nc = ncpus;
380 }
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800381 # Account for the CPUs needed by the current test.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800382 nc -= cpus[i];
383 }
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800384 # Dump the last batch.
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800385 if (ncpus != 0)
386 dump(first, i);
Paul E. McKenney61010e72014-02-07 10:29:49 -0800387}' >> $T/script
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800388
Paul E. McKenney1f5d0922014-02-27 17:11:11 -0800389cat << ___EOF___ >> $T/script
390echo
391echo
392echo " --- `date` Test summary:"
393echo Results directory: $resdir/$ds
Paul E. McKenney9bee2c62014-04-29 09:53:34 -0700394kvm-recheck.sh $resdir/$ds
Paul E. McKenney1f5d0922014-02-27 17:11:11 -0800395___EOF___
396
Paul E. McKenneya7582812014-01-17 03:10:16 -0800397if test "$dryrun" = script
398then
Paul E. McKenneya7582812014-01-17 03:10:16 -0800399 cat $T/script
400 exit 0
401elif test "$dryrun" = sched
402then
Paul E. McKenney78ad0692014-01-17 21:56:57 -0800403 # Extract the test run schedule from the script.
Paul E. McKenney9352ad12014-02-26 09:10:26 -0800404 egrep 'Start batch|Starting build\.' $T/script |
405 grep -v ">>" |
Paul E. McKenneya7582812014-01-17 03:10:16 -0800406 sed -e 's/:.*$//' -e 's/^echo //'
407 exit 0
408else
Paul E. McKenney9bee2c62014-04-29 09:53:34 -0700409 # Not a dryrun, so run the script.
Paul E. McKenneya7582812014-01-17 03:10:16 -0800410 sh $T/script
411fi
Paul E. McKenney43e38ab2014-01-15 15:48:41 -0800412
Paul E. McKenney782ab4c2013-10-15 12:11:24 -0700413# 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