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 | f189cc8 | 2014-03-06 14:44:46 -0800 | [diff] [blame] | 42 | TORTURE_BOOT_IMAGE="" |
Paul E. McKenney | 2f66dbc | 2014-02-26 11:16:07 -0800 | [diff] [blame] | 43 | TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD |
Paul E. McKenney | 58d280b | 2014-02-26 15:23:21 -0800 | [diff] [blame] | 44 | TORTURE_KMAKE_ARG="" |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 45 | TORTURE_SUITE=rcu |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 46 | resdir="" |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 47 | configs="" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 48 | cpus=0 |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 49 | ds=`date +%Y.%m.%d-%H:%M:%S` |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 50 | kversion="" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 51 | |
Paul E. McKenney | 32caccb | 2013-10-28 08:57:29 -0700 | [diff] [blame] | 52 | . functions.sh |
| 53 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 54 | usage () { |
| 55 | echo "Usage: $scriptname optional arguments:" |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame] | 56 | echo " --bootargs kernel-boot-arguments" |
Paul E. McKenney | f189cc8 | 2014-03-06 14:44:46 -0800 | [diff] [blame] | 57 | echo " --bootimage relative-path-to-kernel-boot-image" |
Paul E. McKenney | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 58 | echo " --buildonly" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 59 | echo " --configs \"config-file list\"" |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 60 | echo " --cpus N" |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 61 | echo " --datestamp string" |
Paul E. McKenney | 8c55f22 | 2014-02-26 14:28:43 -0800 | [diff] [blame] | 62 | echo " --defconfig string" |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 63 | echo " --dryrun sched|script" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 64 | echo " --duration minutes" |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 65 | echo " --interactive" |
Paul E. McKenney | 74878fb | 2013-10-15 11:51:23 -0700 | [diff] [blame] | 66 | echo " --kmake-arg kernel-make-arguments" |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 67 | echo " --kversion vN.NN" |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 68 | echo " --mac nn:nn:nn:nn:nn:nn" |
Paul E. McKenney | 73931b5 | 2013-10-15 10:42:25 -0700 | [diff] [blame] | 69 | echo " --no-initrd" |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 70 | echo " --qemu-args qemu-system-..." |
Paul E. McKenney | 4f8a031 | 2013-09-30 17:17:57 -0700 | [diff] [blame] | 71 | echo " --qemu-cmd qemu-system-..." |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 72 | echo " --results absolute-pathname" |
| 73 | echo " --torture rcu" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 74 | exit 1 |
| 75 | } |
| 76 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 77 | while test $# -gt 0 |
| 78 | do |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 79 | case "$1" in |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame] | 80 | --bootargs) |
| 81 | checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--' |
Paul E. McKenney | 98bc8cc | 2014-02-26 15:28:53 -0800 | [diff] [blame] | 82 | TORTURE_BOOTARGS="$2" |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame] | 83 | shift |
| 84 | ;; |
Paul E. McKenney | f189cc8 | 2014-03-06 14:44:46 -0800 | [diff] [blame] | 85 | --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. McKenney | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 90 | --buildonly) |
Paul E. McKenney | 805ffee | 2014-02-26 15:39:41 -0800 | [diff] [blame] | 91 | TORTURE_BUILDONLY=1 |
Paul E. McKenney | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 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 | 8c55f22 | 2014-02-26 14:28:43 -0800 | [diff] [blame] | 108 | --defconfig) |
| 109 | checkarg --defconfig "defconfigtype" "$#" "$2" '^[^/][^/]*$' '^--' |
| 110 | TORTURE_DEFCONFIG=$2 |
| 111 | shift |
| 112 | ;; |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 113 | --dryrun) |
| 114 | checkarg --dryrun "sched|script" $# "$2" 'sched\|script' '^--' |
| 115 | dryrun=$2 |
| 116 | shift |
| 117 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 118 | --duration) |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 119 | checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error' |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 120 | dur=$2 |
| 121 | shift |
| 122 | ;; |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 123 | --interactive) |
Paul E. McKenney | a0edd47 | 2014-02-26 16:38:52 -0800 | [diff] [blame] | 124 | TORTURE_QEMU_INTERACTIVE=1; export TORTURE_QEMU_INTERACTIVE |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 125 | ;; |
Paul E. McKenney | 74878fb | 2013-10-15 11:51:23 -0700 | [diff] [blame] | 126 | --kmake-arg) |
| 127 | checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$' |
Paul E. McKenney | 58d280b | 2014-02-26 15:23:21 -0800 | [diff] [blame] | 128 | TORTURE_KMAKE_ARG="$2" |
Paul E. McKenney | 74878fb | 2013-10-15 11:51:23 -0700 | [diff] [blame] | 129 | shift |
| 130 | ;; |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 131 | --kversion) |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 132 | checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' '^error' |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 133 | kversion=$2 |
| 134 | shift |
| 135 | ;; |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 136 | --mac) |
| 137 | checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error |
Paul E. McKenney | 58f724f | 2014-02-26 16:41:18 -0800 | [diff] [blame] | 138 | TORTURE_QEMU_MAC=$2 |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 139 | shift |
| 140 | ;; |
Paul E. McKenney | 73931b5 | 2013-10-15 10:42:25 -0700 | [diff] [blame] | 141 | --no-initrd) |
Paul E. McKenney | 2f66dbc | 2014-02-26 11:16:07 -0800 | [diff] [blame] | 142 | TORTURE_INITRD=""; export TORTURE_INITRD |
Paul E. McKenney | 73931b5 | 2013-10-15 10:42:25 -0700 | [diff] [blame] | 143 | ;; |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 144 | --qemu-args) |
| 145 | checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error' |
Paul E. McKenney | d1b1e51 | 2014-02-26 16:42:46 -0800 | [diff] [blame] | 146 | TORTURE_QEMU_ARG="$2" |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 147 | shift |
| 148 | ;; |
Paul E. McKenney | 4f8a031 | 2013-09-30 17:17:57 -0700 | [diff] [blame] | 149 | --qemu-cmd) |
| 150 | checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--' |
Paul E. McKenney | 250da31 | 2014-02-26 16:44:26 -0800 | [diff] [blame] | 151 | TORTURE_QEMU_CMD="$2" |
Paul E. McKenney | 4f8a031 | 2013-09-30 17:17:57 -0700 | [diff] [blame] | 152 | shift |
| 153 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 154 | --results) |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 155 | checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error' |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 156 | resdir=$2 |
| 157 | shift |
| 158 | ;; |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 159 | --torture) |
Paul E. McKenney | 9dfa5b3 | 2014-02-07 13:56:37 -0800 | [diff] [blame] | 160 | checkarg --torture "(suite name)" "$#" "$2" '^\(lock\|rcu\)$' '^--' |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 161 | TORTURE_SUITE=$2 |
| 162 | shift |
| 163 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 164 | *) |
Paul E. McKenney | 2bcdf4e | 2013-10-01 10:14:09 -0700 | [diff] [blame] | 165 | echo Unknown argument $1 |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 166 | usage |
| 167 | ;; |
| 168 | esac |
| 169 | shift |
| 170 | done |
| 171 | |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 172 | CONFIGFRAG=${KVM}/configs/${TORTURE_SUITE}; export CONFIGFRAG |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 173 | KVPATH=${CONFIGFRAG}/$kversion; export KVPATH |
| 174 | |
| 175 | if test -z "$configs" |
| 176 | then |
| 177 | configs="`cat $CONFIGFRAG/$kversion/CFLIST`" |
| 178 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 179 | |
| 180 | if test -z "$resdir" |
| 181 | then |
| 182 | resdir=$KVM/res |
Paul E. McKenney | daeda23 | 2014-01-27 12:31:20 -0800 | [diff] [blame] | 183 | fi |
| 184 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 185 | # 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] | 186 | touch $T/cfgcpu |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 187 | for CF in $configs |
| 188 | do |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 189 | if test -f "$CONFIGFRAG/$kversion/$CF" |
Paul E. McKenney | f43f8f7 | 2013-10-19 06:28:21 -0700 | [diff] [blame] | 190 | then |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 191 | 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. McKenney | f43f8f7 | 2013-10-19 06:28:21 -0700 | [diff] [blame] | 195 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 196 | done |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 197 | sort -k2nr $T/cfgcpu > $T/cfgcpu.sort |
| 198 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 199 | # Use a greedy bin-packing algorithm, sorting the list accordingly. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 200 | awk < $T/cfgcpu.sort > $T/cfgcpu.pack -v ncpus=$cpus ' |
| 201 | BEGIN { |
| 202 | njobs = 0; |
| 203 | } |
| 204 | |
| 205 | { |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 206 | # Read file of tests and corresponding required numbers of CPUs. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 207 | cf[njobs] = $1; |
| 208 | cpus[njobs] = $2; |
| 209 | njobs++; |
| 210 | } |
| 211 | |
| 212 | END { |
| 213 | alldone = 0; |
| 214 | batch = 0; |
| 215 | nc = -1; |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 216 | |
| 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. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 222 | while (nc != ncpus) { |
| 223 | batch++; |
| 224 | nc = ncpus; |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 225 | |
| 226 | # Each pass through the following loop considers one |
| 227 | # test for inclusion in the current batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 228 | for (i = 0; i < njobs; i++) { |
| 229 | if (done[i]) |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 230 | continue; # Already part of a batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 231 | if (nc >= cpus[i] || nc == ncpus) { |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 232 | |
| 233 | # This test fits into the current batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 234 | done[i] = batch; |
| 235 | nc -= cpus[i]; |
| 236 | if (nc <= 0) |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 237 | break; # Too-big test in its own batch. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 238 | } |
| 239 | } |
| 240 | } |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 241 | |
| 242 | # Dump out the tests in batch order. |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 243 | 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. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 249 | # Generate a script to execute the tests in appropriate batches. |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 250 | cat << ___EOF___ > $T/script |
Paul E. McKenney | 14d9d84 | 2014-02-27 20:26:57 -0800 | [diff] [blame] | 251 | CONFIGFRAG="$CONFIGFRAG"; export CONFIGFRAG |
| 252 | KVM="$KVM"; export KVM |
| 253 | KVPATH="$KVPATH"; export KVPATH |
| 254 | PATH="$PATH"; export PATH |
Paul E. McKenney | f189cc8 | 2014-03-06 14:44:46 -0800 | [diff] [blame] | 255 | TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE |
Paul E. McKenney | 14d9d84 | 2014-02-27 20:26:57 -0800 | [diff] [blame] | 256 | TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY |
Paul E. McKenney | 8c55f22 | 2014-02-26 14:28:43 -0800 | [diff] [blame] | 257 | TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG |
Paul E. McKenney | 14d9d84 | 2014-02-27 20:26:57 -0800 | [diff] [blame] | 258 | TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD |
| 259 | TORTURE_KMAKE_ARG="$TORTURE_KMAKE_ARG"; export TORTURE_KMAKE_ARG |
| 260 | TORTURE_QEMU_CMD="$TORTURE_QEMU_CMD"; export TORTURE_QEMU_CMD |
| 261 | TORTURE_QEMU_INTERACTIVE="$TORTURE_QEMU_INTERACTIVE"; export TORTURE_QEMU_INTERACTIVE |
| 262 | TORTURE_QEMU_MAC="$TORTURE_QEMU_MAC"; export TORTURE_QEMU_MAC |
| 263 | TORTURE_SUITE="$TORTURE_SUITE"; export TORTURE_SUITE |
Paul E. McKenney | 1f5d092 | 2014-02-27 17:11:11 -0800 | [diff] [blame] | 264 | if ! test -e $resdir |
| 265 | then |
| 266 | mkdir -p "$resdir" || : |
| 267 | fi |
| 268 | mkdir $resdir/$ds |
| 269 | echo Results directory: $resdir/$ds |
| 270 | echo $scriptname $args |
| 271 | touch $resdir/$ds/log |
| 272 | echo $scriptname $args >> $resdir/$ds/log |
| 273 | echo ${TORTURE_SUITE} > $resdir/$ds/TORTURE_SUITE |
| 274 | pwd > $resdir/$ds/testid.txt |
| 275 | if test -d .git |
| 276 | then |
| 277 | git status >> $resdir/$ds/testid.txt |
| 278 | git rev-parse HEAD >> $resdir/$ds/testid.txt |
Paul E. McKenney | 8be7f50 | 2014-03-24 13:15:49 -0700 | [diff] [blame] | 279 | if ! git diff HEAD > $T/git-diff 2>&1 |
| 280 | then |
| 281 | cp $T/git-diff $resdir/$ds |
| 282 | fi |
Paul E. McKenney | 1f5d092 | 2014-02-27 17:11:11 -0800 | [diff] [blame] | 283 | fi |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 284 | ___EOF___ |
Paul E. McKenney | 5395467 | 2014-01-17 14:18:05 -0800 | [diff] [blame] | 285 | awk < $T/cfgcpu.pack \ |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 286 | -v CONFIGDIR="$CONFIGFRAG/$kversion/" \ |
| 287 | -v KVM="$KVM" \ |
| 288 | -v ncpus=$cpus \ |
| 289 | -v rd=$resdir/$ds/ \ |
| 290 | -v dur=$dur \ |
Paul E. McKenney | 0618873 | 2014-03-06 13:20:54 -0800 | [diff] [blame] | 291 | -v TORTURE_QEMU_ARG="$TORTURE_QEMU_ARG" \ |
| 292 | -v TORTURE_BOOTARGS="$TORTURE_BOOTARGS" \ |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 293 | 'BEGIN { |
| 294 | i = 0; |
| 295 | } |
| 296 | |
| 297 | { |
| 298 | cf[i] = $1; |
| 299 | cpus[i] = $2; |
| 300 | i++; |
| 301 | } |
| 302 | |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 303 | # Dump out the scripting required to run one test batch. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 304 | function dump(first, pastlast) |
| 305 | { |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 306 | print "echo ----Start batch: `date`"; |
| 307 | print "echo ----Start batch: `date` >> " rd "/log"; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 308 | jn=1 |
| 309 | for (j = first; j < pastlast; j++) { |
| 310 | builddir=KVM "/b" jn |
Paul E. McKenney | 0ae3f73 | 2014-01-17 03:29:12 -0800 | [diff] [blame] | 311 | cpusr[jn] = cpus[j]; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 312 | if (cfrep[cf[j]] == "") { |
Paul E. McKenney | 0ae3f73 | 2014-01-17 03:29:12 -0800 | [diff] [blame] | 313 | cfr[jn] = cf[j]; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 314 | cfrep[cf[j]] = 1; |
| 315 | } else { |
| 316 | cfrep[cf[j]]++; |
Paul E. McKenney | 0ae3f73 | 2014-01-17 03:29:12 -0800 | [diff] [blame] | 317 | cfr[jn] = cf[j] "." cfrep[cf[j]]; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 318 | } |
Paul E. McKenney | df1cc81 | 2014-01-17 22:08:09 -0800 | [diff] [blame] | 319 | if (cpusr[jn] > ncpus && ncpus != 0) |
| 320 | ovf = "(!)"; |
| 321 | else |
| 322 | ovf = ""; |
Paul E. McKenney | 3c62623 | 2014-01-30 15:29:29 -0800 | [diff] [blame] | 323 | print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date`"; |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 324 | 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] | 325 | 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. McKenney | d1b1e51 | 2014-02-26 16:42:46 -0800 | [diff] [blame] | 329 | 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. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 330 | 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. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 332 | print "while test -f " builddir ".wait" |
| 333 | print "do" |
| 334 | print "\tsleep 1" |
| 335 | print "done" |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 336 | 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. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 338 | jn++; |
| 339 | } |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 340 | for (j = 1; j < jn; j++) { |
| 341 | builddir=KVM "/b" j |
| 342 | print "rm -f " builddir ".ready" |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 343 | print "echo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date`"; |
| 344 | 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] | 345 | } |
| 346 | print "wait" |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 347 | print "echo ---- All kernel runs complete. `date`"; |
| 348 | print "echo ---- All kernel runs complete. `date` >> " rd "/log"; |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 349 | for (j = 1; j < jn; j++) { |
| 350 | builddir=KVM "/b" j |
Paul E. McKenney | 73fa867 | 2014-02-11 12:16:14 -0800 | [diff] [blame] | 351 | print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results:"; |
| 352 | print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results: >> " rd "/log"; |
| 353 | print "cat " rd cfr[j] "/kvm-test-1-run.sh.out"; |
| 354 | 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] | 355 | } |
| 356 | } |
| 357 | |
| 358 | END { |
| 359 | njobs = i; |
| 360 | nc = ncpus; |
| 361 | first = 0; |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 362 | |
| 363 | # Each pass through the following loop considers one test. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 364 | for (i = 0; i < njobs; i++) { |
| 365 | if (ncpus == 0) { |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 366 | # Sequential test specified, each test its own batch. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 367 | dump(i, i + 1); |
| 368 | first = i; |
| 369 | } else if (nc < cpus[i] && i != 0) { |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 370 | # Out of CPUs, dump out a batch. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 371 | dump(first, i); |
| 372 | first = i; |
| 373 | nc = ncpus; |
| 374 | } |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 375 | # Account for the CPUs needed by the current test. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 376 | nc -= cpus[i]; |
| 377 | } |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 378 | # Dump the last batch. |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 379 | if (ncpus != 0) |
| 380 | dump(first, i); |
Paul E. McKenney | 61010e7 | 2014-02-07 10:29:49 -0800 | [diff] [blame] | 381 | }' >> $T/script |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 382 | |
Paul E. McKenney | 1f5d092 | 2014-02-27 17:11:11 -0800 | [diff] [blame] | 383 | cat << ___EOF___ >> $T/script |
| 384 | echo |
| 385 | echo |
| 386 | echo " --- `date` Test summary:" |
| 387 | echo Results directory: $resdir/$ds |
| 388 | if test -z "$TORTURE_BUILDONLY" |
| 389 | then |
| 390 | kvm-recheck.sh $resdir/$ds |
| 391 | fi |
| 392 | ___EOF___ |
| 393 | |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 394 | if test "$dryrun" = script |
| 395 | then |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 396 | cat $T/script |
| 397 | exit 0 |
| 398 | elif test "$dryrun" = sched |
| 399 | then |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 400 | # Extract the test run schedule from the script. |
Paul E. McKenney | 9352ad1 | 2014-02-26 09:10:26 -0800 | [diff] [blame] | 401 | egrep 'Start batch|Starting build\.' $T/script | |
| 402 | grep -v ">>" | |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 403 | sed -e 's/:.*$//' -e 's/^echo //' |
| 404 | exit 0 |
| 405 | else |
Paul E. McKenney | 78ad069 | 2014-01-17 21:56:57 -0800 | [diff] [blame] | 406 | # Not a dryru, so run the script. |
Paul E. McKenney | a758281 | 2014-01-17 03:10:16 -0800 | [diff] [blame] | 407 | sh $T/script |
| 408 | fi |
Paul E. McKenney | 43e38ab | 2014-01-15 15:48:41 -0800 | [diff] [blame] | 409 | |
Paul E. McKenney | 782ab4c | 2013-10-15 12:11:24 -0700 | [diff] [blame] | 410 | # 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 |