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 | 8c55f22 | 2014-02-26 14:28:43 -0800 | [diff] [blame] | 41 | TORTURE_DEFCONFIG=defconfig |
Paul E. McKenney | 2f66dbc | 2014-02-26 11:16:07 -0800 | [diff] [blame] | 42 | TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD |
Paul E. McKenney | 58d280b | 2014-02-26 15:23:21 -0800 | [diff] [blame] | 43 | TORTURE_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 | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 56 | echo " --buildonly" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 57 | echo " --configs \"config-file list\"" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 58 | echo " --cpus N" |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 59 | echo " --datestamp string" |
Paul E. McKenney | 8c55f22 | 2014-02-26 14:28:43 -0800 | [diff] [blame] | 60 | echo " --defconfig 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 | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 70 | echo " --results absolute-pathname" |
| 71 | echo " --torture rcu" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 72 | exit 1 |
| 73 | } |
| 74 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 75 | while test $# -gt 0 |
| 76 | do |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 77 | case "$1" in |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame] | 78 | --bootargs) |
| 79 | checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--' |
Paul E. McKenney | 98bc8cc | 2014-02-26 15:28:53 -0800 | [diff] [blame] | 80 | TORTURE_BOOTARGS="$2" |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame] | 81 | shift |
| 82 | ;; |
Paul E. McKenney | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 83 | --buildonly) |
Paul E. McKenney | 805ffee | 2014-02-26 15:39:41 -0800 | [diff] [blame] | 84 | TORTURE_BUILDONLY=1 |
Paul E. McKenney | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 85 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 86 | --configs) |
| 87 | checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--' |
| 88 | configs="$2" |
| 89 | shift |
| 90 | ;; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 91 | --cpus) |
| 92 | checkarg --cpus "(number)" "$#" "$2" '^[0-9]*$' '^--' |
| 93 | cpus=$2 |
| 94 | shift |
| 95 | ;; |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 96 | --datestamp) |
| 97 | checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' |
| 98 | ds=$2 |
| 99 | shift |
| 100 | ;; |
Paul E. McKenney | 8c55f22 | 2014-02-26 14:28:43 -0800 | [diff] [blame] | 101 | --defconfig) |
| 102 | checkarg --defconfig "defconfigtype" "$#" "$2" '^[^/][^/]*$' '^--' |
| 103 | TORTURE_DEFCONFIG=$2 |
| 104 | shift |
| 105 | ;; |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 106 | --dryrun) |
| 107 | checkarg --dryrun "sched|script" $# "$2" 'sched\|script' '^--' |
| 108 | dryrun=$2 |
| 109 | shift |
| 110 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 111 | --duration) |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 112 | checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error' |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 113 | dur=$2 |
| 114 | shift |
| 115 | ;; |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 116 | --interactive) |
Paul E. McKenney | a0edd47 | 2014-02-26 16:38:52 -0800 | [diff] [blame^] | 117 | TORTURE_QEMU_INTERACTIVE=1; export TORTURE_QEMU_INTERACTIVE |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 118 | ;; |
Paul E. McKenney | 74878fb | 2013-10-15 11:51:23 -0700 | [diff] [blame] | 119 | --kmake-arg) |
| 120 | checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$' |
Paul E. McKenney | 58d280b | 2014-02-26 15:23:21 -0800 | [diff] [blame] | 121 | TORTURE_KMAKE_ARG="$2" |
Paul E. McKenney | 74878fb | 2013-10-15 11:51:23 -0700 | [diff] [blame] | 122 | shift |
| 123 | ;; |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 124 | --kversion) |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 125 | checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' '^error' |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 126 | kversion=$2 |
| 127 | shift |
| 128 | ;; |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 129 | --mac) |
| 130 | checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error |
| 131 | RCU_QEMU_MAC=$2; export RCU_QEMU_MAC |
| 132 | shift |
| 133 | ;; |
Paul E. McKenney | 73931b5 | 2013-10-15 10:42:25 -0700 | [diff] [blame] | 134 | --no-initrd) |
Paul E. McKenney | 2f66dbc | 2014-02-26 11:16:07 -0800 | [diff] [blame] | 135 | TORTURE_INITRD=""; export TORTURE_INITRD |
Paul E. McKenney | 73931b5 | 2013-10-15 10:42:25 -0700 | [diff] [blame] | 136 | ;; |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 137 | --qemu-args) |
| 138 | checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error' |
| 139 | RCU_QEMU_ARG="$2" |
| 140 | shift |
| 141 | ;; |
Paul E. McKenney | 4f8a031 | 2013-09-30 17:17:57 -0700 | [diff] [blame] | 142 | --qemu-cmd) |
| 143 | checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--' |
| 144 | RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD |
| 145 | shift |
| 146 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 147 | --results) |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 148 | checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error' |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 149 | resdir=$2 |
| 150 | shift |
| 151 | ;; |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 152 | --torture) |
Paul E. McKenney | 9dfa5b3 | 2014-02-07 13:56:37 -0800 | [diff] [blame] | 153 | checkarg --torture "(suite name)" "$#" "$2" '^\(lock\|rcu\)$' '^--' |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 154 | TORTURE_SUITE=$2 |
| 155 | shift |
| 156 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 157 | *) |
Paul E. McKenney | 2bcdf4e | 2013-10-01 10:14:09 -0700 | [diff] [blame] | 158 | echo Unknown argument $1 |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 159 | usage |
| 160 | ;; |
| 161 | esac |
| 162 | shift |
| 163 | done |
| 164 | |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 165 | CONFIGFRAG=${KVM}/configs/${TORTURE_SUITE}; export CONFIGFRAG |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 166 | KVPATH=${CONFIGFRAG}/$kversion; export KVPATH |
| 167 | |
| 168 | if test -z "$configs" |
| 169 | then |
| 170 | configs="`cat $CONFIGFRAG/$kversion/CFLIST`" |
| 171 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 172 | |
| 173 | if test -z "$resdir" |
| 174 | then |
| 175 | resdir=$KVM/res |
Paul E. McKenney | daeda23 | 2014-01-27 12:31:20 -0800 | [diff] [blame] | 176 | fi |
| 177 | |
| 178 | if test "$dryrun" = "" |
| 179 | then |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 180 | if ! test -e $resdir |
| 181 | then |
| 182 | mkdir -p "$resdir" || : |
| 183 | fi |
Paul E. McKenney | daeda23 | 2014-01-27 12:31:20 -0800 | [diff] [blame] | 184 | mkdir $resdir/$ds |
| 185 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 186 | # Be noisy only if running the script. |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 187 | echo Results directory: $resdir/$ds |
| 188 | echo $scriptname $args |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 189 | |
Paul E. McKenney | daeda23 | 2014-01-27 12:31:20 -0800 | [diff] [blame] | 190 | touch $resdir/$ds/log |
| 191 | echo $scriptname $args >> $resdir/$ds/log |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 192 | echo ${TORTURE_SUITE} > $resdir/$ds/TORTURE_SUITE |
Paul E. McKenney | daeda23 | 2014-01-27 12:31:20 -0800 | [diff] [blame] | 193 | |
| 194 | pwd > $resdir/$ds/testid.txt |
| 195 | if test -d .git |
| 196 | then |
| 197 | git status >> $resdir/$ds/testid.txt |
| 198 | git rev-parse HEAD >> $resdir/$ds/testid.txt |
| 199 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 200 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 201 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 202 | # 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] | 203 | touch $T/cfgcpu |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 204 | for CF in $configs |
| 205 | do |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 206 | if test -f "$CONFIGFRAG/$kversion/$CF" |
Paul E. McKenney | f43f8f7 | 2013-10-19 06:28:21 -0700 | [diff] [blame] | 207 | then |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 208 | echo $CF `configNR_CPUS.sh $CONFIGFRAG/$kversion/$CF` >> $T/cfgcpu |
| 209 | else |
| 210 | echo "The --configs file $CF does not exist, terminating." |
| 211 | exit 1 |
Paul E. McKenney | f43f8f7 | 2013-10-19 06:28:21 -0700 | [diff] [blame] | 212 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 213 | done |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 214 | sort -k2nr $T/cfgcpu > $T/cfgcpu.sort |
| 215 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 216 | # Use a greedy bin-packing algorithm, sorting the list accordingly. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 217 | awk < $T/cfgcpu.sort > $T/cfgcpu.pack -v ncpus=$cpus ' |
| 218 | BEGIN { |
| 219 | njobs = 0; |
| 220 | } |
| 221 | |
| 222 | { |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 223 | # Read file of tests and corresponding required numbers of CPUs. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 224 | cf[njobs] = $1; |
| 225 | cpus[njobs] = $2; |
| 226 | njobs++; |
| 227 | } |
| 228 | |
| 229 | END { |
| 230 | alldone = 0; |
| 231 | batch = 0; |
| 232 | nc = -1; |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 233 | |
| 234 | # Each pass through the following loop creates on test batch |
| 235 | # that can be executed concurrently given ncpus. Note that a |
| 236 | # given test that requires more than the available CPUs will run in |
| 237 | # their own batch. Such tests just have to make do with what |
| 238 | # is available. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 239 | while (nc != ncpus) { |
| 240 | batch++; |
| 241 | nc = ncpus; |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 242 | |
| 243 | # Each pass through the following loop considers one |
| 244 | # test for inclusion in the current batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 245 | for (i = 0; i < njobs; i++) { |
| 246 | if (done[i]) |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 247 | continue; # Already part of a batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 248 | if (nc >= cpus[i] || nc == ncpus) { |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 249 | |
| 250 | # This test fits into the current batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 251 | done[i] = batch; |
| 252 | nc -= cpus[i]; |
| 253 | if (nc <= 0) |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 254 | break; # Too-big test in its own batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 255 | } |
| 256 | } |
| 257 | } |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 258 | |
| 259 | # Dump out the tests in batch order. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 260 | for (b = 1; b <= batch; b++) |
| 261 | for (i = 0; i < njobs; i++) |
| 262 | if (done[i] == b) |
| 263 | print cf[i], cpus[i]; |
| 264 | }' |
| 265 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 266 | # Generate a script to execute the tests in appropriate batches. |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 267 | cat << ___EOF___ > $T/script |
| 268 | TORTURE_SUITE="$TORTURE_SUITE"; export TORTURE_SUITE |
Paul E. McKenney | 8c55f22 | 2014-02-26 14:28:43 -0800 | [diff] [blame] | 269 | TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 270 | ___EOF___ |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 271 | awk < $T/cfgcpu.pack \ |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 272 | -v CONFIGDIR="$CONFIGFRAG/$kversion/" \ |
| 273 | -v KVM="$KVM" \ |
| 274 | -v ncpus=$cpus \ |
| 275 | -v rd=$resdir/$ds/ \ |
| 276 | -v dur=$dur \ |
| 277 | -v RCU_QEMU_ARG=$RCU_QEMU_ARG \ |
Paul E. McKenney | 98bc8cc | 2014-02-26 15:28:53 -0800 | [diff] [blame] | 278 | -v TORTURE_BOOTARGS=$TORTURE_BOOTARGS \ |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 279 | 'BEGIN { |
| 280 | i = 0; |
| 281 | } |
| 282 | |
| 283 | { |
| 284 | cf[i] = $1; |
| 285 | cpus[i] = $2; |
| 286 | i++; |
| 287 | } |
| 288 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 289 | # Dump out the scripting required to run one test batch. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 290 | function dump(first, pastlast) |
| 291 | { |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 292 | print "echo ----Start batch: `date`"; |
| 293 | print "echo ----Start batch: `date` >> " rd "/log"; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 294 | jn=1 |
| 295 | for (j = first; j < pastlast; j++) { |
| 296 | builddir=KVM "/b" jn |
Paul E. McKenney | 0ae3f73 | 2014-01-17 03:29:12 -0800 | [diff] [blame] | 297 | cpusr[jn] = cpus[j]; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 298 | if (cfrep[cf[j]] == "") { |
Paul E. McKenney | 0ae3f73 | 2014-01-17 03:29:12 -0800 | [diff] [blame] | 299 | cfr[jn] = cf[j]; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 300 | cfrep[cf[j]] = 1; |
| 301 | } else { |
| 302 | cfrep[cf[j]]++; |
Paul E. McKenney | 0ae3f73 | 2014-01-17 03:29:12 -0800 | [diff] [blame] | 303 | cfr[jn] = cf[j] "." cfrep[cf[j]]; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 304 | } |
Paul E. McKenney | df1cc81 | 2014-01-17 22:08:09 -0800 | [diff] [blame] | 305 | if (cpusr[jn] > ncpus && ncpus != 0) |
| 306 | ovf = "(!)"; |
| 307 | else |
| 308 | ovf = ""; |
Paul E. McKenney | 3c62623 | 2014-01-30 15:29:29 -0800 | [diff] [blame] | 309 | print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date`"; |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 310 | print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date` >> " rd "/log"; |
Paul E. McKenney | 0ae3f73 | 2014-01-17 03:29:12 -0800 | [diff] [blame] | 311 | print "rm -f " builddir ".*"; |
| 312 | print "touch " builddir ".wait"; |
| 313 | print "mkdir " builddir " > /dev/null 2>&1 || :"; |
| 314 | print "mkdir " rd cfr[jn] " || :"; |
Paul E. McKenney | 98bc8cc | 2014-02-26 15:28:53 -0800 | [diff] [blame] | 315 | print "kvm-test-1-run.sh " CONFIGDIR cf[j], builddir, rd cfr[jn], dur " \"" RCU_QEMU_ARG "\" \"" TORTURE_BOOTARGS "\" > " rd cfr[jn] "/kvm-test-1-run.sh.out 2>&1 &" |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 316 | print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date`"; |
| 317 | print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` >> " rd "/log"; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 318 | print "while test -f " builddir ".wait" |
| 319 | print "do" |
| 320 | print "\tsleep 1" |
| 321 | print "done" |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 322 | print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date`"; |
| 323 | print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` >> " rd "/log"; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 324 | jn++; |
| 325 | } |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 326 | for (j = 1; j < jn; j++) { |
| 327 | builddir=KVM "/b" j |
| 328 | print "rm -f " builddir ".ready" |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 329 | print "echo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date`"; |
| 330 | print "echo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date` >> " rd "/log"; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 331 | } |
| 332 | print "wait" |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 333 | print "echo ---- All kernel runs complete. `date`"; |
| 334 | print "echo ---- All kernel runs complete. `date` >> " rd "/log"; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 335 | for (j = 1; j < jn; j++) { |
| 336 | builddir=KVM "/b" j |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 337 | print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results:"; |
| 338 | print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results: >> " rd "/log"; |
| 339 | print "cat " rd cfr[j] "/kvm-test-1-run.sh.out"; |
| 340 | print "cat " rd cfr[j] "/kvm-test-1-run.sh.out >> " rd "/log"; |
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" |
Paul E. McKenney | 805ffee | 2014-02-26 15:39:41 -0800 | [diff] [blame] | 377 | echo TORTURE_BUILDONLY="$TORTURE_BUILDONLY; export TORTURE_BUILDONLY" |
Paul E. McKenney | 2f66dbc | 2014-02-26 11:16:07 -0800 | [diff] [blame] | 378 | echo TORTURE_INITRD="$TORTURE_INITRD; export TORTURE_INITRD" |
Paul E. McKenney | 58d280b | 2014-02-26 15:23:21 -0800 | [diff] [blame] | 379 | echo TORTURE_KMAKE_ARG="$TORTURE_KMAKE_ARG; export TORTURE_KMAKE_ARG" |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 380 | echo RCU_QEMU_CMD="$RCU_QEMU_CMD; export RCU_QEMU_CMD" |
Paul E. McKenney | a0edd47 | 2014-02-26 16:38:52 -0800 | [diff] [blame^] | 381 | echo TORTURE_QEMU_INTERACTIVE="$TORTURE_QEMU_INTERACTIVE; export TORTURE_QEMU_INTERACTIVE" |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 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 | 9352ad1 | 2014-02-26 09:10:26 -0800 | [diff] [blame] | 390 | egrep 'Start batch|Starting build\.' $T/script | |
| 391 | grep -v ">>" | |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 392 | sed -e 's/:.*$//' -e 's/^echo //' |
| 393 | exit 0 |
| 394 | else |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 395 | # Not a dryru, so run the script. |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 396 | sh $T/script |
| 397 | fi |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 398 | |
Paul E. McKenney | 782ab4c | 2013-10-15 12:11:24 -0700 | [diff] [blame] | 399 | # 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] | 400 | |
Paul E. McKenney | ec256c0 | 2014-01-17 22:12:07 -0800 | [diff] [blame] | 401 | echo |
| 402 | echo |
Paul E. McKenney | e136265 | 2013-10-15 12:22:32 -0700 | [diff] [blame] | 403 | echo " --- `date` Test summary:" |
Paul E. McKenney | ec256c0 | 2014-01-17 22:12:07 -0800 | [diff] [blame] | 404 | echo Results directory: $resdir/$ds |
Paul E. McKenney | 805ffee | 2014-02-26 15:39:41 -0800 | [diff] [blame] | 405 | if test -n "$TORTURE_BUILDONLY" |
| 406 | then |
| 407 | kvm-recheck.sh $resdir/$ds |
| 408 | fi |