3 # Run a kvm-based test of the specified tree on the specified configs.
4 # Fully automated run and error checking, no graphics console.
6 # Execute this in the source tree. Do not run it as a background task
7 # because qemu does not seem to like that much.
9 # Usage: sh kvm-test-1-rcu.sh config builddir resdir minutes qemu-args bootargs
11 # qemu-args defaults to "" -- you will want "-nographic" if running headless.
12 # bootargs defaults to "root=/dev/sda noapic selinux=0 console=ttyS0"
13 # "initcall_debug debug rcutorture.stat_interval=15"
14 # "rcutorture.shutdown_secs=$((minutes * 60))"
15 # "rcutorture.rcutorture_runnable=1"
17 # Anything you specify for either qemu-args or bootargs is appended to
18 # the default values. The "-smp" value is deduced from the contents of
19 # the config fragment.
21 # More sophisticated argument parsing is clearly needed.
23 # This program is free software; you can redistribute it and/or modify
24 # it under the terms of the GNU General Public License as published by
25 # the Free Software Foundation; either version 2 of the License, or
26 # (at your option) any later version.
28 # This program is distributed in the hope that it will be useful,
29 # but WITHOUT ANY WARRANTY; without even the implied warranty of
30 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 # GNU General Public License for more details.
33 # You should have received a copy of the GNU General Public License
34 # along with this program; if not, write to the Free Software
35 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 # Copyright (C) IBM Corporation, 2011
39 # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
43 T
=/tmp
/kvm-test-1-rcu.sh.$$
46 .
$KVM/bin
/functions.sh
49 title
=`echo $config_template | sed -e 's/^.*\///'`
51 if test -z "$builddir" -o ! -d "$builddir" -o ! -w "$builddir"
53 echo "kvm-test-1-rcu.sh :$builddir: Not a writable directory, cannot build into it"
57 if test -z "$resdir" -o ! -d "$resdir" -o ! -w "$resdir"
59 echo "kvm-test-1-rcu.sh :$resdir: Not a writable directory, cannot build into it"
62 cp $config_template $resdir/ConfigFragment
63 echo ' ---' `date`: Starting build
64 cat << '___EOF___' >> $T
65 CONFIG_RCU_TORTURE_TEST
=y
67 # Optimizations below this point
72 # CONFIG_INPUT_JOYSTICK=n
73 # CONFIG_INPUT_TABLET=n
74 # CONFIG_INPUT_TOUCHSCREEN=n
76 # CONFIG_INPUT_MOUSE=n
77 # # CONFIG_NET=n # disables console access, so accept the slower build.
91 if kvm-build.sh
$config_template $builddir $T
93 cp $builddir/Make
*.out
$resdir
94 cp $builddir/.config
$resdir
95 cp $builddir/arch
/x86
/boot
/bzImage
$resdir
96 parse-build.sh
$resdir/Make.out
$title
98 cp $builddir/Make
*.out
$resdir
99 echo Build failed
, not running KVM
, see
$resdir.
103 seconds
=$
(($minutes * 60))
108 kstarttime
=`awk 'BEGIN { print systime() }' < /dev/null`
109 echo ' ---' `date`: Starting kernel
110 if file linux-2.6
/*.o |
grep -q 64-bit
112 QEMU
=qemu-system-x86_64
114 QEMU
=qemu-system-i386
117 # Generate -smp qemu argument.
118 cpu_count
=`configNR_CPUS.sh $config_template`
119 ncpus
=`grep '^processor' /proc/cpuinfo | wc -l`
120 if test $cpu_count -gt $ncpus
122 echo CPU count limited from
$cpu_count to
$ncpus
123 touch $resdir/Warnings
124 echo CPU count limited from
$cpu_count to
$ncpus >> $resdir/Warnings
127 if echo $qemu_args |
grep -q -e -smp
129 echo CPU count specified by caller
131 qemu_args
="$qemu_args -smp $cpu_count"
134 # Generate CPU-hotplug boot parameters
135 if ! bootparam_hotplug_cpu
"$bootargs"
137 if configfrag_hotplug_cpu
$builddir/.config
139 echo Kernel configured
for CPU hotplug
, adding rcutorture.
140 bootargs
="$bootargs rcutorture.onoff_interval=3 rcutorture.onoff_holdoff=30"
144 echo $QEMU -name rcu-test
-serial file:$builddir/console.log
$qemu_args -m 512 -kernel $builddir/arch
/x86
/boot
/bzImage
-append \"noapic selinux
=0 console
=ttyS0 initcall_debug debug rcutorture.stat_interval
=15 rcutorture.shutdown_secs
=$seconds rcutorture.rcutorture_runnable
=1 $boot_args\" > $resdir/qemu-cmd
145 $QEMU -name rcu-test
-serial file:$builddir/console.log
$qemu_args -m 512 -kernel $builddir/arch
/x86
/boot
/bzImage
-append "noapic selinux=0 console=ttyS0 initcall_debug debug rcutorture.stat_interval=15 rcutorture.shutdown_secs=$seconds rcutorture.rcutorture_runnable=1 $boot_args" &
148 echo Monitoring qemu job
at pid
$qemu_pid
149 for ((i
=0;i
<$seconds;i
++))
151 if kill -0 $qemu_pid > /dev
/null
2>&1
156 kruntime
=`awk 'BEGIN { print systime() - '"$kstarttime"' }' < /dev/null`
157 if test $kruntime -lt $seconds
159 echo Completed
in $kruntime vs.
$seconds >> $resdir/Warnings
2>&1
161 echo ' ---' `date`: Kernel
done
166 if test $commandcompleted -eq 0
168 echo Grace period
for qemu job
at pid
$qemu_pid
169 for ((i
=0;i
<=$grace;i
++))
171 if kill -0 $qemu_pid > /dev
/null
2>&1
177 if test $i -eq $grace
179 kruntime
=`awk 'BEGIN { print systime() - '"$kstarttime"' }'`
180 echo "!!! Hang at $kruntime vs. $seconds seconds" >> $resdir/Warnings
2>&1
186 cp $builddir/console.log
$resdir
187 parse-rcutorture.sh
$resdir/console.log
$title >> $resdir/Warnings
2>&1
188 parse-console.sh
$resdir/console.log
$title >> $resdir/Warnings
2>&1