Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 1 | #!/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 | # |
| 10 | # Usage: sh kvm.sh [ options ] |
| 11 | # |
| 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. McKenney | 0e342a8 | 2013-12-03 09:54:18 -0800 | [diff] [blame] | 23 | # along with this program; if not, you can access it online at |
| 24 | # http://www.gnu.org/licenses/gpl-2.0.html. |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 25 | # |
| 26 | # Copyright (C) IBM Corporation, 2011 |
| 27 | # |
| 28 | # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com> |
| 29 | |
| 30 | scriptname=$0 |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 31 | args="$*" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 32 | |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 33 | T=/tmp/kvm.sh.$$ |
| 34 | trap 'rm -rf $T' 0 |
| 35 | mkdir $T |
| 36 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 37 | dur=30 |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 38 | dryrun="" |
Paul E. McKenney | 73931b5 | 2013-10-15 10:42:25 -0700 | [diff] [blame] | 39 | KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM |
Paul E. McKenney | 32caccb | 2013-10-28 08:57:29 -0700 | [diff] [blame] | 40 | PATH=${KVM}/bin:$PATH; export PATH |
Paul E. McKenney | 73931b5 | 2013-10-15 10:42:25 -0700 | [diff] [blame] | 41 | builddir="${KVM}/b1" |
| 42 | RCU_INITRD="$KVM/initrd"; export RCU_INITRD |
Paul E. McKenney | 74878fb | 2013-10-15 11:51:23 -0700 | [diff] [blame] | 43 | RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 44 | TORTURE_SUITE=rcu |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 45 | resdir="" |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 46 | configs="" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 47 | cpus=0 |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 48 | ds=`date +%Y.%m.%d-%H:%M:%S` |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 49 | kversion="" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 50 | |
Paul E. McKenney | 32caccb | 2013-10-28 08:57:29 -0700 | [diff] [blame] | 51 | . functions.sh |
| 52 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 53 | usage () { |
| 54 | echo "Usage: $scriptname optional arguments:" |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame] | 55 | echo " --bootargs kernel-boot-arguments" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 56 | echo " --builddir absolute-pathname" |
Paul E. McKenney | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 57 | echo " --buildonly" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 58 | echo " --configs \"config-file list\"" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 59 | echo " --cpus N" |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 60 | echo " --datestamp string" |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 61 | echo " --dryrun sched|script" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 62 | echo " --duration minutes" |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 63 | echo " --interactive" |
Paul E. McKenney | 74878fb | 2013-10-15 11:51:23 -0700 | [diff] [blame] | 64 | echo " --kmake-arg kernel-make-arguments" |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 65 | echo " --kversion vN.NN" |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 66 | echo " --mac nn:nn:nn:nn:nn:nn" |
Paul E. McKenney | 73931b5 | 2013-10-15 10:42:25 -0700 | [diff] [blame] | 67 | echo " --no-initrd" |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 68 | echo " --qemu-args qemu-system-..." |
Paul E. McKenney | 4f8a031 | 2013-09-30 17:17:57 -0700 | [diff] [blame] | 69 | echo " --qemu-cmd qemu-system-..." |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 70 | echo " --relbuilddir relative-pathname" |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 71 | echo " --results absolute-pathname" |
| 72 | echo " --torture rcu" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 73 | exit 1 |
| 74 | } |
| 75 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 76 | while test $# -gt 0 |
| 77 | do |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 78 | case "$1" in |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame] | 79 | --bootargs) |
| 80 | checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--' |
| 81 | RCU_BOOTARGS="$2" |
| 82 | shift |
| 83 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 84 | --builddir) |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 85 | checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' '^error' |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 86 | builddir=$2 |
| 87 | gotbuilddir=1 |
| 88 | shift |
| 89 | ;; |
Paul E. McKenney | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 90 | --buildonly) |
| 91 | RCU_BUILDONLY=1; export RCU_BUILDONLY |
| 92 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 93 | --configs) |
| 94 | checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--' |
| 95 | configs="$2" |
| 96 | shift |
| 97 | ;; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 98 | --cpus) |
| 99 | checkarg --cpus "(number)" "$#" "$2" '^[0-9]*$' '^--' |
| 100 | cpus=$2 |
| 101 | shift |
| 102 | ;; |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 103 | --datestamp) |
| 104 | checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' |
| 105 | ds=$2 |
| 106 | shift |
| 107 | ;; |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 108 | --dryrun) |
| 109 | checkarg --dryrun "sched|script" $# "$2" 'sched\|script' '^--' |
| 110 | dryrun=$2 |
| 111 | shift |
| 112 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 113 | --duration) |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 114 | checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error' |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 115 | dur=$2 |
| 116 | shift |
| 117 | ;; |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 118 | --interactive) |
| 119 | RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE |
| 120 | ;; |
Paul E. McKenney | 74878fb | 2013-10-15 11:51:23 -0700 | [diff] [blame] | 121 | --kmake-arg) |
| 122 | checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$' |
| 123 | RCU_KMAKE_ARG="$2"; export RCU_KMAKE_ARG |
| 124 | shift |
| 125 | ;; |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 126 | --kversion) |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 127 | checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' '^error' |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 128 | kversion=$2 |
| 129 | shift |
| 130 | ;; |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 131 | --mac) |
| 132 | checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error |
| 133 | RCU_QEMU_MAC=$2; export RCU_QEMU_MAC |
| 134 | shift |
| 135 | ;; |
Paul E. McKenney | 73931b5 | 2013-10-15 10:42:25 -0700 | [diff] [blame] | 136 | --no-initrd) |
| 137 | RCU_INITRD=""; export RCU_INITRD |
| 138 | ;; |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 139 | --qemu-args) |
| 140 | checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error' |
| 141 | RCU_QEMU_ARG="$2" |
| 142 | shift |
| 143 | ;; |
Paul E. McKenney | 4f8a031 | 2013-09-30 17:17:57 -0700 | [diff] [blame] | 144 | --qemu-cmd) |
| 145 | checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--' |
| 146 | RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD |
| 147 | shift |
| 148 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 149 | --relbuilddir) |
| 150 | checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' |
| 151 | relbuilddir=$2 |
| 152 | gotrelbuilddir=1 |
| 153 | builddir=${KVM}/${relbuilddir} |
| 154 | shift |
| 155 | ;; |
| 156 | --results) |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 157 | checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error' |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 158 | resdir=$2 |
| 159 | shift |
| 160 | ;; |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 161 | --torture) |
Paul E. McKenney | 9dfa5b3 | 2014-02-07 13:56:37 -0800 | [diff] [blame] | 162 | checkarg --torture "(suite name)" "$#" "$2" '^\(lock\|rcu\)$' '^--' |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 163 | TORTURE_SUITE=$2 |
| 164 | shift |
| 165 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 166 | *) |
Paul E. McKenney | 2bcdf4e | 2013-10-01 10:14:09 -0700 | [diff] [blame] | 167 | echo Unknown argument $1 |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 168 | usage |
| 169 | ;; |
| 170 | esac |
| 171 | shift |
| 172 | done |
| 173 | |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 174 | CONFIGFRAG=${KVM}/configs/${TORTURE_SUITE}; export CONFIGFRAG |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 175 | KVPATH=${CONFIGFRAG}/$kversion; export KVPATH |
| 176 | |
| 177 | if test -z "$configs" |
| 178 | then |
| 179 | configs="`cat $CONFIGFRAG/$kversion/CFLIST`" |
| 180 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 181 | |
| 182 | if test -z "$resdir" |
| 183 | then |
| 184 | resdir=$KVM/res |
Paul E. McKenney | daeda23 | 2014-01-27 12:31:20 -0800 | [diff] [blame] | 185 | fi |
| 186 | |
| 187 | if test "$dryrun" = "" |
| 188 | then |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 189 | if ! test -e $resdir |
| 190 | then |
| 191 | mkdir -p "$resdir" || : |
| 192 | fi |
Paul E. McKenney | daeda23 | 2014-01-27 12:31:20 -0800 | [diff] [blame] | 193 | mkdir $resdir/$ds |
| 194 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 195 | # Be noisy only if running the script. |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 196 | echo Results directory: $resdir/$ds |
| 197 | echo $scriptname $args |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 198 | |
Paul E. McKenney | daeda23 | 2014-01-27 12:31:20 -0800 | [diff] [blame] | 199 | touch $resdir/$ds/log |
| 200 | echo $scriptname $args >> $resdir/$ds/log |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 201 | echo ${TORTURE_SUITE} > $resdir/$ds/TORTURE_SUITE |
Paul E. McKenney | daeda23 | 2014-01-27 12:31:20 -0800 | [diff] [blame] | 202 | |
| 203 | pwd > $resdir/$ds/testid.txt |
| 204 | if test -d .git |
| 205 | then |
| 206 | git status >> $resdir/$ds/testid.txt |
| 207 | git rev-parse HEAD >> $resdir/$ds/testid.txt |
| 208 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 209 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 210 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 211 | # Create a file of test-name/#cpus pairs, sorted by decreasing #cpus. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 212 | touch $T/cfgcpu |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 213 | for CF in $configs |
| 214 | do |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 215 | if test -f "$CONFIGFRAG/$kversion/$CF" |
Paul E. McKenney | f43f8f7 | 2013-10-19 06:28:21 -0700 | [diff] [blame] | 216 | then |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 217 | echo $CF `configNR_CPUS.sh $CONFIGFRAG/$kversion/$CF` >> $T/cfgcpu |
| 218 | else |
| 219 | echo "The --configs file $CF does not exist, terminating." |
| 220 | exit 1 |
Paul E. McKenney | f43f8f7 | 2013-10-19 06:28:21 -0700 | [diff] [blame] | 221 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 222 | done |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 223 | sort -k2nr $T/cfgcpu > $T/cfgcpu.sort |
| 224 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 225 | # Use a greedy bin-packing algorithm, sorting the list accordingly. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 226 | awk < $T/cfgcpu.sort > $T/cfgcpu.pack -v ncpus=$cpus ' |
| 227 | BEGIN { |
| 228 | njobs = 0; |
| 229 | } |
| 230 | |
| 231 | { |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 232 | # Read file of tests and corresponding required numbers of CPUs. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 233 | cf[njobs] = $1; |
| 234 | cpus[njobs] = $2; |
| 235 | njobs++; |
| 236 | } |
| 237 | |
| 238 | END { |
| 239 | alldone = 0; |
| 240 | batch = 0; |
| 241 | nc = -1; |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 242 | |
| 243 | # Each pass through the following loop creates on test batch |
| 244 | # that can be executed concurrently given ncpus. Note that a |
| 245 | # given test that requires more than the available CPUs will run in |
| 246 | # their own batch. Such tests just have to make do with what |
| 247 | # is available. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 248 | while (nc != ncpus) { |
| 249 | batch++; |
| 250 | nc = ncpus; |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 251 | |
| 252 | # Each pass through the following loop considers one |
| 253 | # test for inclusion in the current batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 254 | for (i = 0; i < njobs; i++) { |
| 255 | if (done[i]) |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 256 | continue; # Already part of a batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 257 | if (nc >= cpus[i] || nc == ncpus) { |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 258 | |
| 259 | # This test fits into the current batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 260 | done[i] = batch; |
| 261 | nc -= cpus[i]; |
| 262 | if (nc <= 0) |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 263 | break; # Too-big test in its own batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 264 | } |
| 265 | } |
| 266 | } |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 267 | |
| 268 | # Dump out the tests in batch order. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 269 | for (b = 1; b <= batch; b++) |
| 270 | for (i = 0; i < njobs; i++) |
| 271 | if (done[i] == b) |
| 272 | print cf[i], cpus[i]; |
| 273 | }' |
| 274 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 275 | # Generate a script to execute the tests in appropriate batches. |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 276 | cat << ___EOF___ > $T/script |
| 277 | TORTURE_SUITE="$TORTURE_SUITE"; export TORTURE_SUITE |
| 278 | ___EOF___ |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 279 | awk < $T/cfgcpu.pack \ |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 280 | -v CONFIGDIR="$CONFIGFRAG/$kversion/" \ |
| 281 | -v KVM="$KVM" \ |
| 282 | -v ncpus=$cpus \ |
| 283 | -v rd=$resdir/$ds/ \ |
| 284 | -v dur=$dur \ |
| 285 | -v RCU_QEMU_ARG=$RCU_QEMU_ARG \ |
| 286 | -v RCU_BOOTARGS=$RCU_BOOTARGS \ |
| 287 | 'BEGIN { |
| 288 | i = 0; |
| 289 | } |
| 290 | |
| 291 | { |
| 292 | cf[i] = $1; |
| 293 | cpus[i] = $2; |
| 294 | i++; |
| 295 | } |
| 296 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 297 | # Dump out the scripting required to run one test batch. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 298 | function dump(first, pastlast) |
| 299 | { |
Paul E. McKenney | 3c62623 | 2014-01-30 15:29:29 -0800 | [diff] [blame] | 300 | print "echo ----Start batch: `date`" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 301 | jn=1 |
| 302 | for (j = first; j < pastlast; j++) { |
| 303 | builddir=KVM "/b" jn |
Paul E. McKenney | 0ae3f73 | 2014-01-17 03:29:12 -0800 | [diff] [blame] | 304 | cpusr[jn] = cpus[j]; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 305 | if (cfrep[cf[j]] == "") { |
Paul E. McKenney | 0ae3f73 | 2014-01-17 03:29:12 -0800 | [diff] [blame] | 306 | cfr[jn] = cf[j]; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 307 | cfrep[cf[j]] = 1; |
| 308 | } else { |
| 309 | cfrep[cf[j]]++; |
Paul E. McKenney | 0ae3f73 | 2014-01-17 03:29:12 -0800 | [diff] [blame] | 310 | cfr[jn] = cf[j] "." cfrep[cf[j]]; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 311 | } |
Paul E. McKenney | df1cc81 | 2014-01-17 22:08:09 -0800 | [diff] [blame] | 312 | if (cpusr[jn] > ncpus && ncpus != 0) |
| 313 | ovf = "(!)"; |
| 314 | else |
| 315 | ovf = ""; |
Paul E. McKenney | 3c62623 | 2014-01-30 15:29:29 -0800 | [diff] [blame] | 316 | print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date`"; |
Paul E. McKenney | 0ae3f73 | 2014-01-17 03:29:12 -0800 | [diff] [blame] | 317 | print "rm -f " builddir ".*"; |
| 318 | print "touch " builddir ".wait"; |
| 319 | print "mkdir " builddir " > /dev/null 2>&1 || :"; |
| 320 | print "mkdir " rd cfr[jn] " || :"; |
Paul E. McKenney | d3b1548 | 2014-02-06 20:35:41 -0800 | [diff] [blame] | 321 | print "kvm-test-1-run.sh " CONFIGDIR cf[j], builddir, rd cfr[jn], dur " \"" RCU_QEMU_ARG "\" \"" RCU_BOOTARGS "\" > " builddir ".out 2>&1 &" |
Paul E. McKenney | 3c62623 | 2014-01-30 15:29:29 -0800 | [diff] [blame] | 322 | print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date`" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 323 | print "while test -f " builddir ".wait" |
| 324 | print "do" |
| 325 | print "\tsleep 1" |
| 326 | print "done" |
Paul E. McKenney | 3c62623 | 2014-01-30 15:29:29 -0800 | [diff] [blame] | 327 | print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date`" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 328 | jn++; |
| 329 | } |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 330 | for (j = 1; j < jn; j++) { |
| 331 | builddir=KVM "/b" j |
| 332 | print "rm -f " builddir ".ready" |
Paul E. McKenney | 3c62623 | 2014-01-30 15:29:29 -0800 | [diff] [blame] | 333 | print "echo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date`" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 334 | } |
| 335 | print "wait" |
Paul E. McKenney | 3c62623 | 2014-01-30 15:29:29 -0800 | [diff] [blame] | 336 | print "echo ---- All kernel runs complete. `date`" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 337 | for (j = 1; j < jn; j++) { |
| 338 | builddir=KVM "/b" j |
Paul E. McKenney | df1cc81 | 2014-01-17 22:08:09 -0800 | [diff] [blame] | 339 | print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results:" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 340 | print "cat " builddir ".out" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 341 | } |
| 342 | } |
| 343 | |
| 344 | END { |
| 345 | njobs = i; |
| 346 | nc = ncpus; |
| 347 | first = 0; |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 348 | |
| 349 | # Each pass through the following loop considers one test. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 350 | for (i = 0; i < njobs; i++) { |
| 351 | if (ncpus == 0) { |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 352 | # Sequential test specified, each test its own batch. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 353 | dump(i, i + 1); |
| 354 | first = i; |
| 355 | } else if (nc < cpus[i] && i != 0) { |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 356 | # Out of CPUs, dump out a batch. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 357 | dump(first, i); |
| 358 | first = i; |
| 359 | nc = ncpus; |
| 360 | } |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 361 | # Account for the CPUs needed by the current test. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 362 | nc -= cpus[i]; |
| 363 | } |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 364 | # Dump the last batch. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 365 | if (ncpus != 0) |
| 366 | dump(first, i); |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 367 | }' >> $T/script |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 368 | |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 369 | if test "$dryrun" = script |
| 370 | then |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 371 | # Dump out the script, but define the environment variables that |
| 372 | # it needs to run standalone. |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 373 | echo CONFIGFRAG="$CONFIGFRAG; export CONFIGFRAG" |
| 374 | echo KVM="$KVM; export KVM" |
| 375 | echo KVPATH="$KVPATH; export KVPATH" |
| 376 | echo PATH="$PATH; export PATH" |
| 377 | echo RCU_BUILDONLY="$RCU_BUILDONLY; export RCU_BUILDONLY" |
| 378 | echo RCU_INITRD="$RCU_INITRD; export RCU_INITRD" |
| 379 | echo RCU_KMAKE_ARG="$RCU_KMAKE_ARG; export RCU_KMAKE_ARG" |
| 380 | echo RCU_QEMU_CMD="$RCU_QEMU_CMD; export RCU_QEMU_CMD" |
| 381 | echo RCU_QEMU_INTERACTIVE="$RCU_QEMU_INTERACTIVE; export RCU_QEMU_INTERACTIVE" |
| 382 | echo RCU_QEMU_MAC="$RCU_QEMU_MAC; export RCU_QEMU_MAC" |
Paul E. McKenney | daeda23 | 2014-01-27 12:31:20 -0800 | [diff] [blame] | 383 | echo "mkdir -p "$resdir" || :" |
| 384 | echo "mkdir $resdir/$ds" |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 385 | cat $T/script |
| 386 | exit 0 |
| 387 | elif test "$dryrun" = sched |
| 388 | then |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 389 | # Extract the test run schedule from the script. |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 390 | egrep 'start batch|Starting build\.' $T/script | |
| 391 | sed -e 's/:.*$//' -e 's/^echo //' |
| 392 | exit 0 |
| 393 | else |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 394 | # Not a dryru, so run the script. |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 395 | sh $T/script |
| 396 | fi |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 397 | |
Paul E. McKenney | 782ab4c | 2013-10-15 12:11:24 -0700 | [diff] [blame] | 398 | # 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 |
Paul E. McKenney | e136265 | 2013-10-15 12:22:32 -0700 | [diff] [blame] | 399 | |
Paul E. McKenney | ec256c0 | 2014-01-17 22:12:07 -0800 | [diff] [blame] | 400 | echo |
| 401 | echo |
Paul E. McKenney | e136265 | 2013-10-15 12:22:32 -0700 | [diff] [blame] | 402 | echo " --- `date` Test summary:" |
Paul E. McKenney | ec256c0 | 2014-01-17 22:12:07 -0800 | [diff] [blame] | 403 | echo Results directory: $resdir/$ds |
Paul E. McKenney | e136265 | 2013-10-15 12:22:32 -0700 | [diff] [blame] | 404 | kvm-recheck.sh $resdir/$ds |