Skip to content

Commit b2b7f09

Browse files
committed
[ot] python/qemu: ot.pyot.wrapper: simplify reported command line
note: the full command line is preserved if debug mode is enabled Signed-off-by: Emmanuel Blot <[email protected]>
1 parent 5253ddc commit b2b7f09

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

python/qemu/ot/pyot/wrapper.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import sys
2323

2424
from ot.util.log import ColorLogFormatter
25-
from ot.util.misc import EasyDict
25+
from ot.util.misc import EasyDict, split_map_join
2626

2727
from .util import ExecTime, LogMessageClassifier
2828

@@ -137,7 +137,8 @@ def trig_match(bline):
137137
app_exec=host_app_exec)
138138
try:
139139
workdir = dirname(tdef.command[0])
140-
log.debug('Executing %s as %s', self.NAME, ' '.join(tdef.command))
140+
tdef_cli = self._simplify_cli(tdef.command)
141+
log.debug('Executing %s as %s', self.NAME, tdef_cli)
141142
env = dict(environ)
142143
if tdef.asan:
143144
# note cannot use a FileManager temp file here, as the full
@@ -386,6 +387,16 @@ def classify_log(cls, line: str, default: int = logging.ERROR,
386387
return logging.DEBUG
387388
return default
388389

390+
def _simplify_cli(self, args: list[str]) -> str:
391+
"""Shorten the test execution command line."""
392+
if self._debug:
393+
# do not simplify the argument line if debug mode is enabled
394+
return ' '.join(args)
395+
return ' '.join(split_map_join(',', arg,
396+
lambda part: split_map_join('=', part,
397+
basename))
398+
for arg in args)
399+
389400
def _colorize_vcp_log(self, vcplogname: str, lognames: list[str]) -> None:
390401
vlog = logging.getLogger(vcplogname)
391402
clr_fmt = None

0 commit comments

Comments
 (0)