blob: 979c3413463465eb203622185d3e8f9ff017525f [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"
44 echo " --configs \"config-file list\""
Paul E. McKenney847bfd22013-09-28 18:44:11 -070045 echo " --datestamp string"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070046 echo " --duration minutes"
Paul E. McKenney315c5402013-10-04 13:15:55 -070047 echo " --interactive"
Paul E. McKenneybb918532013-09-28 20:37:45 -070048 echo " --kversion vN.NN"
Paul E. McKenney315c5402013-10-04 13:15:55 -070049 echo " --mac nn:nn:nn:nn:nn:nn"
Paul E. McKenney4f8a0312013-09-30 17:17:57 -070050 echo " --qemu-cmd qemu-system-..."
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070051 echo " --results absolute-pathname"
52 echo " --relbuilddir relative-pathname"
53 exit 1
54}
55
56# checkarg --argname argtype $# arg mustmatch cannotmatch
57checkarg () {
58 if test $3 -le 1
59 then
60 echo $1 needs argument $2 matching \"$5\"
61 usage
62 fi
63 if echo "$4" | grep -q -e "$5"
64 then
65 :
66 else
67 echo $1 $2 \"$4\" must match \"$5\"
68 usage
69 fi
70 if echo "$4" | grep -q -e "$6"
71 then
72 echo $1 $2 \"$4\" must not match \"$6\"
73 usage
74 fi
75}
76
77while test $# -gt 0
78do
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070079 case "$1" in
80 --builddir)
81 checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' error
82 builddir=$2
83 gotbuilddir=1
84 shift
85 ;;
86 --configs)
87 checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--'
88 configs="$2"
89 shift
90 ;;
Paul E. McKenney847bfd22013-09-28 18:44:11 -070091 --datestamp)
92 checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
93 ds=$2
94 shift
95 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070096 --duration)
97 checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' error
98 dur=$2
99 shift
100 ;;
Paul E. McKenney315c5402013-10-04 13:15:55 -0700101 --interactive)
102 RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE
103 ;;
Paul E. McKenneybb918532013-09-28 20:37:45 -0700104 --kversion)
105 checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' error
106 kversion=$2
107 shift
108 ;;
Paul E. McKenney315c5402013-10-04 13:15:55 -0700109 --mac)
110 checkarg --mac "(MAC address)" $# "$2" '^\([0-9a-fA-F]\{2\}:\)\{5\}[0-9a-fA-F]\{2\}$' error
111 RCU_QEMU_MAC=$2; export RCU_QEMU_MAC
112 shift
113 ;;
Paul E. McKenney4f8a0312013-09-30 17:17:57 -0700114 --qemu-cmd)
115 checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--'
116 RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD
117 shift
118 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700119 --relbuilddir)
120 checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
121 relbuilddir=$2
122 gotrelbuilddir=1
123 builddir=${KVM}/${relbuilddir}
124 shift
125 ;;
126 --results)
127 checkarg --results "(absolute pathname)" "$#" "$2" '^/' error
128 resdir=$2
129 shift
130 ;;
131 *)
Paul E. McKenney2bcdf4e2013-10-01 10:14:09 -0700132 echo Unknown argument $1
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700133 usage
134 ;;
135 esac
136 shift
137done
138
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700139PATH=${KVM}/bin:$PATH; export PATH
140CONFIGFRAG=${KVM}/configs; export CONFIGFRAG
Paul E. McKenney4275be82013-09-29 11:13:46 -0700141KVPATH=${CONFIGFRAG}/$kversion; export KVPATH
142
143if test -z "$configs"
144then
145 configs="`cat $CONFIGFRAG/$kversion/CFLIST`"
146fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700147
148if test -z "$resdir"
149then
150 resdir=$KVM/res
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700151 if ! test -e $resdir
152 then
153 mkdir $resdir || :
154 fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700155else
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700156 if ! test -e $resdir
157 then
158 mkdir -p "$resdir" || :
159 fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700160fi
Paul E. McKenney847bfd22013-09-28 18:44:11 -0700161mkdir $resdir/$ds
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700162touch $resdir/$ds/log
163echo $scriptname $args >> $resdir/$ds/log
Paul E. McKenney847bfd22013-09-28 18:44:11 -0700164
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700165pwd > $resdir/$ds/testid.txt
166if test -d .git
167then
168 git status >> $resdir/$ds/testid.txt
169 git rev-parse HEAD >> $resdir/$ds/testid.txt
170fi
171builddir=$KVM/b1
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700172if ! test -e $builddir
173then
174 mkdir $builddir || :
175fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700176
177for CF in $configs
178do
179 rd=$resdir/$ds/$CF
180 mkdir $rd || :
181 echo Results directory: $rd
Paul E. McKenney4275be82013-09-29 11:13:46 -0700182 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 -0700183done
184# 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