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 <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-09-28 18:35:17 +03:00
parent 3b7475d365
commit d85bb75d47

View file

@ -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]