[PATCH 1/2] parallel-vm.py: use argparse module
j at w1.fi
Sat Mar 7 15:10:03 EST 2015
On Tue, Mar 03, 2015 at 11:08:40PM +0100, Johannes Berg wrote:
> Instead of hand-writing a (positional) parser, use the argparse module.
> This also gets us nice help output.
Thanks, applied with number of fixes.
> diff --git a/tests/hwsim/vm/parallel-vm.py b/tests/hwsim/vm/parallel-vm.py
> @@ -257,26 +258,24 @@ def main():
> - timestamp = int(time.time())
> + if args.codecov:
> print "Code coverage - build separate binaries"
> logdir = "/tmp/hwsim-test-logs/" + str(timestamp)
> @@ -287,19 +286,21 @@ def main():
> codecov_args = 
> codecov = False
> + timestamp = int(time.time())
This move of timestamp initialization broke --codecov..
> - if '-f' in sys.argv[idx:]:
> - extra_args = sys.argv[idx:]
> + if '-f' in args.params:
> + extra_args = args.params
This doesn't work work argparse at least in its current form.
parallel-vm.py was able to pass some of the run-tests.py arguments to
the VM and anything starting with '-' seems to be broken with this
design.. That said, the earlier design was not exactly clean either and
most of the arguments are not really used. I ended up handling the ones
I care about (-f <modules..> and --long) separately here. If anything
else is needed, they can be handled similarly to allow this parsing to
be kept cleaner by not mixing two different command line uses.
Jouni Malinen PGP id EFC895FA
More information about the HostAP