[PATCH 4/8] tests: make run-all.sh arguments non positional

Ilan Peer ilan.peer at intel.com
Sun Oct 26 03:06:31 EDT 2014


Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/run-all.sh | 44 +++++++++++++++++++++++++-------------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/tests/hwsim/run-all.sh b/tests/hwsim/run-all.sh
index 5ec3cf2..e99d796 100755
--- a/tests/hwsim/run-all.sh
+++ b/tests/hwsim/run-all.sh
@@ -24,30 +24,36 @@ else
     fi
 fi
 
-if [ "x$1" = "xvalgrind" ]; then
-	VALGRIND=valgrind
+unset VALGRIND
+unset TRACE
+unset TRACE_ARGS
+while [ "$1" != "" ]; do
+	case $1 in
+		-v | --valgrind ) shift
+			echo "$0: using valgrind"
+			VALGRIND=valgrind
+			;;
+		-t | --trace ) shift
+			echo "$0: using Trace"
+			TRACE=trace
+			;;
+		-n | --channels ) shift
+			NUM_CH=$1
+			shift
+			echo "$0: using channels=$NUM_CH"
+			;;
+		* ) exit 1
+	esac
+done
+
+unset SUFFIX
+if [ ! -z "$VALGRIND" ]; then
 	SUFFIX=-valgrind
-	shift
-else
-	unset VALGRIND
-	SUFFIX=
 fi
 
-if [ "x$1" = "xtrace" ] ; then
-	TRACE=trace
+if [ ! -z "$TRACE" ]; then
 	SUFFIX=$SUFFIX-trace
 	TRACE_ARGS="-T"
-	shift
-else
-	unset TRACE
-	unset TRACE_ARGS
-fi
-
-NUM_CH=$1
-if [ x${NUM_CH%=[0-9]*} = "xchannels" ]; then
-	shift
-else
-	unset NUM_CH
 fi
 
 if ! ./start.sh $VALGRIND $TRACE $NUM_CH; then
-- 
1.8.3.2



More information about the HostAP mailing list