Commit c9a9d8e8 authored by Paul E. McKenney's avatar Paul E. McKenney

torture: Create doyesno helper function for torture.sh

This commit saves a few lines of code by creating a doyesno helper bash
function for argument parsing.
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 264da483
...@@ -47,6 +47,16 @@ do_kvfree=yes ...@@ -47,6 +47,16 @@ do_kvfree=yes
do_kasan=yes do_kasan=yes
do_kcsan=no do_kcsan=no
# doyesno - Helper function for yes/no arguments
function doyesno () {
if test "$1" = "$2"
then
echo yes
else
echo no
fi
}
usage () { usage () {
echo "Usage: $scriptname optional arguments:" echo "Usage: $scriptname optional arguments:"
echo " --doall" echo " --doall"
...@@ -79,44 +89,19 @@ do ...@@ -79,44 +89,19 @@ do
do_kcsan=yes do_kcsan=yes
;; ;;
--do-allmodconfig|--do-no-allmodconfig) --do-allmodconfig|--do-no-allmodconfig)
if test "$1" = --do-allmodconfig do_allmodconfig=`doyesno "$1" --do-allmodconfig`
then
do_allmodconfig=yes
else
do_allmodconfig=no
fi
;; ;;
--do-kasan|--do-no-kasan) --do-kasan|--do-no-kasan)
if test "$1" = --do-kasan do_kasan=`doyesno "$1" --do-kasan`
then
do_kasan=yes
else
do_kasan=no
fi
;; ;;
--do-kcsan|--do-no-kcsan) --do-kcsan|--do-no-kcsan)
if test "$1" = --do-kcsan do_kcsan=`doyesno "$1" --do-kcsan`
then
do_kcsan=yes
else
do_kcsan=no
fi
;; ;;
--do-kvfree|--do-no-kvfree) --do-kvfree|--do-no-kvfree)
if test "$1" = --do-kvfree do_kvfree=`doyesno "$1" --do-kvfree`
then
do_kvfree=yes
else
do_kvfree=no
fi
;; ;;
--do-locktorture|--do-no-locktorture) --do-locktorture|--do-no-locktorture)
if test "$1" = --do-locktorture do_locktorture=`doyesno "$1" --do-locktorture`
then
do_locktorture=yes
else
do_locktorture=no
fi
;; ;;
--do-none) --do-none)
do_allmodconfig=no do_allmodconfig=no
...@@ -130,36 +115,16 @@ do ...@@ -130,36 +115,16 @@ do
do_kcsan=no do_kcsan=no
;; ;;
--do-rcuscale|--do-no-rcuscale) --do-rcuscale|--do-no-rcuscale)
if test "$1" = --do-rcuscale do_rcuscale=`doyesno "$1" --do-rcuscale`
then
do_rcuscale=yes
else
do_rcuscale=no
fi
;; ;;
--do-rcutorture|--do-no-rcutorture) --do-rcutorture|--do-no-rcutorture)
if test "$1" = --do-rcutorture do_rcutorture=`doyesno "$1" --do-rcutorture`
then
do_rcutorture=yes
else
do_rcutorture=no
fi
;; ;;
--do-refscale|--do-no-refscale) --do-refscale|--do-no-refscale)
if test "$1" = --do-refscale do_refscale=`doyesno "$1" --do-refscale`
then
do_refscale=yes
else
do_refscale=no
fi
;; ;;
--do-scftorture|--do-no-scftorture) --do-scftorture|--do-no-scftorture)
if test "$1" = --do-scftorture do_scftorture=`doyesno "$1" --do-scftorture`
then
do_scftorture=yes
else
do_scftorture=no
fi
;; ;;
--duration) --duration)
checkarg --duration "(minutes)" $# "$2" '^[0-9][0-9]*\(m\|h\|d\|\)$' '^error' checkarg --duration "(minutes)" $# "$2" '^[0-9][0-9]*\(m\|h\|d\|\)$' '^error'
...@@ -363,11 +328,6 @@ fi ...@@ -363,11 +328,6 @@ fi
exit $ret exit $ret
# @@@ # @@@
# RCU CPU stall warnings?
# scftorture warnings?
# Need a way for the invoker to specify clang. Maybe --kcsan-kmake or some such. # Need a way for the invoker to specify clang. Maybe --kcsan-kmake or some such.
# Work out --configs based on number of available CPUs?
# Need to sense CPUs to size scftorture run. Ditto rcuscale and refscale.
# --kconfig as with --bootargs (Both have overrides.) # --kconfig as with --bootargs (Both have overrides.)
# Command line parameters for --bootargs, --config, --kconfig, --kmake-arg, and --qemu-arg # Command line parameters for --bootargs, --config, --kconfig, --kmake-arg, and --qemu-arg
# Ensure that build failures count as failures
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment