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 |
| 23 | # along with this program; if not, write to the Free Software |
| 24 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 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 | |
| 33 | dur=30 |
Paul E. McKenney | 73931b5 | 2013-10-15 10:42:25 -0700 | [diff] [blame] | 34 | KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM |
| 35 | builddir="${KVM}/b1" |
| 36 | RCU_INITRD="$KVM/initrd"; export RCU_INITRD |
Paul E. McKenney | 74878fb | 2013-10-15 11:51:23 -0700 | [diff] [blame] | 37 | RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 38 | resdir="" |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 39 | configs="" |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 40 | ds=`date +%Y.%m.%d-%H:%M:%S` |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 41 | kversion="" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 42 | |
| 43 | usage () { |
| 44 | echo "Usage: $scriptname optional arguments:" |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame] | 45 | echo " --bootargs kernel-boot-arguments" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 46 | echo " --builddir absolute-pathname" |
Paul E. McKenney | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 47 | echo " --buildonly" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 48 | echo " --configs \"config-file list\"" |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 49 | echo " --datestamp string" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 50 | echo " --duration minutes" |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 51 | echo " --interactive" |
Paul E. McKenney | 74878fb | 2013-10-15 11:51:23 -0700 | [diff] [blame] | 52 | echo " --kmake-arg kernel-make-arguments" |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 53 | echo " --kversion vN.NN" |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 54 | echo " --mac nn:nn:nn:nn:nn:nn" |
Paul E. McKenney | 73931b5 | 2013-10-15 10:42:25 -0700 | [diff] [blame] | 55 | echo " --no-initrd" |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 56 | echo " --qemu-args qemu-system-..." |
Paul E. McKenney | 4f8a031 | 2013-09-30 17:17:57 -0700 | [diff] [blame] | 57 | echo " --qemu-cmd qemu-system-..." |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 58 | echo " --results absolute-pathname" |
| 59 | echo " --relbuilddir relative-pathname" |
| 60 | exit 1 |
| 61 | } |
| 62 | |
| 63 | # checkarg --argname argtype $# arg mustmatch cannotmatch |
| 64 | checkarg () { |
| 65 | if test $3 -le 1 |
| 66 | then |
| 67 | echo $1 needs argument $2 matching \"$5\" |
| 68 | usage |
| 69 | fi |
| 70 | if echo "$4" | grep -q -e "$5" |
| 71 | then |
| 72 | : |
| 73 | else |
| 74 | echo $1 $2 \"$4\" must match \"$5\" |
| 75 | usage |
| 76 | fi |
| 77 | if echo "$4" | grep -q -e "$6" |
| 78 | then |
| 79 | echo $1 $2 \"$4\" must not match \"$6\" |
| 80 | usage |
| 81 | fi |
| 82 | } |
| 83 | |
| 84 | while test $# -gt 0 |
| 85 | do |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 86 | case "$1" in |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame] | 87 | --bootargs) |
| 88 | checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--' |
| 89 | RCU_BOOTARGS="$2" |
| 90 | shift |
| 91 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 92 | --builddir) |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 93 | checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' '^error' |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 94 | builddir=$2 |
| 95 | gotbuilddir=1 |
| 96 | shift |
| 97 | ;; |
Paul E. McKenney | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 98 | --buildonly) |
| 99 | RCU_BUILDONLY=1; export RCU_BUILDONLY |
| 100 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 101 | --configs) |
| 102 | checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--' |
| 103 | configs="$2" |
| 104 | shift |
| 105 | ;; |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 106 | --datestamp) |
| 107 | checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' |
| 108 | ds=$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) |
| 117 | RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE |
| 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$' |
| 121 | RCU_KMAKE_ARG="$2"; export RCU_KMAKE_ARG |
| 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) |
| 135 | RCU_INITRD=""; export RCU_INITRD |
| 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 | --relbuilddir) |
| 148 | checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' |
| 149 | relbuilddir=$2 |
| 150 | gotrelbuilddir=1 |
| 151 | builddir=${KVM}/${relbuilddir} |
| 152 | shift |
| 153 | ;; |
| 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 | ;; |
| 159 | *) |
Paul E. McKenney | 2bcdf4e | 2013-10-01 10:14:09 -0700 | [diff] [blame] | 160 | echo Unknown argument $1 |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 161 | usage |
| 162 | ;; |
| 163 | esac |
| 164 | shift |
| 165 | done |
| 166 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 167 | PATH=${KVM}/bin:$PATH; export PATH |
| 168 | CONFIGFRAG=${KVM}/configs; export CONFIGFRAG |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 169 | KVPATH=${CONFIGFRAG}/$kversion; export KVPATH |
| 170 | |
| 171 | if test -z "$configs" |
| 172 | then |
| 173 | configs="`cat $CONFIGFRAG/$kversion/CFLIST`" |
| 174 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 175 | |
| 176 | if test -z "$resdir" |
| 177 | then |
| 178 | resdir=$KVM/res |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 179 | if ! test -e $resdir |
| 180 | then |
| 181 | mkdir $resdir || : |
| 182 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 183 | else |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 184 | if ! test -e $resdir |
| 185 | then |
| 186 | mkdir -p "$resdir" || : |
| 187 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 188 | fi |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 189 | mkdir $resdir/$ds |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 190 | touch $resdir/$ds/log |
| 191 | echo $scriptname $args >> $resdir/$ds/log |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 192 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 193 | pwd > $resdir/$ds/testid.txt |
| 194 | if test -d .git |
| 195 | then |
| 196 | git status >> $resdir/$ds/testid.txt |
| 197 | git rev-parse HEAD >> $resdir/$ds/testid.txt |
| 198 | fi |
| 199 | builddir=$KVM/b1 |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 200 | if ! test -e $builddir |
| 201 | then |
| 202 | mkdir $builddir || : |
| 203 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 204 | |
| 205 | for CF in $configs |
| 206 | do |
| 207 | rd=$resdir/$ds/$CF |
| 208 | mkdir $rd || : |
| 209 | echo Results directory: $rd |
Paul E. McKenney | e9ce640 | 2013-10-15 09:22:48 -0700 | [diff] [blame] | 210 | kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur "-nographic $RCU_QEMU_ARG" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 $RCU_BOOTARGS" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 211 | done |
Paul E. McKenney | 782ab4c | 2013-10-15 12:11:24 -0700 | [diff] [blame^] | 212 | # 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 |