blob: 1b7923bf6a702a921040c86970cbe8d9dc47a2a6 [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
Paul E. McKenney0e342a82013-12-03 09:54:18 -080023# along with this program; if not, you can access it online at
24# http://www.gnu.org/licenses/gpl-2.0.html.
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070025#
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
Paul E. McKenney73931b52013-10-15 10:42:25 -070034KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
Paul E. McKenney32caccb2013-10-28 08:57:29 -070035PATH=${KVM}/bin:$PATH; export PATH
Paul E. McKenney73931b52013-10-15 10:42:25 -070036builddir="${KVM}/b1"
37RCU_INITRD="$KVM/initrd"; export RCU_INITRD
Paul E. McKenney74878fb2013-10-15 11:51:23 -070038RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070039resdir=""
Paul E. McKenney4275be82013-09-29 11:13:46 -070040configs=""
Paul E. McKenney847bfd22013-09-28 18:44:11 -070041ds=`date +%Y.%m.%d-%H:%M:%S`
Paul E. McKenneybb918532013-09-28 20:37:45 -070042kversion=""
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070043
Paul E. McKenney32caccb2013-10-28 08:57:29 -070044. functions.sh
45
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070046usage () {
47 echo "Usage: $scriptname optional arguments:"
Paul E. McKenney7dca9272013-10-14 08:19:39 -070048 echo " --bootargs kernel-boot-arguments"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070049 echo " --builddir absolute-pathname"
Paul E. McKenney11274812013-10-10 14:52:07 -070050 echo " --buildonly"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070051 echo " --configs \"config-file list\""
Paul E. McKenney847bfd22013-09-28 18:44:11 -070052 echo " --datestamp string"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070053 echo " --duration minutes"
Paul E. McKenney315c5402013-10-04 13:15:55 -070054 echo " --interactive"
Paul E. McKenney74878fb2013-10-15 11:51:23 -070055 echo " --kmake-arg kernel-make-arguments"
Paul E. McKenneybb918532013-09-28 20:37:45 -070056 echo " --kversion vN.NN"
Paul E. McKenney315c5402013-10-04 13:15:55 -070057 echo " --mac nn:nn:nn:nn:nn:nn"
Paul E. McKenney73931b52013-10-15 10:42:25 -070058 echo " --no-initrd"
Paul E. McKenneye9ce6402013-10-15 09:22:48 -070059 echo " --qemu-args qemu-system-..."
Paul E. McKenney4f8a0312013-09-30 17:17:57 -070060 echo " --qemu-cmd qemu-system-..."
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070061 echo " --results absolute-pathname"
62 echo " --relbuilddir relative-pathname"
63 exit 1
64}
65
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070066while test $# -gt 0
67do
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070068 case "$1" in
Paul E. McKenney7dca9272013-10-14 08:19:39 -070069 --bootargs)
70 checkarg --bootargs "(list of kernel boot arguments)" "$#" "$2" '.*' '^--'
71 RCU_BOOTARGS="$2"
72 shift
73 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070074 --builddir)
Paul E. McKenneye9ce6402013-10-15 09:22:48 -070075 checkarg --builddir "(absolute pathname)" "$#" "$2" '^/' '^error'
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070076 builddir=$2
77 gotbuilddir=1
78 shift
79 ;;
Paul E. McKenney11274812013-10-10 14:52:07 -070080 --buildonly)
81 RCU_BUILDONLY=1; export RCU_BUILDONLY
82 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070083 --configs)
84 checkarg --configs "(list of config files)" "$#" "$2" '^[^/]*$' '^--'
85 configs="$2"
86 shift
87 ;;
Paul E. McKenney847bfd22013-09-28 18:44:11 -070088 --datestamp)
89 checkarg --datestamp "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
90 ds=$2
91 shift
92 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070093 --duration)
Paul E. McKenneye9ce6402013-10-15 09:22:48 -070094 checkarg --duration "(minutes)" $# "$2" '^[0-9]*$' '^error'
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -070095 dur=$2
96 shift
97 ;;
Paul E. McKenney315c5402013-10-04 13:15:55 -070098 --interactive)
99 RCU_QEMU_INTERACTIVE=1; export RCU_QEMU_INTERACTIVE
100 ;;
Paul E. McKenney74878fb2013-10-15 11:51:23 -0700101 --kmake-arg)
102 checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$'
103 RCU_KMAKE_ARG="$2"; export RCU_KMAKE_ARG
104 shift
105 ;;
Paul E. McKenneybb918532013-09-28 20:37:45 -0700106 --kversion)
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700107 checkarg --kversion "(kernel version)" $# "$2" '^v[0-9.]*$' '^error'
Paul E. McKenneybb918532013-09-28 20:37:45 -0700108 kversion=$2
109 shift
110 ;;
Paul E. McKenney315c5402013-10-04 13:15:55 -0700111 --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 ;;
Paul E. McKenney73931b52013-10-15 10:42:25 -0700116 --no-initrd)
117 RCU_INITRD=""; export RCU_INITRD
118 ;;
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700119 --qemu-args)
120 checkarg --qemu-args "-qemu args" $# "$2" '^-' '^error'
121 RCU_QEMU_ARG="$2"
122 shift
123 ;;
Paul E. McKenney4f8a0312013-09-30 17:17:57 -0700124 --qemu-cmd)
125 checkarg --qemu-cmd "(qemu-system-...)" $# "$2" 'qemu-system-' '^--'
126 RCU_QEMU_CMD="$2"; export RCU_QEMU_CMD
127 shift
128 ;;
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700129 --relbuilddir)
130 checkarg --relbuilddir "(relative pathname)" "$#" "$2" '^[^/]*$' '^--'
131 relbuilddir=$2
132 gotrelbuilddir=1
133 builddir=${KVM}/${relbuilddir}
134 shift
135 ;;
136 --results)
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700137 checkarg --results "(absolute pathname)" "$#" "$2" '^/' '^error'
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700138 resdir=$2
139 shift
140 ;;
141 *)
Paul E. McKenney2bcdf4e2013-10-01 10:14:09 -0700142 echo Unknown argument $1
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700143 usage
144 ;;
145 esac
146 shift
147done
148
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700149CONFIGFRAG=${KVM}/configs; export CONFIGFRAG
Paul E. McKenney4275be82013-09-29 11:13:46 -0700150KVPATH=${CONFIGFRAG}/$kversion; export KVPATH
151
152if test -z "$configs"
153then
154 configs="`cat $CONFIGFRAG/$kversion/CFLIST`"
155fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700156
157if test -z "$resdir"
158then
159 resdir=$KVM/res
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700160 if ! test -e $resdir
161 then
162 mkdir $resdir || :
163 fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700164else
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700165 if ! test -e $resdir
166 then
167 mkdir -p "$resdir" || :
168 fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700169fi
Paul E. McKenney847bfd22013-09-28 18:44:11 -0700170mkdir $resdir/$ds
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700171touch $resdir/$ds/log
172echo $scriptname $args >> $resdir/$ds/log
Paul E. McKenney847bfd22013-09-28 18:44:11 -0700173
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700174pwd > $resdir/$ds/testid.txt
175if test -d .git
176then
177 git status >> $resdir/$ds/testid.txt
178 git rev-parse HEAD >> $resdir/$ds/testid.txt
179fi
180builddir=$KVM/b1
Paul E. McKenney330a76f2013-09-30 14:49:43 -0700181if ! test -e $builddir
182then
183 mkdir $builddir || :
184fi
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700185
186for CF in $configs
187do
Paul E. McKenneyf43f8f72013-10-19 06:28:21 -0700188 # Running TREE01 multiple times creates TREE01, TREE01.2, TREE01.3, ...
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700189 rd=$resdir/$ds/$CF
Paul E. McKenneyf43f8f72013-10-19 06:28:21 -0700190 if test -d "${rd}"
191 then
192 n="`ls -d "${rd}"* | grep '\.[0-9]\+$' |
193 sed -e 's/^.*\.\([0-9]\+\)/\1/' |
194 sort -k1n | tail -1`"
195 if test -z "$n"
196 then
197 rd="${rd}.2"
198 else
199 n="`expr $n + 1`"
200 rd="${rd}.${n}"
201 fi
202 fi
203 mkdir "${rd}"
Paul E. McKenneyc87b9c62013-09-28 14:12:21 -0700204 echo Results directory: $rd
Paul E. McKenneye9ce6402013-10-15 09:22:48 -0700205 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 -0700206done
Paul E. McKenney782ab4c2013-10-15 12:11:24 -0700207# 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
Paul E. McKenneye1362652013-10-15 12:22:32 -0700208
209echo " --- `date` Test summary:"
210kvm-recheck.sh $resdir/$ds