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 |
| 31 | |
| 32 | dur=30 |
| 33 | KVM=`pwd`/tools/testing/selftests/rcutorture; export KVM |
| 34 | builddir=${KVM}/b1 |
| 35 | resdir="" |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 36 | configs="" |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 37 | ds=`date +%Y.%m.%d-%H:%M:%S` |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 38 | kversion="" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 39 | |
| 40 | usage () { |
| 41 | echo "Usage: $scriptname optional arguments:" |
| 42 | echo " --builddir absolute-pathname" |
| 43 | echo " --configs \"config-file list\"" |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 44 | echo " --datestamp string" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 45 | echo " --duration minutes" |
Paul E. McKenney | bb91853 | 2013-09-28 20:37:45 -0700 | [diff] [blame] | 46 | echo " --kversion vN.NN" |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 47 | echo " --rcu-kvm absolute-pathname" |
| 48 | echo " --results absolute-pathname" |
| 49 | echo " --relbuilddir relative-pathname" |
| 50 | exit 1 |
| 51 | } |
| 52 | |
| 53 | # checkarg --argname argtype $# arg mustmatch cannotmatch |
| 54 | checkarg () { |
| 55 | if test $3 -le 1 |
| 56 | then |
| 57 | echo $1 needs argument $2 matching \"$5\" |
| 58 | usage |
| 59 | fi |
| 60 | if echo "$4" | grep -q -e "$5" |
| 61 | then |
| 62 | : |
| 63 | else |
| 64 | echo $1 $2 \"$4\" must match \"$5\" |
| 65 | usage |
| 66 | fi |
| 67 | if echo "$4" | grep -q -e "$6" |
| 68 | then |
| 69 | echo $1 $2 \"$4\" must not match \"$6\" |
| 70 | usage |
| 71 | fi |
| 72 | } |
| 73 | |
| 74 | while test $# -gt 0 |
| 75 | do |
| 76 | echo ":$1:" |
| 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 | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 104 | --rcu-kvm) |
| 105 | checkarg --rcu-kvm "(absolute pathname)" "$#" "$2" '^/' error |
| 106 | KVM=$2; export KVM |
| 107 | if -z "$gotbuilddir" |
| 108 | then |
| 109 | builddir=${KVM}/b1 |
| 110 | fi |
| 111 | if -n "$gotrelbuilddir" |
| 112 | then |
| 113 | builddir=${KVM}/${relbuilddir} |
| 114 | fi |
| 115 | shift |
| 116 | ;; |
| 117 | --relbuilddir) |
| 118 | checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' |
| 119 | relbuilddir=$2 |
| 120 | gotrelbuilddir=1 |
| 121 | builddir=${KVM}/${relbuilddir} |
| 122 | shift |
| 123 | ;; |
| 124 | --results) |
| 125 | checkarg --results "(absolute pathname)" "$#" "$2" '^/' error |
| 126 | resdir=$2 |
| 127 | shift |
| 128 | ;; |
| 129 | *) |
| 130 | usage |
| 131 | ;; |
| 132 | esac |
| 133 | shift |
| 134 | done |
| 135 | |
| 136 | echo "builddir=$builddir" |
| 137 | echo "dur=$dur" |
| 138 | echo "KVM=$KVM" |
| 139 | echo "resdir=$resdir" |
| 140 | |
| 141 | PATH=${KVM}/bin:$PATH; export PATH |
| 142 | CONFIGFRAG=${KVM}/configs; export CONFIGFRAG |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 143 | KVPATH=${CONFIGFRAG}/$kversion; export KVPATH |
| 144 | |
| 145 | if test -z "$configs" |
| 146 | then |
| 147 | configs="`cat $CONFIGFRAG/$kversion/CFLIST`" |
| 148 | fi |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 149 | |
| 150 | if test -z "$resdir" |
| 151 | then |
| 152 | resdir=$KVM/res |
| 153 | mkdir $resdir || : |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 154 | else |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 155 | mkdir -p "$resdir" || : |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 156 | fi |
Paul E. McKenney | 847bfd2 | 2013-09-28 18:44:11 -0700 | [diff] [blame] | 157 | mkdir $resdir/$ds |
| 158 | echo Datestamp: $ds |
| 159 | |
Paul E. McKenney | c87b9c6 | 2013-09-28 14:12:21 -0700 | [diff] [blame] | 160 | pwd > $resdir/$ds/testid.txt |
| 161 | if test -d .git |
| 162 | then |
| 163 | git status >> $resdir/$ds/testid.txt |
| 164 | git rev-parse HEAD >> $resdir/$ds/testid.txt |
| 165 | fi |
| 166 | builddir=$KVM/b1 |
| 167 | mkdir $builddir || : |
| 168 | |
| 169 | for CF in $configs |
| 170 | do |
| 171 | rd=$resdir/$ds/$CF |
| 172 | mkdir $rd || : |
| 173 | echo Results directory: $rd |
Paul E. McKenney | 4275be8 | 2013-09-29 11:13:46 -0700 | [diff] [blame] | 174 | 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] | 175 | done |
| 176 | # 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 |