treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / tools / testing / selftests / rcutorture / bin / kvm-build.sh
blob18d6518504ee97eedc0934a8e08e2329e57d0897
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0+
4 # Build a kvm-ready Linux kernel from the tree in the current directory.
6 # Usage: kvm-build.sh config-template resdir
8 # Copyright (C) IBM Corporation, 2011
10 # Authors: Paul E. McKenney <paulmck@linux.ibm.com>
12 config_template=${1}
13 if test -z "$config_template" -o ! -f "$config_template" -o ! -r "$config_template"
14 then
15 echo "kvm-build.sh :$config_template: Not a readable file"
16 exit 1
18 resdir=${2}
20 T=${TMPDIR-/tmp}/test-linux.sh.$$
21 trap 'rm -rf $T' 0
22 mkdir $T
24 cp ${config_template} $T/config
25 cat << ___EOF___ >> $T/config
26 CONFIG_INITRAMFS_SOURCE="$TORTURE_INITRD"
27 CONFIG_VIRTIO_PCI=y
28 CONFIG_VIRTIO_CONSOLE=y
29 ___EOF___
31 configinit.sh $T/config $resdir
32 retval=$?
33 if test $retval -gt 1
34 then
35 exit 2
37 ncpus=`cpus2use.sh`
38 make -j$ncpus $TORTURE_KMAKE_ARG > $resdir/Make.out 2>&1
39 retval=$?
40 if test $retval -ne 0 || grep "rcu[^/]*": < $resdir/Make.out | egrep -q "Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < $resdir/Make.out
41 then
42 echo Kernel build error
43 egrep "Stop|Error|error:|warning:" < $resdir/Make.out
44 echo Run aborted.
45 exit 3