summaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-10-28 11:57:29 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-12-03 13:11:18 -0500
commit32caccb8f47c032df55e77102ea43c627f1ca507 (patch)
treed6598808f7f917e92337a3847bd4a13eca605ace /tools/testing
parent6d40cc0cb4311d0c5aa4a106cc86a3d45a9ad86c (diff)
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 'tools/testing')
-rw-r--r--tools/testing/selftests/rcutorture/bin/functions.sh24
-rw-r--r--tools/testing/selftests/rcutorture/bin/kvm.sh25
2 files changed, 27 insertions, 22 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 () {
28 echo "$1" | grep -q "rcutorture\.onoff_" 28 echo "$1" | grep -q "rcutorture\.onoff_"
29} 29}
30 30
31# checkarg --argname argtype $# arg mustmatch cannotmatch
32#
33# Checks the specified argument "arg" against the mustmatch and cannotmatch
34# patterns.
35checkarg () {
36 if test $3 -le 1
37 then
38 echo $1 needs argument $2 matching \"$5\"
39 usage
40 fi
41 if echo "$4" | grep -q -e "$5"
42 then
43 :
44 else
45 echo $1 $2 \"$4\" must match \"$5\"
46 usage
47 fi
48 if echo "$4" | grep -q -e "$6"
49 then
50 echo $1 $2 \"$4\" must not match \"$6\"
51 usage
52 fi
53}
54
31# configfrag_boot_params bootparam-string config-fragment-file 55# configfrag_boot_params bootparam-string config-fragment-file
32# 56#
33# Adds boot parameters from the .boot file, if any. 57# Adds boot parameters from the .boot file, if any.
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 0783ec9c583e..7ba375ebe396 100644
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -32,6 +32,7 @@ args="$*"
32 32
33dur=30 33dur=30
34KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM 34KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
35PATH=${KVM}/bin:$PATH; export PATH
35builddir="${KVM}/b1" 36builddir="${KVM}/b1"
36RCU_INITRD="$KVM/initrd"; export RCU_INITRD 37RCU_INITRD="$KVM/initrd"; export RCU_INITRD
37RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG 38RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG
@@ -40,6 +41,8 @@ configs=""
40ds=`date +%Y.%m.%d-%H:%M:%S` 41ds=`date +%Y.%m.%d-%H:%M:%S`
41kversion="" 42kversion=""
42 43
44. functions.sh
45
43usage () { 46usage () {
44 echo "Usage: $scriptname optional arguments:" 47 echo "Usage: $scriptname optional arguments:"
45 echo " --bootargs kernel-boot-arguments" 48 echo " --bootargs kernel-boot-arguments"
@@ -60,27 +63,6 @@ usage () {
60 exit 1 63 exit 1
61} 64}
62 65
63# checkarg --argname argtype $# arg mustmatch cannotmatch
64checkarg () {
65 if test $3 -le 1
66 then
67 echo $1 needs argument $2 matching \"$5\"
68 usage
69 fi
70 if echo "$4" | grep -q -e "$5"
71 then
72 :
73 else
74 echo $1 $2 \"$4\" must match \"$5\"
75 usage
76 fi
77 if echo "$4" | grep -q -e "$6"
78 then
79 echo $1 $2 \"$4\" must not match \"$6\"
80 usage
81 fi
82}
83
84while test $# -gt 0 66while test $# -gt 0
85do 67do
86 case "$1" in 68 case "$1" in
@@ -164,7 +146,6 @@ do
164 shift 146 shift
165done 147done
166 148
167PATH=${KVM}/bin:$PATH; export PATH
168CONFIGFRAG=${KVM}/configs; export CONFIGFRAG 149CONFIGFRAG=${KVM}/configs; export CONFIGFRAG
169KVPATH=${CONFIGFRAG}/$kversion; export KVPATH 150KVPATH=${CONFIGFRAG}/$kversion; export KVPATH
170 151