From d85bb75d475736c3345728be516241fb7b627f33 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 28 Sep 2013 18:35:17 +0300 Subject: [PATCH] tests: Make run-tests.py command argument parser more flexible This allow -e, -r, and -f arguments to be given in any order. Signed-hostap: Jouni Malinen --- tests/hwsim/run-tests.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py index e81c487be..449cae3fe 100755 --- a/tests/hwsim/run-tests.py +++ b/tests/hwsim/run-tests.py @@ -48,17 +48,18 @@ def main(): else: logging.basicConfig(level=logging.INFO) - if len(sys.argv) > idx + 1 and sys.argv[idx] == '-e': - error_file = sys.argv[idx + 1] - idx = idx + 2 - - if len(sys.argv) > idx + 1 and sys.argv[idx] == '-r': - results_file = sys.argv[idx + 1] - idx = idx + 2 - - if len(sys.argv) > idx + 1 and sys.argv[idx] == '-f': - test_file = sys.argv[idx + 1] - idx = idx + 2 + while len(sys.argv) > idx: + if len(sys.argv) > idx + 1 and sys.argv[idx] == '-e': + error_file = sys.argv[idx + 1] + idx = idx + 2 + elif len(sys.argv) > idx + 1 and sys.argv[idx] == '-r': + results_file = sys.argv[idx + 1] + idx = idx + 2 + elif len(sys.argv) > idx + 1 and sys.argv[idx] == '-f': + test_file = sys.argv[idx + 1] + idx = idx + 2 + else: + break if len(sys.argv) > idx: test_filter = sys.argv[idx]