rcutorture: Don't wait for kernel when all builds fail
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 2 May 2017 22:22:26 +0000 (15:22 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 24 Jul 2017 23:04:11 +0000 (16:04 -0700)
Currently, rcutorture groups runs in batches, building each scenario in
a given batch, then invoking qemu to run all the kernels in the batch.
Of course, if a given scenario's kernel fails to build, there is no qemu
run for that scenario.  And if all of the kernels in a given batch fail
to build, there are no runs, and rcutorture immediately starts on the
next batch.

But not if --jitter has been specified, which it is by default.  In this
case, the jitter scripts are started unconditionally, and rcutorture
waits for them to complete, even though there are no kernels to run.

This commit therefore checks for this situation, and refuses to start
jitter unless at least one of the kernels in the batch built successfully.
This saves substantial time when all scenarios' kernels fail to build,
particularly if a long --duration was specified.

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

index 2a3f87a8c87d3f5d2e76379a4e59d0dc3f53b1a6..0af36a721b9c325ce8897f24889c4d3c3556594d 100755 (executable)
@@ -96,6 +96,8 @@ then
        KERNEL=$base_resdir/${BOOT_IMAGE##*/} # use the last component of ${BOOT_IMAGE}
        ln -s $base_resdir/Make*.out $resdir  # for kvm-recheck.sh
        ln -s $base_resdir/.config $resdir  # for kvm-recheck.sh
+       # Arch-independent indicator
+       touch $resdir/builtkernel
 elif kvm-build.sh $T/Kc2 $builddir
 then
        # Had to build a kernel for this test.
@@ -108,6 +110,8 @@ then
        then
                cp $builddir/$BOOT_IMAGE $resdir
                KERNEL=$resdir/${BOOT_IMAGE##*/}
+               # Arch-independent indicator
+               touch $resdir/builtkernel
        else
                echo No identifiable boot image, not running KVM, see $resdir.
                echo Do the torture scripts know about your architecture?
index 690cb91f0295edfff440eb28ddf6180dc10f5295..cdb32aa79366aad0814c12225c45c2af0ddc459b 100755 (executable)
@@ -332,6 +332,7 @@ function dump(first, pastlast, batchnum)
 {
        print "echo ----Start batch " batchnum ": `date`";
        print "echo ----Start batch " batchnum ": `date` >> " rd "/log";
+       print "needqemurun="
        jn=1
        for (j = first; j < pastlast; j++) {
                builddir=KVM "/b" jn
@@ -367,10 +368,11 @@ function dump(first, pastlast, batchnum)
        for (j = 1; j < jn; j++) {
                builddir=KVM "/b" j
                print "rm -f " builddir ".ready"
-               print "if test -z \"$TORTURE_BUILDONLY\""
+               print "if test -f \"" rd cfr[j] "/builtkernel\""
                print "then"
-               print "\techo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date`";
-               print "\techo ----", cfr[j], cpusr[j] ovf ": Starting kernel. `date` >> " rd "/log";
+               print "\techo ----", cfr[j], cpusr[j] ovf ": Kernel present. `date`";
+               print "\techo ----", cfr[j], cpusr[j] ovf ": Kernel present. `date` >> " rd "/log";
+               print "\tneedqemurun=1"
                print "fi"
        }
        njitter = 0;
@@ -385,13 +387,22 @@ function dump(first, pastlast, batchnum)
                njitter = 0;
                print "echo Build-only run, so suppressing jitter >> " rd "/log"
        }
-       for (j = 0; j < njitter; j++)
-               print "jitter.sh " j " " dur " " ja[2] " " ja[3] "&"
-       print "wait"
-       print "if test -z \"$TORTURE_BUILDONLY\""
+       if (TORTURE_BUILDONLY) {
+               print "needqemurun="
+       }
+       print "if test -n \"$needqemurun\""
        print "then"
+       print "\techo ---- Starting kernels. `date`";
+       print "\techo ---- Starting kernels. `date` >> " rd "/log";
+       for (j = 0; j < njitter; j++)
+               print "\tjitter.sh " j " " dur " " ja[2] " " ja[3] "&"
+       print "\twait"
        print "\techo ---- All kernel runs complete. `date`";
        print "\techo ---- All kernel runs complete. `date` >> " rd "/log";
+       print "else"
+       print "\twait"
+       print "\techo ---- No kernel runs. `date`";
+       print "\techo ---- No kernel runs. `date` >> " rd "/log";
        print "fi"
        for (j = 1; j < jn; j++) {
                builddir=KVM "/b" j