This commit adds hazard-pointer torturing to the torture.sh script
as a default-on option.  This uses the same duration as rcutorture.
While in the area, change kvm.sh to tolerate the empty-string arguments
that torture.sh can generate, for example, if a given test needs no
boot arguments.

Signed-off-by: Paul E. McKenney <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Cc: Boqun Feng <[email protected]>
Cc: Bradley Morgan <[email protected]>
---
 tools/testing/selftests/rcutorture/bin/kvm.sh |  4 +++
 .../selftests/rcutorture/bin/torture.sh       | 26 ++++++++++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 32c319997638..2f386cf536e3 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -98,6 +98,7 @@ usage () {
 
 while test $# -gt 0
 do
+       echo Argument: :$1:
        case "$1" in
        --allcpus)
                cpus=$TORTURE_ALLOTED_CPUS
@@ -271,6 +272,9 @@ do
        --trust-make)
                TORTURE_TRUST_MAKE="y"
                ;;
+       "")
+               # torture.sh can pass empty arguments.  Ignore them.
+               ;;
        *)
                echo Unknown argument $1
                usage
diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh 
b/tools/testing/selftests/rcutorture/bin/torture.sh
index f0083891ee81..2824dab14d41 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -43,6 +43,7 @@ fi
 configs_rcutorture=
 configs_locktorture=
 configs_scftorture=
+configs_hazptr=
 kcsan_kmake_args=
 
 # Default compression, duration, and apportionment.
@@ -69,6 +70,7 @@ do_rt=yes
 do_rcutasksflavors="${ifnotaarch64}" # FIXME: Back to "yes" when SMP=n 
auto-avoided
 do_srcu_lockdep=yes
 do_rcu_rust=no
+do_hazptr=yes
 
 # doyesno - Helper function for yes/no arguments
 function doyesno () {
@@ -89,6 +91,7 @@ usage () {
        echo "       --do-all"
        echo "       --do-allmodconfig / --do-no-allmodconfig / 
--no-allmodconfig"
        echo "       --do-clocksourcewd / --do-no-clocksourcewd / 
--no-clocksourcewd"
+       echo "       --do-hazptr / --do-no-hazptr / --no-hazptr"
        echo "       --do-kasan / --do-no-kasan / --no-kasan"
        echo "       --do-kcsan / --do-no-kcsan / --no-kcsan"
        echo "       --do-kvfree / --do-no-kvfree / --no-kvfree"
@@ -117,6 +120,11 @@ do
                compress_concurrency=$2
                shift
                ;;
+       --config-hazptr|--configs-hazptr)
+               checkarg --configs-hazptr "(list of config files)" "$#" "$2" 
'^[^/]\+$' '^--'
+               configs_hazptr="$configs_hazptr $2"
+               shift
+               ;;
        --config-rcutorture|--configs-rcutorture)
                checkarg --configs-rcutorture "(list of config files)" "$#" 
"$2" '^[^/]\+$' '^--'
                configs_rcutorture="$configs_rcutorture $2"
@@ -147,6 +155,7 @@ do
                do_kasan=yes
                do_kcsan=yes
                do_clocksourcewd="${ifnotaarch64}"
+               do_hazptr=yes
                do_srcu_lockdep=yes
                ;;
        --do-allmodconfig|--do-no-allmodconfig|--no-allmodconfig)
@@ -155,6 +164,9 @@ do
        --do-clocksourcewd|--do-no-clocksourcewd|--no-clocksourcewd)
                do_clocksourcewd=`doyesno "$1" --do-clocksourcewd`
                ;;
+       --do-hazptr|--do-no-hazptr|--no-hazptr)
+               do_hazptr=`doyesno "$1" --do-hazptr`
+               ;;
        --do-kasan|--do-no-kasan|--no-kasan)
                do_kasan=`doyesno "$1" --do-kasan`
                ;;
@@ -182,6 +194,7 @@ do
                do_kasan=no
                do_kcsan=no
                do_clocksourcewd=no
+               do_hazptr=no
                do_srcu_lockdep=no
                ;;
        --do-normal|--do-norm|--do-no-normal|--do-no-norm|--no-normal|--no-norm)
@@ -343,7 +356,7 @@ function torture_one {
                boottag="--bootargs"
                cur_bootargs="$torture_bootargs"
        fi
-       "$@" $boottag "$cur_bootargs" --datestamp "$ds/results-$curflavor" > 
$T/$curflavor.out 2>&1
+       "$@" "${boottag}" "$cur_bootargs" --datestamp "$ds/results-$curflavor" 
> $T/$curflavor.out 2>&1
        retcode=$?
        resdir="`grep '^Results directory: ' $T/$curflavor.out | tail -1 | sed 
-e 's/^Results directory: //'`"
        if test -z "$resdir"
@@ -704,6 +717,17 @@ then
        fi
 fi
 
+# Calculate hazptr defaults and apportion time
+if test -z "$configs_hazptr"
+then
+       configs_hazptr=CFLIST
+fi
+if test "$do_hazptr" = "yes"
+then
+       torture_bootargs=""
+       torture_set "hazptr" tools/testing/selftests/rcutorture/bin/kvm.sh 
--torture hazptr --allcpus --duration "$duration_rcutorture" --configs 
"$configs_hazptr" --trust-make
+fi
+
 echo " --- " $scriptname $args
 echo " --- " Done `date` | tee -a $T/log
 ret=0
-- 
2.40.1


Reply via email to