mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
test-runner: use type=os.path.abspath for argparse
This is a convenient type which automatically resolves the argument to an absolute path. Use this for any arguments expected to be paths.
This commit is contained in:
parent
87345b4c14
commit
309760cbab
@ -87,7 +87,8 @@ class RunnerCoreArgParse(ArgumentParser):
|
|||||||
self.add_argument('--start', '-s',
|
self.add_argument('--start', '-s',
|
||||||
help='Custom init process in virtual environment',
|
help='Custom init process in virtual environment',
|
||||||
dest='start',
|
dest='start',
|
||||||
default=None)
|
default=None,
|
||||||
|
type=os.path.abspath)
|
||||||
self.add_argument('--verbose', '-v', metavar='<list>',
|
self.add_argument('--verbose', '-v', metavar='<list>',
|
||||||
type=str,
|
type=str,
|
||||||
help='Comma separated list of applications',
|
help='Comma separated list of applications',
|
||||||
@ -98,16 +99,17 @@ class RunnerCoreArgParse(ArgumentParser):
|
|||||||
help='Enable test-runner debugging',
|
help='Enable test-runner debugging',
|
||||||
dest='dbg')
|
dest='dbg')
|
||||||
self.add_argument('--log', '-l',
|
self.add_argument('--log', '-l',
|
||||||
type=str,
|
type=os.path.abspath,
|
||||||
help='Directory for log files')
|
help='Directory for log files')
|
||||||
self.add_argument('--monitor', '-m',
|
self.add_argument('--monitor', '-m',
|
||||||
type=str,
|
type=os.path.abspath,
|
||||||
help='Enables iwmon output to file')
|
help='Enables iwmon output to file')
|
||||||
self.add_argument('--sub-tests', '-S',
|
self.add_argument('--sub-tests', '-S',
|
||||||
metavar='<subtests>',
|
metavar='<subtests>',
|
||||||
type=str, nargs=1, help='List of subtests to run',
|
type=str, nargs=1, help='List of subtests to run',
|
||||||
default=None, dest='sub_tests')
|
default=None, dest='sub_tests')
|
||||||
self.add_argument('--result', '-e', type=str,
|
self.add_argument('--result', '-e',
|
||||||
|
type=os.path.abspath,
|
||||||
help='Writes PASS/FAIL to results file')
|
help='Writes PASS/FAIL to results file')
|
||||||
self.add_argument('--hw', '-w',
|
self.add_argument('--hw', '-w',
|
||||||
type=str,
|
type=str,
|
||||||
@ -201,8 +203,6 @@ class Runner:
|
|||||||
args.start = os.path.abspath('tools/run-tests')
|
args.start = os.path.abspath('tools/run-tests')
|
||||||
else:
|
else:
|
||||||
raise Exception("Cannot locate run-tests binary")
|
raise Exception("Cannot locate run-tests binary")
|
||||||
else:
|
|
||||||
args.start = os.path.abspath(args.start)
|
|
||||||
|
|
||||||
# If no runner is specified but we have a kernel image assume
|
# If no runner is specified but we have a kernel image assume
|
||||||
# if the kernel is executable its UML, otherwise qemu
|
# if the kernel is executable its UML, otherwise qemu
|
||||||
@ -230,9 +230,6 @@ class RunnerAbstract:
|
|||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self.args = args
|
self.args = args
|
||||||
|
|
||||||
if self.args.log:
|
|
||||||
self.args.log = os.path.abspath(self.args.log)
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
print("Starting %s" % self.name)
|
print("Starting %s" % self.name)
|
||||||
os.execlpe(self.cmdline[0], *self.cmdline, self.env)
|
os.execlpe(self.cmdline[0], *self.cmdline, self.env)
|
||||||
|
Loading…
Reference in New Issue
Block a user