Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / tools / testing / selftests / rcutorture / bin / kvm-build.sh
blob34d126734cde9f1dd3109077e5810d491aa88562
1 #!/bin/bash
3 # Build a kvm-ready Linux kernel from the tree in the current directory.
5 # Usage: kvm-build.sh config-template build-dir
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, you can access it online at
19 # http://www.gnu.org/licenses/gpl-2.0.html.
21 # Copyright (C) IBM Corporation, 2011
23 # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
25 config_template=${1}
26 if test -z "$config_template" -o ! -f "$config_template" -o ! -r "$config_template"
27 then
28 echo "kvm-build.sh :$config_template: Not a readable file"
29 exit 1
31 builddir=${2}
33 T=${TMPDIR-/tmp}/test-linux.sh.$$
34 trap 'rm -rf $T' 0
35 mkdir $T
37 cp ${config_template} $T/config
38 cat << ___EOF___ >> $T/config
39 CONFIG_INITRAMFS_SOURCE="$TORTURE_INITRD"
40 CONFIG_VIRTIO_PCI=y
41 CONFIG_VIRTIO_CONSOLE=y
42 ___EOF___
44 configinit.sh $T/config O=$builddir
45 retval=$?
46 if test $retval -gt 1
47 then
48 exit 2
50 ncpus=`cpus2use.sh`
51 make O=$builddir -j$ncpus $TORTURE_KMAKE_ARG > $builddir/Make.out 2>&1
52 retval=$?
53 if test $retval -ne 0 || grep "rcu[^/]*": < $builddir/Make.out | egrep -q "Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < $builddir/Make.out
54 then
55 echo Kernel build error
56 egrep "Stop|Error|error:|warning:" < $builddir/Make.out
57 echo Run aborted.
58 exit 3