Commit | Line | Data |
---|---|---|
c87b9c60 PM |
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 | |
330a76f1 | 31 | args="$*" |
c87b9c60 PM |
32 | |
33 | dur=30 | |
73931b5e PM |
34 | KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM |
35 | builddir="${KVM}/b1" | |
36 | RCU_INITRD="$KVM/initrd"; export RCU_INITRD | |
74878fb6 | 37 | RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG |
c87b9c60 | 38 | resdir="" |
4275be83 | 39 | configs="" |
847bfd25 | 40 | ds=`date +%Y.%m.%d-%H:%M:%S` |
bb918535 | 41 | kversion="" |
c87b9c60 PM |
42 | |
43 | usage () { | |
44 | echo "Usage: $scriptname optional arguments:" | |
7dca9273 | 45 | echo " --bootargs kernel-boot-arguments" |
c87b9c60 | 46 | echo " --builddir absolute-pathname" |
11274813 | 47 | echo " --buildonly" |
c87b9c60 | 48 | echo " --configs \"config-file list\"" |
847bfd25 | 49 | echo " --datestamp string" |
c87b9c60 | 50 | echo " --duration minutes" |
315c540d | 51 | echo " --interactive" |
74878fb6 | 52 | echo " --kmake-arg kernel-make-arguments" |
bb918535 | 53 | echo " --kversion vN.NN" |
315c540d | 54 | echo " --mac nn:nn:nn:nn:nn:nn" |
73931b5e | 55 | echo " --no-initrd" |
e9ce6400 | 56 | echo " --qemu-args qemu-system-..." |
4f8a0312 | 57 | echo " --qemu-cmd qemu-system-..." |
c87b9c60 PM |
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 | |
c87b9c60 | 86 | case "$1" in |
7dca9273 PM |
87 | --bootargs) |
88 | checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--' | |
89 | RCU_BOOTARGS="$2" | |
90 | shift | |
91 | ;; | |
c87b9c60 | 92 | --builddir) |
e9ce6400 | 93 | checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' '^error' |
c87b9c60 PM |
94 | builddir=$2 |
95 | gotbuilddir=1 | |
96 | shift | |
97 | ;; | |
11274813 PM |
98 | --buildonly) |
99 | RCU_BUILDONLY=1; export RCU_BUILDONLY | |
100 | ;; | |
c87b9c60 PM |
101 | --configs) |
102 | checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--' | |
103 | configs="$2" | |
104 | shift | |
105 | ;; | |
847bfd25 PM |
106 | --datestamp) |
107 | checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' | |
108 | ds=$2 | |
109 | shift | |
110 | ;; | |
c87b9c60 | 111 | --duration) |
e9ce6400 | 112 | checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error' |
c87b9c60 PM |
113 | dur=$2 |
114 | shift | |
115 | ;; | |
315c540d PM |
116 | --interactive) |
117 | RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE | |
118 | ;; | |
74878fb6 PM |
119 | --kmake-arg) |
120 | checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$' | |
121 | RCU_KMAKE_ARG="$2"; export RCU_KMAKE_ARG | |
122 | shift | |
123 | ;; | |
bb918535 | 124 | --kversion) |
e9ce6400 | 125 | checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' '^error' |
bb918535 PM |
126 | kversion=$2 |
127 | shift | |
128 | ;; | |
315c540d PM |
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 | ;; | |
73931b5e PM |
134 | --no-initrd) |
135 | RCU_INITRD=""; export RCU_INITRD | |
136 | ;; | |
e9ce6400 PM |
137 | --qemu-args) |
138 | checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error' | |
139 | RCU_QEMU_ARG="$2" | |
140 | shift | |
141 | ;; | |
4f8a0312 PM |
142 | --qemu-cmd) |
143 | checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--' | |
144 | RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD | |
145 | shift | |
146 | ;; | |
c87b9c60 PM |
147 | --relbuilddir) |
148 | checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' | |
149 | relbuilddir=$2 | |
150 | gotrelbuilddir=1 | |
151 | builddir=${KVM}/${relbuilddir} | |
152 | shift | |
153 | ;; | |
154 | --results) | |
e9ce6400 | 155 | checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error' |
c87b9c60 PM |
156 | resdir=$2 |
157 | shift | |
158 | ;; | |
159 | *) | |
2bcdf4e3 | 160 | echo Unknown argument $1 |
c87b9c60 PM |
161 | usage |
162 | ;; | |
163 | esac | |
164 | shift | |
165 | done | |
166 | ||
c87b9c60 PM |
167 | PATH=${KVM}/bin:$PATH; export PATH |
168 | CONFIGFRAG=${KVM}/configs; export CONFIGFRAG | |
4275be83 PM |
169 | KVPATH=${CONFIGFRAG}/$kversion; export KVPATH |
170 | ||
171 | if test -z "$configs" | |
172 | then | |
173 | configs="`cat $CONFIGFRAG/$kversion/CFLIST`" | |
174 | fi | |
c87b9c60 PM |
175 | |
176 | if test -z "$resdir" | |
177 | then | |
178 | resdir=$KVM/res | |
330a76f1 PM |
179 | if ! test -e $resdir |
180 | then | |
181 | mkdir $resdir || : | |
182 | fi | |
c87b9c60 | 183 | else |
330a76f1 PM |
184 | if ! test -e $resdir |
185 | then | |
186 | mkdir -p "$resdir" || : | |
187 | fi | |
c87b9c60 | 188 | fi |
847bfd25 | 189 | mkdir $resdir/$ds |
330a76f1 PM |
190 | touch $resdir/$ds/log |
191 | echo $scriptname $args >> $resdir/$ds/log | |
847bfd25 | 192 | |
c87b9c60 PM |
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 | |
330a76f1 PM |
200 | if ! test -e $builddir |
201 | then | |
202 | mkdir $builddir || : | |
203 | fi | |
c87b9c60 PM |
204 | |
205 | for CF in $configs | |
206 | do | |
207 | rd=$resdir/$ds/$CF | |
208 | mkdir $rd || : | |
209 | echo Results directory: $rd | |
e9ce6400 | 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" |
c87b9c60 PM |
211 | done |
212 | # 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 |