ext-testlib: Support str-convertible args in gem5_verify_config
gem5_verify_config dit not support string-convertible args due to log_call() not trying to call str() on them. This patch maps str() on the command paramters. It is now possible to pass native integers or even string-like types like pathlib.Path as arguments without manually converting them to string. Change-Id: Ifa987f5f1a20f17c8710e1a36d99d424e4c9ce6c Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/66893 Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Gabriel B.
parent
5357277039
commit
313f557b93
@@ -149,7 +149,14 @@ def log_call(logger, command, time, *popenargs, **kwargs):
|
||||
if isinstance(command, str):
|
||||
cmdstr = command
|
||||
else:
|
||||
cmdstr = ' '.join(command)
|
||||
try:
|
||||
command = list(map(str, command))
|
||||
cmdstr = " ".join(command)
|
||||
except TypeError as e:
|
||||
logger.trace(
|
||||
"Argument <command> must be an iterable of string-convertible types"
|
||||
)
|
||||
raise e
|
||||
|
||||
logger_callback = logger.trace
|
||||
logger.trace('Logging call to command: %s' % cmdstr)
|
||||
|
||||
Reference in New Issue
Block a user