Gabriel B. has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/66893?usp=email )

Change subject: ext-testlib: Support str-convertible args in gem5_verify_config
......................................................................

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 <bbr...@ucdavis.edu>
Maintainer: Bobby Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M ext/testlib/helper.py
1 file changed, 28 insertions(+), 1 deletion(-)

Approvals:
  Bobby Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/ext/testlib/helper.py b/ext/testlib/helper.py
index ed6e325..ea102f2 100644
--- a/ext/testlib/helper.py
+++ b/ext/testlib/helper.py
@@ -149,7 +149,14 @@
     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)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/66893?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ifa987f5f1a20f17c8710e1a36d99d424e4c9ce6c
Gerrit-Change-Number: 66893
Gerrit-PatchSet: 2
Gerrit-Owner: Gabriel B. <gabriel.bus...@arteris.com>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Gabriel B. <gabriel.bus...@arteris.com>
Gerrit-Reviewer: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to