ARM-software / devlib

Library for interaction with and instrumentation of remote devices.
Apache License 2.0
47 stars 78 forks source link

bug: Target parameter, max_sync, isn't used when calling connect outside __init__ #614

Closed benhor01 closed 1 year ago

benhor01 commented 1 year ago

The Target parameter, max_sync, isn't used when calling connect outside__init__. I found this while trying to connect to the total compute FVP with LISA. This could be fixed by doing something along the lines of:

--- a/external/devlib/devlib/target.py
+++ b/external/devlib/devlib/target.py
@@ -338,6 +338,7 @@ class Target(object):
         self.shell_prompt = bytes_regex(shell_prompt)
         self.conn_cls = conn_cls
         self.is_container = is_container
+        self.max_async = max_async
         self.logger = logging.getLogger(self.__class__.__name__)
         self._installed_binaries = {}
         self._installed_modules = {}
@@ -387,7 +388,9 @@ class Target(object):
     # connection and initialization

     @asyn.asyncf
-    async def connect(self, timeout=None, check_boot_completed=True, max_async=50):
+    async def connect(self, timeout=None, check_boot_completed=True, max_async=None):
+        if max_async is None:
+            max_async = self.max_async
         self.platform.init_target_connection(self)
         # Forcefully set the thread-local value for the connection, with the
         # timeout we want
marcbonnici commented 1 year ago

Thanks for spotting that. I've create a PR #615 to address the issue, please let me know if this resolves the problem for you.

benhor01 commented 1 year ago

Yes, thanks for the speedy fix. Along with https://github.com/ARM-software/lisa/pull/1936/commits/93e8f27043cb76ca35531872f614ebcadc472082 this fixes my problem with using max_async with lisa.