rcutorture: Move common boot flags to kvm-test-1-rcu.sh
[deliverable/linux.git] / tools / testing / selftests / rcutorture / bin / kvm.sh
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, you can access it online at
24 # http://www.gnu.org/licenses/gpl-2.0.html.
25 #
26 # Copyright (C) IBM Corporation, 2011
27 #
28 # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
29
30 scriptname=$0
31 args="$*"
32
33 dur=30
34 KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
35 PATH=${KVM}/bin:$PATH; export PATH
36 builddir="${KVM}/b1"
37 RCU_INITRD="$KVM/initrd"; export RCU_INITRD
38 RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG
39 resdir=""
40 configs=""
41 ds=`date +%Y.%m.%d-%H:%M:%S`
42 kversion=""
43
44 . functions.sh
45
46 usage () {
47 echo "Usage: $scriptname optional arguments:"
48 echo " --bootargs kernel-boot-arguments"
49 echo " --builddir absolute-pathname"
50 echo " --buildonly"
51 echo " --configs \"config-file list\""
52 echo " --datestamp string"
53 echo " --duration minutes"
54 echo " --interactive"
55 echo " --kmake-arg kernel-make-arguments"
56 echo " --kversion vN.NN"
57 echo " --mac nn:nn:nn:nn:nn:nn"
58 echo " --no-initrd"
59 echo " --qemu-args qemu-system-..."
60 echo " --qemu-cmd qemu-system-..."
61 echo " --results absolute-pathname"
62 echo " --relbuilddir relative-pathname"
63 exit 1
64 }
65
66 while test $# -gt 0
67 do
68 case "$1" in
69 --bootargs)
70 checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--'
71 RCU_BOOTARGS="$2"
72 shift
73 ;;
74 --builddir)
75 checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' '^error'
76 builddir=$2
77 gotbuilddir=1
78 shift
79 ;;
80 --buildonly)
81 RCU_BUILDONLY=1; export RCU_BUILDONLY
82 ;;
83 --configs)
84 checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--'
85 configs="$2"
86 shift
87 ;;
88 --datestamp)
89 checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
90 ds=$2
91 shift
92 ;;
93 --duration)
94 checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error'
95 dur=$2
96 shift
97 ;;
98 --interactive)
99 RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE
100 ;;
101 --kmake-arg)
102 checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$'
103 RCU_KMAKE_ARG="$2"; export RCU_KMAKE_ARG
104 shift
105 ;;
106 --kversion)
107 checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' '^error'
108 kversion=$2
109 shift
110 ;;
111 --mac)
112 checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error
113 RCU_QEMU_MAC=$2; export RCU_QEMU_MAC
114 shift
115 ;;
116 --no-initrd)
117 RCU_INITRD=""; export RCU_INITRD
118 ;;
119 --qemu-args)
120 checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error'
121 RCU_QEMU_ARG="$2"
122 shift
123 ;;
124 --qemu-cmd)
125 checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--'
126 RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD
127 shift
128 ;;
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 *)
142 echo Unknown argument $1
143 usage
144 ;;
145 esac
146 shift
147 done
148
149 CONFIGFRAG=${KVM}/configs; export CONFIGFRAG
150 KVPATH=${CONFIGFRAG}/$kversion; export KVPATH
151
152 if test -z "$configs"
153 then
154 configs="`cat $CONFIGFRAG/$kversion/CFLIST`"
155 fi
156
157 if test -z "$resdir"
158 then
159 resdir=$KVM/res
160 if ! test -e $resdir
161 then
162 mkdir $resdir || :
163 fi
164 else
165 if ! test -e $resdir
166 then
167 mkdir -p "$resdir" || :
168 fi
169 fi
170 mkdir $resdir/$ds
171 touch $resdir/$ds/log
172 echo $scriptname $args
173 echo $scriptname $args >> $resdir/$ds/log
174
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
182 if ! test -e $builddir
183 then
184 mkdir $builddir || :
185 fi
186
187 for CF in $configs
188 do
189 # Running TREE01 multiple times creates TREE01, TREE01.2, TREE01.3, ...
190 rd=$resdir/$ds/$CF
191 if test -d "${rd}"
192 then
193 n="`ls -d "${rd}"* | grep '\.[0-9]\+$' |
194 sed -e 's/^.*\.\([0-9]\+\)/\1/' |
195 sort -k1n | tail -1`"
196 if test -z "$n"
197 then
198 rd="${rd}.2"
199 else
200 n="`expr $n + 1`"
201 rd="${rd}.${n}"
202 fi
203 fi
204 mkdir "${rd}"
205 echo Results directory: $rd
206 kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur "-nographic $RCU_QEMU_ARG" "$RCU_BOOTARGS"
207 done
208 # Tracing: trace_event=rcu:rcu_grace_period,rcu:rcu_future_grace_period,rcu:rcu_grace_period_init,rcu:rcu_nocb_wake,rcu:rcu_preempt_task,rcu:rcu_unlock_preempted_task,rcu:rcu_quiescent_state_report,rcu:rcu_fqs,rcu:rcu_callback,rcu:rcu_kfree_callback,rcu:rcu_batch_start,rcu:rcu_invoke_callback,rcu:rcu_invoke_kfree_callback,rcu:rcu_batch_end,rcu:rcu_torture_read,rcu:rcu_barrier
209
210 echo " --- `date` Test summary:"
211 kvm-recheck.sh $resdir/$ds
This page took 0.033964 seconds and 5 git commands to generate.