aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/rcutorture/bin/functions.sh
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-10-28 08:57:29 -0700
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-12-03 10:11:18 -0800
commit32caccb8f47c032df55e77102ea43c627f1ca507 (patch)
treed6598808f7f917e92337a3847bd4a13eca605ace /tools/testing/selftests/rcutorture/bin/functions.sh
parentrcutorture: Flag errors and warnings with color coding (diff)
downloadlinux-dev-32caccb8f47c032df55e77102ea43c627f1ca507.tar.xz
linux-dev-32caccb8f47c032df55e77102ea43c627f1ca507.zip
rcutorture: Move checkarg to functions.sh
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Greg KH <gregkh@linuxfoundation.org>
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/rcutorture/bin/functions.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh
index 963b6f04d4ef..3052f1bea6bf 100644
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -28,6 +28,30 @@ bootparam_hotplug_cpu () {
echo "$1" | grep -q "rcutorture\.onoff_"
}
+# checkarg --argname argtype $# arg mustmatch cannotmatch
+#
+# Checks the specified argument "arg" against the mustmatch and cannotmatch
+# patterns.
+checkarg () {
+ if test $3 -le 1
+ then
+ echo $1 needs argument $2 matching \"$5\"
+ usage
+ fi
+ if echo "$4" | grep -q -e "$5"
+ then
+ :
+ else
+ echo $1 $2 \"$4\" must match \"$5\"
+ usage
+ fi
+ if echo "$4" | grep -q -e "$6"
+ then
+ echo $1 $2 \"$4\" must not match \"$6\"
+ usage
+ fi
+}
+
# configfrag_boot_params bootparam-string config-fragment-file
#
# Adds boot parameters from the .boot file, if any.