diff options
| author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-10-28 11:57:29 -0400 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-12-03 13:11:18 -0500 |
| commit | 32caccb8f47c032df55e77102ea43c627f1ca507 (patch) | |
| tree | d6598808f7f917e92337a3847bd4a13eca605ace /tools/testing | |
| parent | 6d40cc0cb4311d0c5aa4a106cc86a3d45a9ad86c (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.sh | 24 | ||||
| -rw-r--r-- | tools/testing/selftests/rcutorture/bin/kvm.sh | 25 |
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. | ||
| 35 | checkarg () { | ||
| 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 | ||
| 33 | dur=30 | 33 | dur=30 |
| 34 | KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM | 34 | KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM |
| 35 | PATH=${KVM}/bin:$PATH; export PATH | ||
| 35 | builddir="${KVM}/b1" | 36 | builddir="${KVM}/b1" |
| 36 | RCU_INITRD="$KVM/initrd"; export RCU_INITRD | 37 | RCU_INITRD="$KVM/initrd"; export RCU_INITRD |
| 37 | RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG | 38 | RCU_KMAKE_ARG=""; export RCU_KMAKE_ARG |
| @@ -40,6 +41,8 @@ configs="" | |||
| 40 | ds=`date +%Y.%m.%d-%H:%M:%S` | 41 | ds=`date +%Y.%m.%d-%H:%M:%S` |
| 41 | kversion="" | 42 | kversion="" |
| 42 | 43 | ||
| 44 | . functions.sh | ||
| 45 | |||
| 43 | usage () { | 46 | usage () { |
| 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 | ||
| 64 | checkarg () { | ||
| 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 | |||
| 84 | while test $# -gt 0 | 66 | while test $# -gt 0 |
| 85 | do | 67 | do |
| 86 | case "$1" in | 68 | case "$1" in |
| @@ -164,7 +146,6 @@ do | |||
| 164 | shift | 146 | shift |
| 165 | done | 147 | done |
| 166 | 148 | ||
| 167 | PATH=${KVM}/bin:$PATH; export PATH | ||
| 168 | CONFIGFRAG=${KVM}/configs; export CONFIGFRAG | 149 | CONFIGFRAG=${KVM}/configs; export CONFIGFRAG |
| 169 | KVPATH=${CONFIGFRAG}/$kversion; export KVPATH | 150 | KVPATH=${CONFIGFRAG}/$kversion; export KVPATH |
| 170 | 151 | ||
