]>
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 | |
34 | KVM=`pwd`/tools/testing/selftests/rcutorture; export KVM | |
35 | builddir=${KVM}/b1 | |
36 | resdir="" | |
4275be83 | 37 | configs="" |
847bfd25 | 38 | ds=`date +%Y.%m.%d-%H:%M:%S` |
bb918535 | 39 | kversion="" |
c87b9c60 PM |
40 | |
41 | usage () { | |
42 | echo "Usage: $scriptname optional arguments:" | |
7dca9273 | 43 | echo " --bootargs kernel-boot-arguments" |
c87b9c60 | 44 | echo " --builddir absolute-pathname" |
11274813 | 45 | echo " --buildonly" |
c87b9c60 | 46 | echo " --configs \"config-file list\"" |
847bfd25 | 47 | echo " --datestamp string" |
c87b9c60 | 48 | echo " --duration minutes" |
315c540d | 49 | echo " --interactive" |
bb918535 | 50 | echo " --kversion vN.NN" |
315c540d | 51 | echo " --mac nn:nn:nn:nn:nn:nn" |
4f8a0312 | 52 | echo " --qemu-cmd qemu-system-..." |
c87b9c60 PM |
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 | |
c87b9c60 | 81 | case "$1" in |
7dca9273 PM |
82 | --bootargs) |
83 | checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--' | |
84 | RCU_BOOTARGS="$2" | |
85 | shift | |
86 | ;; | |
c87b9c60 PM |
87 | --builddir) |
88 | checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' error | |
89 | builddir=$2 | |
90 | gotbuilddir=1 | |
91 | shift | |
92 | ;; | |
11274813 PM |
93 | --buildonly) |
94 | RCU_BUILDONLY=1; export RCU_BUILDONLY | |
95 | ;; | |
c87b9c60 PM |
96 | --configs) |
97 | checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--' | |
98 | configs="$2" | |
99 | shift | |
100 | ;; | |
847bfd25 PM |
101 | --datestamp) |
102 | checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--' | |
103 | ds=$2 | |
104 | shift | |
105 | ;; | |
c87b9c60 PM |
106 | --duration) |
107 | checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' error | |
108 | dur=$2 | |
109 | shift | |
110 | ;; | |
315c540d PM |
111 | --interactive) |
112 | RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE | |
113 | ;; | |
bb918535 PM |
114 | --kversion) |
115 | checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' error | |
116 | kversion=$2 | |
117 | shift | |
118 | ;; | |
315c540d PM |
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 | ;; | |
4f8a0312 PM |
124 | --qemu-cmd) |
125 | checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--' | |
126 | RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD | |
127 | shift | |
128 | ;; | |
c87b9c60 PM |
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 | *) | |
2bcdf4e3 | 142 | echo Unknown argument $1 |
c87b9c60 PM |
143 | usage |
144 | ;; | |
145 | esac | |
146 | shift | |
147 | done | |
148 | ||
c87b9c60 PM |
149 | PATH=${KVM}/bin:$PATH; export PATH |
150 | CONFIGFRAG=${KVM}/configs; export CONFIGFRAG | |
4275be83 PM |
151 | KVPATH=${CONFIGFRAG}/$kversion; export KVPATH |
152 | ||
153 | if test -z "$configs" | |
154 | then | |
155 | configs="`cat $CONFIGFRAG/$kversion/CFLIST`" | |
156 | fi | |
c87b9c60 PM |
157 | |
158 | if test -z "$resdir" | |
159 | then | |
160 | resdir=$KVM/res | |
330a76f1 PM |
161 | if ! test -e $resdir |
162 | then | |
163 | mkdir $resdir || : | |
164 | fi | |
c87b9c60 | 165 | else |
330a76f1 PM |
166 | if ! test -e $resdir |
167 | then | |
168 | mkdir -p "$resdir" || : | |
169 | fi | |
c87b9c60 | 170 | fi |
847bfd25 | 171 | mkdir $resdir/$ds |
330a76f1 PM |
172 | touch $resdir/$ds/log |
173 | echo $scriptname $args >> $resdir/$ds/log | |
847bfd25 | 174 | |
c87b9c60 PM |
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 | |
330a76f1 PM |
182 | if ! test -e $builddir |
183 | then | |
184 | mkdir $builddir || : | |
185 | fi | |
c87b9c60 PM |
186 | |
187 | for CF in $configs | |
188 | do | |
189 | rd=$resdir/$ds/$CF | |
190 | mkdir $rd || : | |
191 | echo Results directory: $rd | |
7dca9273 | 192 | kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur "-nographic" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1 $RCU_BOOTARGS" |
c87b9c60 PM |
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 |