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 |
| 34 | KVM=`pwd`/tools/testing/selftests/rcutorture; export KVM |
| 35 | builddir=${KVM}/b1 |
| 36 | resdir="" |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 37 | configs="" |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 38 | ds=`date +%Y.%m.%d-%H:%M:%S` |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 39 | kversion="" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 40 | |
| 41 | usage () { |
| 42 | echo "Usage: $scriptname optional arguments:" |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame^] | 43 | echo " --bootargs kernel-boot-arguments" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 44 | echo " --builddir absolute-pathname" |
Paul E. McKenney | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 45 | echo " --buildonly" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 46 | echo " --configs \"config-file list\"" |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 47 | echo " --datestamp string" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 48 | echo " --duration minutes" |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 49 | echo " --interactive" |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 50 | echo " --kversion vN.NN" |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 51 | echo " --mac nn:nn:nn:nn:nn:nn" |
Paul E. McKenney | 4f8a031 | 2013-09-30 17:17:57 -0700 | [diff] [blame] | 52 | echo " --qemu-cmd qemu-system-..." |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 53 | echo " --results absolute-pathname" |
| 54 | echo " --relbuilddir relative-pathname" |
| 55 | exit 1 |
| 56 | } |
| 57 | |
| 58 | # checkarg --argname argtype $# arg mustmatch cannotmatch |
| 59 | checkarg () { |
| 60 | if test $3 -le 1 |
| 61 | then |
| 62 | echo $1 needs argument $2 matching \"$5\" |
| 63 | usage |
| 64 | fi |
| 65 | if echo "$4" | grep -q -e "$5" |
| 66 | then |
| 67 | : |
| 68 | else |
| 69 | echo $1 $2 \"$4\" must match \"$5\" |
| 70 | usage |
| 71 | fi |
| 72 | if echo "$4" | grep -q -e "$6" |
| 73 | then |
| 74 | echo $1 $2 \"$4\" must not match \"$6\" |
| 75 | usage |
| 76 | fi |
| 77 | } |
| 78 | |
| 79 | while test $# -gt 0 |
| 80 | do |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 81 | case "$1" in |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame^] | 82 | --bootargs) |
| 83 | checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--' |
| 84 | RCU_BOOTARGS="$2" |
| 85 | shift |
| 86 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 87 | --builddir) |
| 88 | checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' error |
| 89 | builddir=$2 |
| 90 | gotbuilddir=1 |
| 91 | shift |
| 92 | ;; |
Paul E. McKenney | 1127481 | 2013-10-10 14:52:07 -0700 | [diff] [blame] | 93 | --buildonly) |
| 94 | RCU_BUILDONLY=1; export RCU_BUILDONLY |
| 95 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 96 | --configs) |
| 97 | checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--' |
| 98 | configs="$2" |
| 99 | shift |
| 100 | ;; |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 101 | --datestamp) |
| 102 | checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' |
| 103 | ds=$2 |
| 104 | shift |
| 105 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 106 | --duration) |
| 107 | checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' error |
| 108 | dur=$2 |
| 109 | shift |
| 110 | ;; |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 111 | --interactive) |
| 112 | RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE |
| 113 | ;; |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 114 | --kversion) |
| 115 | checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' error |
| 116 | kversion=$2 |
| 117 | shift |
| 118 | ;; |
Paul E. McKenney | 315c540 | 2013-10-04 13:15:55 -0700 | [diff] [blame] | 119 | --mac) |
| 120 | checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error |
| 121 | RCU_QEMU_MAC=$2; export RCU_QEMU_MAC |
| 122 | shift |
| 123 | ;; |
Paul E. McKenney | 4f8a031 | 2013-09-30 17:17:57 -0700 | [diff] [blame] | 124 | --qemu-cmd) |
| 125 | checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--' |
| 126 | RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD |
| 127 | shift |
| 128 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 129 | --relbuilddir) |
| 130 | checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' |
| 131 | relbuilddir=$2 |
| 132 | gotrelbuilddir=1 |
| 133 | builddir=${KVM}/${relbuilddir} |
| 134 | shift |
| 135 | ;; |
| 136 | --results) |
| 137 | checkarg --results "(absolute pathname)" "$#" "$2" '^/' error |
| 138 | resdir=$2 |
| 139 | shift |
| 140 | ;; |
| 141 | *) |
Paul E. McKenney | 2bcdf4e | 2013-10-01 10:14:09 -0700 | [diff] [blame] | 142 | echo Unknown argument $1 |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 143 | usage |
| 144 | ;; |
| 145 | esac |
| 146 | shift |
| 147 | done |
| 148 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 149 | PATH=${KVM}/bin:$PATH; export PATH |
| 150 | CONFIGFRAG=${KVM}/configs; export CONFIGFRAG |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 151 | KVPATH=${CONFIGFRAG}/$kversion; export KVPATH |
| 152 | |
| 153 | if test -z "$configs" |
| 154 | then |
| 155 | configs="`cat $CONFIGFRAG/$kversion/CFLIST`" |
| 156 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 157 | |
| 158 | if test -z "$resdir" |
| 159 | then |
| 160 | resdir=$KVM/res |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 161 | if ! test -e $resdir |
| 162 | then |
| 163 | mkdir $resdir || : |
| 164 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 165 | else |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 166 | if ! test -e $resdir |
| 167 | then |
| 168 | mkdir -p "$resdir" || : |
| 169 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 170 | fi |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 171 | mkdir $resdir/$ds |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 172 | touch $resdir/$ds/log |
| 173 | echo $scriptname $args >> $resdir/$ds/log |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 174 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 175 | pwd > $resdir/$ds/testid.txt |
| 176 | if test -d .git |
| 177 | then |
| 178 | git status >> $resdir/$ds/testid.txt |
| 179 | git rev-parse HEAD >> $resdir/$ds/testid.txt |
| 180 | fi |
| 181 | builddir=$KVM/b1 |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 182 | if ! test -e $builddir |
| 183 | then |
| 184 | mkdir $builddir || : |
| 185 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 186 | |
| 187 | for CF in $configs |
| 188 | do |
| 189 | rd=$resdir/$ds/$CF |
| 190 | mkdir $rd || : |
| 191 | echo Results directory: $rd |
Paul E. McKenney | 7dca927 | 2013-10-14 08:19:39 -0700 | [diff] [blame^] | 192 | kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur "-nographic" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 $RCU_BOOTARGS" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 193 | done |
| 194 | # Tracing: trace_event=rcu:rcu_nocb_grace_period,rcu:rcu_grace_period,rcu:rcu_grace_period_init,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_torture_read,rcu:rcu_invoke_callback,rcu:rcu_fqs,rcu:rcu_dyntick,rcu:rcu_unlock_preempted_task |