blob: 6c67d0ca8c9aa629884b661fae3a6ed4fc9d571c [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:"
43 echo " --builddir absolute-pathname"
Paul E. McKenney11274812013-10-10 14:52:07 -070044 echo " --buildonly"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070045 echo " --configs \"config-file list\""
Paul E. McKenney847bfd22013-09-28 18:44:11 -070046 echo " --datestamp string"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070047 echo " --duration minutes"
Paul E. McKenney315c5402013-10-04 13:15:55 -070048 echo " --interactive"
Paul E. McKenneybb918532013-09-28 20:37:45 -070049 echo " --kversion vN.NN"
Paul E. McKenney315c5402013-10-04 13:15:55 -070050 echo " --mac nn:nn:nn:nn:nn:nn"
Paul E. McKenney4f8a0312013-09-30 17:17:57 -070051 echo " --qemu-cmd qemu-system-..."
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070052 echo " --results absolute-pathname"
53 echo " --relbuilddir relative-pathname"
54 exit 1
55}
56
57# checkarg --argname argtype $# arg mustmatch cannotmatch
58checkarg () {
59 if test $3 -le 1
60 then
61 echo $1 needs argument $2 matching \"$5\"
62 usage
63 fi
64 if echo "$4" | grep -q -e "$5"
65 then
66 :
67 else
68 echo $1 $2 \"$4\" must match \"$5\"
69 usage
70 fi
71 if echo "$4" | grep -q -e "$6"
72 then
73 echo $1 $2 \"$4\" must not match \"$6\"
74 usage
75 fi
76}
77
78while test $# -gt 0
79do
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070080 case "$1" in
81 --builddir)
82 checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' error
83 builddir=$2
84 gotbuilddir=1
85 shift
86 ;;
Paul E. McKenney11274812013-10-10 14:52:07 -070087 --buildonly)
88 RCU_BUILDONLY=1; export RCU_BUILDONLY
89 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070090 --configs)
91 checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--'
92 configs="$2"
93 shift
94 ;;
Paul E. McKenney847bfd22013-09-28 18:44:11 -070095 --datestamp)
96 checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
97 ds=$2
98 shift
99 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700100 --duration)
101 checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' error
102 dur=$2
103 shift
104 ;;
Paul E. McKenney315c5402013-10-04 13:15:55 -0700105 --interactive)
106 RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE
107 ;;
Paul E. McKenneybb918532013-09-28 20:37:45 -0700108 --kversion)
109 checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' error
110 kversion=$2
111 shift
112 ;;
Paul E. McKenney315c5402013-10-04 13:15:55 -0700113 --mac)
114 checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error
115 RCU_QEMU_MAC=$2; export RCU_QEMU_MAC
116 shift
117 ;;
Paul E. McKenney4f8a0312013-09-30 17:17:57 -0700118 --qemu-cmd)
119 checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--'
120 RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD
121 shift
122 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700123 --relbuilddir)
124 checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
125 relbuilddir=$2
126 gotrelbuilddir=1
127 builddir=${KVM}/${relbuilddir}
128 shift
129 ;;
130 --results)
131 checkarg --results "(absolute pathname)" "$#" "$2" '^/' error
132 resdir=$2
133 shift
134 ;;
135 *)
Paul E. McKenney2bcdf4e2013-10-01 10:14:09 -0700136 echo Unknown argument $1
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700137 usage
138 ;;
139 esac
140 shift
141done
142
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700143PATH=${KVM}/bin:$PATH; export PATH
144CONFIGFRAG=${KVM}/configs; export CONFIGFRAG
Paul E. McKenney4275be82013-09-29 11:13:46 -0700145KVPATH=${CONFIGFRAG}/$kversion; export KVPATH
146
147if test -z "$configs"
148then
149 configs="`cat $CONFIGFRAG/$kversion/CFLIST`"
150fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700151
152if test -z "$resdir"
153then
154 resdir=$KVM/res
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700155 if ! test -e $resdir
156 then
157 mkdir $resdir || :
158 fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700159else
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700160 if ! test -e $resdir
161 then
162 mkdir -p "$resdir" || :
163 fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700164fi
Paul E. McKenney847bfd22013-09-28 18:44:11 -0700165mkdir $resdir/$ds
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700166touch $resdir/$ds/log
167echo $scriptname $args >> $resdir/$ds/log
Paul E. McKenney847bfd22013-09-28 18:44:11 -0700168
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700169pwd > $resdir/$ds/testid.txt
170if test -d .git
171then
172 git status >> $resdir/$ds/testid.txt
173 git rev-parse HEAD >> $resdir/$ds/testid.txt
174fi
175builddir=$KVM/b1
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700176if ! test -e $builddir
177then
178 mkdir $builddir || :
179fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700180
181for CF in $configs
182do
183 rd=$resdir/$ds/$CF
184 mkdir $rd || :
185 echo Results directory: $rd
Paul E. McKenney4275be82013-09-29 11:13:46 -0700186 kvm-test-1-rcu.sh $CONFIGFRAG/$kversion/$CF $builddir $rd $dur "-nographic" "rcutorture.test_no_idle_hz=1 rcutorture.verbose=1"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700187done
188# 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