Lunderberg commented on a change in pull request #10581:
URL: https://github.com/apache/tvm/pull/10581#discussion_r834347281



##########
File path: tests/python/contrib/test_hexagon/conftest.py
##########
@@ -59,27 +64,134 @@ def requires_hexagon_toolchain(*args):
 
 
 @tvm.testing.fixture
-def android_serial_number() -> str:
-    return os.getenv(ANDROID_SERIAL_NUMBER, default=None)
+def android_serial_number() -> Optional[str]:
+    serial = os.getenv(ANDROID_SERIAL_NUMBER, default="")
+    # Setting ANDROID_SERIAL_NUMBER to an empty string should be
+    # equivalent to having it unset.
+    if not serial.strip():
+        serial = None
+    return serial
 
 
[email protected]
-def tvm_tracker_host() -> str:
-    return os.getenv(TVM_TRACKER_HOST, default=None)
+# NOTE on server ports:
+# These tests use different port numbers for the RPC server (7070 + ...).
+# The reason is that an RPC session cannot be gracefully closed without
+# triggering TIME_WAIT state on the server socket. This prevents another
+# server to bind to the same port until the wait time elapses.
 
+listen_port_min = 2000  # Well above the privileged ports (1024 or lower)
+listen_port_max = 9000  # Below the search range end (port_end=9199) of RPC 
server
+previous_port = [None]

Review comment:
       Yup, just the previous port.  The list was to prevent a `previous_port = 
port` line to make `previous_port` into a local variable  I had tried using 
`nonlocal` instead, and had concluded that there must be some interaction with 
the 
[`_remove_global_fixture_definitions`](https://github.com/apache/tvm/blob/main/python/tvm/testing/plugin.py#L222)
 function, which is why I went with the list.  Testing today, I learned that 
`nonlocal` cannot be used to refer to global-scope variables, but that using 
`global` works.  I have updated `previous_port` to be a single value, to avoid 
any potential confusion in the future.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to