torture: Add --dryrun batches to help schedule a distributed run
authorPaul E. McKenney <paulmck@kernel.org>
Sat, 12 Dec 2020 00:26:50 +0000 (16:26 -0800)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 4 Jan 2021 22:01:23 +0000 (14:01 -0800)
When all of the remote systems have the same number of CPUs, one
approach is to use one "--buildonly" run and one "--dryrun sched" run,
and then distributing the batches out one per remote system.  However,
the output of "--dryrun sched" is not made for parsing, so this commit
adds a "--dryrun batches" that provides the same information in easily
parsed form.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/testing/selftests/rcutorture/bin/kvm.sh

index 667896f..6b90036 100755 (executable)
@@ -60,7 +60,7 @@ usage () {
        echo "       --cpus N"
        echo "       --datestamp string"
        echo "       --defconfig string"
-       echo "       --dryrun sched|script"
+       echo "       --dryrun batches|sched|script"
        echo "       --duration minutes | <seconds>s | <hours>h | <days>d"
        echo "       --gdb"
        echo "       --help"
@@ -126,7 +126,7 @@ do
                shift
                ;;
        --dryrun)
-               checkarg --dryrun "sched|script" $# "$2" 'sched\|script' '^--'
+               checkarg --dryrun "batches|sched|script" $# "$2" 'batches\|sched\|script' '^--'
                dryrun=$2
                shift
                ;;
@@ -235,7 +235,7 @@ do
        shift
 done
 
-if test -z "$TORTURE_INITRD" || tools/testing/selftests/rcutorture/bin/mkinitrd.sh
+if test -n "$dryrun" || test -z "$TORTURE_INITRD" || tools/testing/selftests/rcutorture/bin/mkinitrd.sh
 then
        :
 else
@@ -547,8 +547,7 @@ then
 elif test "$dryrun" = sched
 then
        # Extract the test run schedule from the script.
-       egrep 'Start batch|Starting build\.' $T/script |
-               grep -v ">>" |
+       egrep 'Start batch|Starting build\.' $T/script | grep -v ">>" |
                sed -e 's/:.*$//' -e 's/^echo //'
        nbuilds="`grep 'Starting build\.' $T/script |
                  grep -v ">>" | sed -e 's/:.*$//' -e 's/^echo //' |
@@ -557,6 +556,19 @@ then
        nbatches="`grep 'Start batch' $T/script | grep -v ">>" | wc -l`"
        echo Total number of batches: $nbatches
        exit 0
+elif test "$dryrun" = batches
+then
+       # Extract the tests and their batches from the script.
+       egrep 'Start batch|Starting build\.' $T/script | grep -v ">>" |
+               sed -e 's/:.*$//' -e 's/^echo //' -e 's/-ovf//' |
+               awk '
+               /^----Start/ {
+                       batchno = $3;
+                       next;
+               }
+               {
+                       print batchno, $1, $2
+               }'
 else
        # Not a dryrun, so run the script.
        bash $T/script