torture: Use a single build directory for torture scenarios
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 23 Apr 2018 21:03:00 +0000 (14:03 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 25 Jun 2018 18:30:10 +0000 (11:30 -0700)
The torture scripting currently builds each kernel from a set of parallel
runs in its own build directory.  This can waste quite a bit of space when
running large numbers of concurrent scenarios, and pointlessly given that
the builds are run sequentially (albeit with a largish -j number passed to
"make").  This commit therefore places all build-command output in the
results directory, then does all builds in a single "b1" build directory.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
tools/testing/selftests/rcutorture/bin/configinit.sh
tools/testing/selftests/rcutorture/bin/kvm-build.sh
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
tools/testing/selftests/rcutorture/bin/kvm.sh

index c15f270e121d61af0e80b19f8a69d47fe68e88de..65541c21a5444abbad5face676e223c0934de39e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Usage: configinit.sh config-spec-file [ build output dir ]
+# Usage: configinit.sh config-spec-file build-output-dir results-dir
 #
 # Create a .config file from the spec file.  Run from the kernel source tree.
 # Exits with 0 if all went well, with 1 if all went well but the config
@@ -40,20 +40,18 @@ mkdir $T
 
 c=$1
 buildloc=$2
+resdir=$3
 builddir=
-if test -n $buildloc
+if echo $buildloc | grep -q '^O='
 then
-       if echo $buildloc | grep -q '^O='
+       builddir=`echo $buildloc | sed -e 's/^O=//'`
+       if test ! -d $builddir
        then
-               builddir=`echo $buildloc | sed -e 's/^O=//'`
-               if test ! -d $builddir
-               then
-                       mkdir $builddir
-               fi
-       else
-               echo Bad build directory: \"$buildloc\"
-               exit 2
+               mkdir $builddir
        fi
+else
+       echo Bad build directory: \"$buildloc\"
+       exit 2
 fi
 
 sed -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh
@@ -61,12 +59,12 @@ sed -e 's/^\(CONFIG[0-9A-Z_]*=\).*$/grep -v \1 |/' < $c >> $T/u.sh
 grep '^grep' < $T/u.sh > $T/upd.sh
 echo "cat - $c" >> $T/upd.sh
 make mrproper
-make $buildloc distclean > $builddir/Make.distclean 2>&1
-make $buildloc $TORTURE_DEFCONFIG > $builddir/Make.defconfig.out 2>&1
+make $buildloc distclean > $resdir/Make.distclean 2>&1
+make $buildloc $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out 2>&1
 mv $builddir/.config $builddir/.config.sav
 sh $T/upd.sh < $builddir/.config.sav > $builddir/.config
 cp $builddir/.config $builddir/.config.new
-yes '' | make $buildloc oldconfig > $builddir/Make.oldconfig.out 2> $builddir/Make.oldconfig.err
+yes '' | make $buildloc oldconfig > $resdir/Make.oldconfig.out 2> $resdir/Make.oldconfig.err
 
 # verify new config matches specification.
 configcheck.sh $builddir/.config $c
index 34d126734cde9f1dd3109077e5810d491aa88562..9115fcdb5617cdcb7f72dbcf23bdd523f32528e6 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # Build a kvm-ready Linux kernel from the tree in the current directory.
 #
-# Usage: kvm-build.sh config-template build-dir
+# Usage: kvm-build.sh config-template build-dir resdir
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ then
        exit 1
 fi
 builddir=${2}
+resdir=${3}
 
 T=${TMPDIR-/tmp}/test-linux.sh.$$
 trap 'rm -rf $T' 0
@@ -41,19 +42,19 @@ CONFIG_VIRTIO_PCI=y
 CONFIG_VIRTIO_CONSOLE=y
 ___EOF___
 
-configinit.sh $T/config O=$builddir
+configinit.sh $T/config O=$builddir $resdir
 retval=$?
 if test $retval -gt 1
 then
        exit 2
 fi
 ncpus=`cpus2use.sh`
-make O=$builddir -j$ncpus $TORTURE_KMAKE_ARG > $builddir/Make.out 2>&1
+make O=$builddir -j$ncpus $TORTURE_KMAKE_ARG > $resdir/Make.out 2>&1
 retval=$?
-if test $retval -ne 0 || grep "rcu[^/]*": < $builddir/Make.out | egrep -q "Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < $builddir/Make.out
+if test $retval -ne 0 || grep "rcu[^/]*": < $resdir/Make.out | egrep -q "Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < $resdir/Make.out
 then
        echo Kernel build error
-       egrep "Stop|Error|error:|warning:" < $builddir/Make.out
+       egrep "Stop|Error|error:|warning:" < $resdir/Make.out
        echo Run aborted.
        exit 3
 fi
index c5b0f94341d9a686d16b9eb52a3ecc6e5d990fc0..f7247ee00514d97b368e91338721fd8090b8a98c 100755 (executable)
@@ -98,14 +98,15 @@ then
        ln -s $base_resdir/.config $resdir  # for kvm-recheck.sh
        # Arch-independent indicator
        touch $resdir/builtkernel
-elif kvm-build.sh $T/Kc2 $builddir
+elif kvm-build.sh $T/Kc2 $builddir $resdir
 then
        # Had to build a kernel for this test.
        QEMU="`identify_qemu $builddir/vmlinux`"
        BOOT_IMAGE="`identify_boot_image $QEMU`"
-       cp $builddir/Make*.out $resdir
        cp $builddir/vmlinux $resdir
        cp $builddir/.config $resdir
+       cp $builddir/Module.symvers $resdir > /dev/null || :
+       cp $builddir/System.map $resdir > /dev/null || :
        if test -n "$BOOT_IMAGE"
        then
                cp $builddir/$BOOT_IMAGE $resdir
index 56610dbbdf73ffc6e390015a538df89eb6096830..5a7a62d76a50b91234b82fb1455ffc0d66f637a6 100755 (executable)
@@ -347,7 +347,7 @@ function dump(first, pastlast, batchnum)
        print "needqemurun="
        jn=1
        for (j = first; j < pastlast; j++) {
-               builddir=KVM "/b" jn
+               builddir=KVM "/b1"
                cpusr[jn] = cpus[j];
                if (cfrep[cf[j]] == "") {
                        cfr[jn] = cf[j];