diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py index 8c8e4abed0b45..d6cb68f55bf29 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py @@ -185,7 +185,7 @@ def setUpServerLogging(self, is_llgs): ] def get_next_port(self): - return 12000 + random.randint(0, 3999) + return 12000 + random.randint(0, 7999) def reset_test_sequence(self): self.test_sequence = GdbRemoteTestSequence(self.logger) @@ -388,7 +388,8 @@ def connect_to_debug_monitor(self, attach_pid=None): # We're using a random port algorithm to try not to collide with other ports, # and retry a max # times. attempts = 0 - MAX_ATTEMPTS = 20 + MAX_ATTEMPTS = 10 + attempt_wait = 3 while attempts < MAX_ATTEMPTS: server = self.launch_debug_monitor(attach_pid=attach_pid) @@ -424,7 +425,8 @@ def connect_to_debug_monitor(self, attach_pid=None): # And wait a random length of time before next attempt, to avoid # collisions. - time.sleep(random.randint(1, 5)) + time.sleep(attempt_wait) + attempt_wait *= 1.2 # Now grab a new port number. self.port = self.get_next_port()