* [PATCH v2 1/2] test-runner: use type=os.path.abspath for argparse
@ 2022-04-05 22:40 James Prestwood
0 siblings, 0 replies; 2+ messages in thread
From: James Prestwood @ 2022-04-05 22:40 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 2130 bytes --]
This is a convenient type which automatically resolves the argument
to an absolute path. Use this for any arguments expected to be
paths.
---
tools/runner.py | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/tools/runner.py b/tools/runner.py
index 0068c74f..8e1ac1d7 100644
--- a/tools/runner.py
+++ b/tools/runner.py
@@ -97,7 +97,8 @@ class RunnerCoreArgParse(ArgumentParser):
self.add_argument('--start', '-s',
help='Custom init process in virtual environment',
dest='start',
- default=None)
+ default=None,
+ type=os.path.abspath)
self.add_argument('--verbose', '-v', metavar='<list>',
type=str,
help='Comma separated list of applications',
@@ -108,16 +109,17 @@ class RunnerCoreArgParse(ArgumentParser):
help='Enable test-runner debugging',
dest='dbg')
self.add_argument('--log', '-l',
- type=str,
+ type=os.path.abspath,
help='Directory for log files')
self.add_argument('--monitor', '-m',
- type=str,
+ type=os.path.abspath,
help='Enables iwmon output to file')
self.add_argument('--sub-tests', '-S',
metavar='<subtests>',
type=str, nargs=1, help='List of subtests to run',
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')
self.add_argument('--hw', '-w',
type=str,
@@ -211,8 +213,6 @@ class Runner:
args.start = os.path.abspath('tools/run-tests')
else:
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 the kernel is executable its UML, otherwise qemu
@@ -242,9 +242,6 @@ class RunnerAbstract:
def __init__(self, args):
self.args = args
- if self.args.log:
- self.args.log = os.path.abspath(self.args.log)
-
def start(self):
print("Starting %s" % self.name)
os.execlpe(self.cmdline[0], *self.cmdline, self.env)
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/2] test-runner: use type=os.path.abspath for argparse
@ 2022-04-05 22:50 Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2022-04-05 22:50 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 351 bytes --]
Hi James,
On 4/5/22 17:40, James Prestwood wrote:
> This is a convenient type which automatically resolves the argument
> to an absolute path. Use this for any arguments expected to be
> paths.
> ---
> tools/runner.py | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
All applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-05 22:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-05 22:50 [PATCH v2 1/2] test-runner: use type=os.path.abspath for argparse Denis Kenzior
-- strict thread matches above, loose matches on Subject: below --
2022-04-05 22:40 James Prestwood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox