[PATCH v2 1/5] tests: make run-all.sh arguments non positional

Ilan Peer ilan.peer
Mon Oct 27 07:00:53 PDT 2014


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

diff --git a/tests/hwsim/run-all.sh b/tests/hwsim/run-all.sh
index 5ec3cf2..c7b3437 100755
--- a/tests/hwsim/run-all.sh
+++ b/tests/hwsim/run-all.sh
@@ -24,30 +24,44 @@ else
     fi
 fi
 
-if [ "x$1" = "xvalgrind" ]; then
-	VALGRIND=valgrind
+unset VALGRIND
+unset TRACE
+unset TRACE_ARGS
+unset RUN_TEST_ARGS
+while [ "$1" != "" ]; do
+	case $1 in
+		-v | --valgrind | valgrind ) shift
+			echo "$0: using valgrind"
+			VALGRIND=valgrind
+			;;
+		-t | --trace | trace ) shift
+			echo "$0: using Trace"
+			TRACE=trace
+			;;
+		-n | --channels ) shift
+			NUM_CH=$1
+			shift
+			echo "$0: using channels=$NUM_CH"
+			;;
+		* )
+			RUN_TEST_ARGS="$RUN_TEST_ARGS$1 "
+			shift
+			;;
+	esac
+done
+
+if [ ! -z "$RUN_TEST_ARGS" ]; then
+	echo "$0: passing the following args to run-tests.py: $RUN_TEST_ARGS"
+fi
+
+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
@@ -57,7 +71,7 @@ if ! ./start.sh $VALGRIND $TRACE $NUM_CH; then
 	exit 1
 fi
 
-sudo ./run-tests.py -D --logdir "$LOGDIR" $TRACE_ARGS -q $DB $@ || errors=1
+sudo ./run-tests.py -D --logdir "$LOGDIR" $TRACE_ARGS -q $DB $RUN_TEST_ARGS || errors=1
 
 ./stop.sh
 
-- 
1.8.3.2




More information about the Hostap mailing list