Skip to content

Commit ccb7d6a

Browse files
committed
Allow port to be left off for grm argument
1 parent 3661081 commit ccb7d6a

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/mbed_os_tools/test/host_tests_runner/host_test_default.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,15 @@ def match_log(self, line):
571571
@staticmethod
572572
def _parse_grm(grm_arg):
573573
grm_module, leftover = grm_arg.split(':', 1)
574-
grm_host, grm_port = leftover.rsplit(':', 1)
574+
parts = leftover.rsplit(':', 1)
575+
576+
try:
577+
grm_host, grm_port = parts
578+
_ = int(grm_port)
579+
except ValueError:
580+
# No valid port was found, so assume no port was supplied
581+
grm_host = leftover
582+
grm_port = None
575583

576584
return {
577585
"grm_module" : grm_module,

src/mbed_os_tools/test/mbed_test_api.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,16 @@ def parse_global_resource_mgr(global_resource_mgr):
571571
"""
572572
try:
573573
platform_name, module_name, leftover = global_resource_mgr.split(':', 2)
574-
ip_name, port_name = leftover.rsplit(':', 1)
574+
parts = leftover.rsplit(':', 1)
575+
576+
try:
577+
ip_name, port_name = parts
578+
_ = int(port_name)
579+
except ValueError:
580+
# No valid port was found, so assume no port was supplied
581+
ip_name = leftover
582+
port_name = None
583+
575584
except ValueError as e:
576585
return False
577586
return platform_name, module_name, ip_name, port_name

0 commit comments

Comments
 (0)