blob: 7d6ca337d1fd6652ad0c9ea37dc3f61e622a28aa [file] [log] [blame]
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -07001#!/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
30scriptname=$0
Paul E. McKenney330a76f2013-09-30 14:49:43 -070031args="$*"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070032
33dur=30
34KVM=`pwd`/tools/testing/selftests/rcutorture; export KVM
35builddir=${KVM}/b1
36resdir=""
Paul E. McKenney4275be82013-09-29 11:13:46 -070037configs=""
Paul E. McKenney847bfd22013-09-28 18:44:11 -070038ds=`date +%Y.%m.%d-%H:%M:%S`
Paul E. McKenneybb918532013-09-28 20:37:45 -070039kversion=""
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070040
41usage () {
42 echo "Usage: $scriptname optional arguments:"
Paul E. McKenney7dca9272013-10-14 08:19:39 -070043 echo " --bootargs kernel-boot-arguments"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070044 echo " --builddir absolute-pathname"
Paul E. McKenney11274812013-10-10 14:52:07 -070045 echo " --buildonly"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070046 echo " --configs \"config-file list\""
Paul E. McKenney847bfd22013-09-28 18:44:11 -070047 echo " --datestamp string"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070048 echo " --duration minutes"
Paul E. McKenney315c5402013-10-04 13:15:55 -070049 echo " --interactive"
Paul E. McKenneybb918532013-09-28 20:37:45 -070050 echo " --kversion vN.NN"
Paul E. McKenney315c5402013-10-04 13:15:55 -070051 echo " --mac nn:nn:nn:nn:nn:nn"
Paul E. McKenneye9ce6402013-10-15 09:22:48 -070052 echo " --qemu-args qemu-system-..."
Paul E. McKenney4f8a0312013-09-30 17:17:57 -070053 echo " --qemu-cmd qemu-system-..."
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070054 echo " --results absolute-pathname"
55 echo " --relbuilddir relative-pathname"
56 exit 1
57}
58
59# checkarg --argname argtype $# arg mustmatch cannotmatch
60checkarg () {
61 if test $3 -le 1
62 then
63 echo $1 needs argument $2 matching \"$5\"
64 usage
65 fi
66 if echo "$4" | grep -q -e "$5"
67 then
68 :
69 else
70 echo $1 $2 \"$4\" must match \"$5\"
71 usage
72 fi
73 if echo "$4" | grep -q -e "$6"
74 then
75 echo $1 $2 \"$4\" must not match \"$6\"
76 usage
77 fi
78}
79
80while test $# -gt 0
81do
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070082 case "$1" in
Paul E. McKenney7dca9272013-10-14 08:19:39 -070083 --bootargs)
84 checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--'
85 RCU_BOOTARGS="$2"
86 shift
87 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070088 --builddir)
Paul E. McKenneye9ce6402013-10-15 09:22:48 -070089 checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' '^error'
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070090 builddir=$2
91 gotbuilddir=1
92 shift
93 ;;
Paul E. McKenney11274812013-10-10 14:52:07 -070094 --buildonly)
95 RCU_BUILDONLY=1; export RCU_BUILDONLY
96 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070097 --configs)
98 checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--'
99 configs="$2"
100 shift
101 ;;
Paul E. McKenney847bfd22013-09-28 18:44:11 -0700102 --datestamp)
103 checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
104 ds=$2
105 shift
106 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700107 --duration)
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700108 checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error'
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700109 dur=$2
110 shift
111 ;;
Paul E. McKenney315c5402013-10-04 13:15:55 -0700112 --interactive)
113 RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE
114 ;;
Paul E. McKenneybb918532013-09-28 20:37:45 -0700115 --kversion)
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700116 checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' '^error'
Paul E. McKenneybb918532013-09-28 20:37:45 -0700117 kversion=$2
118 shift
119 ;;
Paul E. McKenney315c5402013-10-04 13:15:55 -0700120 --mac)
121 checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error
122 RCU_QEMU_MAC=$2; export RCU_QEMU_MAC
123 shift
124 ;;
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700125 --qemu-args)
126 checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error'
127 RCU_QEMU_ARG="$2"
128 shift
129 ;;
Paul E. McKenney4f8a0312013-09-30 17:17:57 -0700130 --qemu-cmd)
131 checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--'
132 RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD
133 shift
134 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700135 --relbuilddir)
136 checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
137 relbuilddir=$2
138 gotrelbuilddir=1
139 builddir=${KVM}/${relbuilddir}
140 shift
141 ;;
142 --results)
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700143 checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error'
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700144 resdir=$2
145 shift
146 ;;
147 *)
Paul E. McKenney2bcdf4e2013-10-01 10:14:09 -0700148 echo Unknown argument $1
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700149 usage
150 ;;
151 esac
152 shift
153done
154
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700155PATH=${KVM}/bin:$PATH; export PATH
156CONFIGFRAG=${KVM}/configs; export CONFIGFRAG
Paul E. McKenney4275be82013-09-29 11:13:46 -0700157KVPATH=${CONFIGFRAG}/$kversion; export KVPATH
158
159if test -z "$configs"
160then
161 configs="`cat $CONFIGFRAG/$kversion/CFLIST`"
162fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700163
164if test -z "$resdir"
165then
166 resdir=$KVM/res
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700167 if ! test -e $resdir
168 then
169 mkdir $resdir || :
170 fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700171else
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700172 if ! test -e $resdir
173 then
174 mkdir -p "$resdir" || :
175 fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700176fi
Paul E. McKenney847bfd22013-09-28 18:44:11 -0700177mkdir $resdir/$ds
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700178touch $resdir/$ds/log
179echo $scriptname $args >> $resdir/$ds/log
Paul E. McKenney847bfd22013-09-28 18:44:11 -0700180
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700181pwd > $resdir/$ds/testid.txt
182if test -d .git
183then
184 git status >> $resdir/$ds/testid.txt
185 git rev-parse HEAD >> $resdir/$ds/testid.txt
186fi
187builddir=$KVM/b1
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700188if ! test -e $builddir
189then
190 mkdir $builddir || :
191fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700192
193for CF in $configs
194do
195 rd=$resdir/$ds/$CF
196 mkdir $rd || :
197 echo Results directory: $rd
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700198 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"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700199done
200# 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