1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 11:22:41 +01:00

Gem5Device: Try to connect to the shell up to 10 times

This commit is contained in:
Sascha Bischoff
2015-12-08 17:52:48 +00:00
parent d98bdac0be
commit 480155fd8c

View File

@@ -26,7 +26,7 @@ import subprocess
import sys import sys
import tarfile import tarfile
import time import time
from pexpect import EOF, TIMEOUT from pexpect import EOF, TIMEOUT, pxssh
from wlauto import settings, Parameter from wlauto import settings, Parameter
from wlauto.core import signal as sig from wlauto.core import signal as sig
@@ -238,9 +238,19 @@ class BaseGem5Device(object):
port = self.gem5_port port = self.gem5_port
# Connect to the gem5 telnet port. Use a short timeout here. # Connect to the gem5 telnet port. Use a short timeout here.
attempts = 0
while attempts < 10:
attempts += 1
try:
self.sckt = ssh.TelnetConnection() self.sckt = ssh.TelnetConnection()
self.sckt.login(host, 'None', port=port, auto_prompt_reset=False, self.sckt.login(host, 'None', port=port, auto_prompt_reset=False,
login_timeout=10) login_timeout=10)
break
except pxssh.ExceptionPxssh:
pass
else:
self.gem5.kill()
raise DeviceError("Failed to connect to the gem5 telnet session.")
self.logger.info("Connected! Waiting for prompt...") self.logger.info("Connected! Waiting for prompt...")