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:" |
| 43 | echo " --builddir absolute-pathname" |
| 44 | echo " --configs \"config-file list\"" |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 45 | echo " --datestamp string" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 46 | echo " --duration minutes" |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 47 | echo " --kversion vN.NN" |
Paul E. McKenney | 4f8a031 | 2013-09-30 17:17:57 -0700 | [diff] [blame] | 48 | echo " --qemu-cmd qemu-system-..." |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 49 | echo " --results absolute-pathname" |
| 50 | echo " --relbuilddir relative-pathname" |
| 51 | exit 1 |
| 52 | } |
| 53 | |
| 54 | # checkarg --argname argtype $# arg mustmatch cannotmatch |
| 55 | checkarg () { |
| 56 | if test $3 -le 1 |
| 57 | then |
| 58 | echo $1 needs argument $2 matching \"$5\" |
| 59 | usage |
| 60 | fi |
| 61 | if echo "$4" | grep -q -e "$5" |
| 62 | then |
| 63 | : |
| 64 | else |
| 65 | echo $1 $2 \"$4\" must match \"$5\" |
| 66 | usage |
| 67 | fi |
| 68 | if echo "$4" | grep -q -e "$6" |
| 69 | then |
| 70 | echo $1 $2 \"$4\" must not match \"$6\" |
| 71 | usage |
| 72 | fi |
| 73 | } |
| 74 | |
| 75 | while test $# -gt 0 |
| 76 | do |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 77 | case "$1" in |
| 78 | --builddir) |
| 79 | checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' error |
| 80 | builddir=$2 |
| 81 | gotbuilddir=1 |
| 82 | shift |
| 83 | ;; |
| 84 | --configs) |
| 85 | checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--' |
| 86 | configs="$2" |
| 87 | shift |
| 88 | ;; |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 89 | --datestamp) |
| 90 | checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' |
| 91 | ds=$2 |
| 92 | shift |
| 93 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 94 | --duration) |
| 95 | checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' error |
| 96 | dur=$2 |
| 97 | shift |
| 98 | ;; |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 99 | --kversion) |
| 100 | checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' error |
| 101 | kversion=$2 |
| 102 | shift |
| 103 | ;; |
Paul E. McKenney | 4f8a031 | 2013-09-30 17:17:57 -0700 | [diff] [blame] | 104 | --qemu-cmd) |
| 105 | checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--' |
| 106 | RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD |
| 107 | shift |
| 108 | ;; |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 109 | --relbuilddir) |
| 110 | checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' |
| 111 | relbuilddir=$2 |
| 112 | gotrelbuilddir=1 |
| 113 | builddir=${KVM}/${relbuilddir} |
| 114 | shift |
| 115 | ;; |
| 116 | --results) |
| 117 | checkarg --results "(absolute pathname)" "$#" "$2" '^/' error |
| 118 | resdir=$2 |
| 119 | shift |
| 120 | ;; |
| 121 | *) |
Paul E. McKenney | 2bcdf4e | 2013-10-01 10:14:09 -0700 | [diff] [blame^] | 122 | echo Unknown argument $1 |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 123 | usage |
| 124 | ;; |
| 125 | esac |
| 126 | shift |
| 127 | done |
| 128 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 129 | PATH=${KVM}/bin:$PATH; export PATH |
| 130 | CONFIGFRAG=${KVM}/configs; export CONFIGFRAG |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 131 | KVPATH=${CONFIGFRAG}/$kversion; export KVPATH |
| 132 | |
| 133 | if test -z "$configs" |
| 134 | then |
| 135 | configs="`cat $CONFIGFRAG/$kversion/CFLIST`" |
| 136 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 137 | |
| 138 | if test -z "$resdir" |
| 139 | then |
| 140 | resdir=$KVM/res |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 141 | if ! test -e $resdir |
| 142 | then |
| 143 | mkdir $resdir || : |
| 144 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 145 | else |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 146 | if ! test -e $resdir |
| 147 | then |
| 148 | mkdir -p "$resdir" || : |
| 149 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 150 | fi |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 151 | mkdir $resdir/$ds |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 152 | touch $resdir/$ds/log |
| 153 | echo $scriptname $args >> $resdir/$ds/log |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 154 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 155 | pwd > $resdir/$ds/testid.txt |
| 156 | if test -d .git |
| 157 | then |
| 158 | git status >> $resdir/$ds/testid.txt |
| 159 | git rev-parse HEAD >> $resdir/$ds/testid.txt |
| 160 | fi |
| 161 | builddir=$KVM/b1 |
Paul E. McKenney | 330a76f | 2013-09-30 14:49:43 -0700 | [diff] [blame] | 162 | if ! test -e $builddir |
| 163 | then |
| 164 | mkdir $builddir || : |
| 165 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 166 | |
| 167 | for CF in $configs |
| 168 | do |
| 169 | rd=$resdir/$ds/$CF |
| 170 | mkdir $rd || : |
| 171 | echo Results directory: $rd |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 172 | kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur "-nographic" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 173 | done |
| 174 | # 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 |