All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Paul E. McKenney" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: core/rcu] torture: Create doyesno helper function for torture.sh
Date: Fri, 12 Feb 2021 12:37:12 -0000	[thread overview]
Message-ID: <161313343299.23325.9795533429635723550.tip-bot2@tip-bot2> (raw)

The following commit has been merged into the core/rcu branch of tip:

Commit-ID:     c9a9d8e8f2e6f34e70701a1d1580eef9c76265ef
Gitweb:        https://git.kernel.org/tip/c9a9d8e8f2e6f34e70701a1d1580eef9c76265ef
Author:        Paul E. McKenney <paulmck@kernel.org>
AuthorDate:    Wed, 25 Nov 2020 10:14:24 -08:00
Committer:     Paul E. McKenney <paulmck@kernel.org>
CommitterDate: Wed, 06 Jan 2021 17:03:43 -08:00

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: Paul E. McKenney <paulmck@kernel.org>
---
 tools/testing/selftests/rcutorture/bin/torture.sh | 78 +++-----------
 1 file changed, 19 insertions(+), 59 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/torture.sh b/tools/testing/selftests/rcutorture/bin/torture.sh
index a3c3c25..a01079e 100755
--- a/tools/testing/selftests/rcutorture/bin/torture.sh
+++ b/tools/testing/selftests/rcutorture/bin/torture.sh
@@ -47,6 +47,16 @@ do_kvfree=yes
 do_kasan=yes
 do_kcsan=no
 
+# doyesno - Helper function for yes/no arguments
+function doyesno () {
+	if test "$1" = "$2"
+	then
+		echo yes
+	else
+		echo no
+	fi
+}
+
 usage () {
 	echo "Usage: $scriptname optional arguments:"
 	echo "       --doall"
@@ -79,44 +89,19 @@ do
 		do_kcsan=yes
 		;;
 	--do-allmodconfig|--do-no-allmodconfig)
-		if test "$1" = --do-allmodconfig
-		then
-			do_allmodconfig=yes
-		else
-			do_allmodconfig=no
-		fi
+		do_allmodconfig=`doyesno "$1" --do-allmodconfig`
 		;;
 	--do-kasan|--do-no-kasan)
-		if test "$1" = --do-kasan
-		then
-			do_kasan=yes
-		else
-			do_kasan=no
-		fi
+		do_kasan=`doyesno "$1" --do-kasan`
 		;;
 	--do-kcsan|--do-no-kcsan)
-		if test "$1" = --do-kcsan
-		then
-			do_kcsan=yes
-		else
-			do_kcsan=no
-		fi
+		do_kcsan=`doyesno "$1" --do-kcsan`
 		;;
 	--do-kvfree|--do-no-kvfree)
-		if test "$1" = --do-kvfree
-		then
-			do_kvfree=yes
-		else
-			do_kvfree=no
-		fi
+		do_kvfree=`doyesno "$1" --do-kvfree`
 		;;
 	--do-locktorture|--do-no-locktorture)
-		if test "$1" = --do-locktorture
-		then
-			do_locktorture=yes
-		else
-			do_locktorture=no
-		fi
+		do_locktorture=`doyesno "$1" --do-locktorture`
 		;;
 	--do-none)
 		do_allmodconfig=no
@@ -130,36 +115,16 @@ do
 		do_kcsan=no
 		;;
 	--do-rcuscale|--do-no-rcuscale)
-		if test "$1" = --do-rcuscale
-		then
-			do_rcuscale=yes
-		else
-			do_rcuscale=no
-		fi
+		do_rcuscale=`doyesno "$1" --do-rcuscale`
 		;;
 	--do-rcutorture|--do-no-rcutorture)
-		if test "$1" = --do-rcutorture
-		then
-			do_rcutorture=yes
-		else
-			do_rcutorture=no
-		fi
+		do_rcutorture=`doyesno "$1" --do-rcutorture`
 		;;
 	--do-refscale|--do-no-refscale)
-		if test "$1" = --do-refscale
-		then
-			do_refscale=yes
-		else
-			do_refscale=no
-		fi
+		do_refscale=`doyesno "$1" --do-refscale`
 		;;
 	--do-scftorture|--do-no-scftorture)
-		if test "$1" = --do-scftorture
-		then
-			do_scftorture=yes
-		else
-			do_scftorture=no
-		fi
+		do_scftorture=`doyesno "$1" --do-scftorture`
 		;;
 	--duration)
 		checkarg --duration "(minutes)" $# "$2" '^[0-9][0-9]*\(m\|h\|d\|\)$' '^error'
@@ -363,11 +328,6 @@ fi
 exit $ret
 
 # @@@
-# RCU CPU stall warnings?
-# scftorture warnings?
 # 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.)
 # Command line parameters for --bootargs, --config, --kconfig, --kmake-arg, and --qemu-arg
-# Ensure that build failures count as failures

                 reply	other threads:[~2021-02-12 12:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=161313343299.23325.9795533429635723550.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.