Skip to content

Commit

Permalink
Merge pull request #844 from abdhaleegit/fix-login
Browse files Browse the repository at this point in the history
Fix timing issue when login and passowrd
  • Loading branch information
PraveenPenguin authored Jun 6, 2024
2 parents 42f6483 + 575b12e commit 40328e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion common/OpTestHMC.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

log = OpTestLogger.optest_logger_glob.get_logger(__name__)

WAITTIME = 15
WAITTIME = 25
SYS_WAITTIME = 200
BOOTTIME = 500
STALLTIME = 5
Expand Down
14 changes: 7 additions & 7 deletions common/OpTestUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -1475,12 +1475,12 @@ def get_login(self, host, term_obj, pty, prompt):
my_user = host.username()
my_pwd = host.password()
pty.sendline()
rc = pty.expect(['login: ', pexpect.TIMEOUT, pexpect.EOF], timeout=10)
rc = pty.expect(['login: ', pexpect.TIMEOUT, pexpect.EOF], timeout=60)
if rc == 0:
pty.sendline(my_user)
time.sleep(0.1)
rc = pty.expect(
[r"[Pp]assword:", pexpect.TIMEOUT, pexpect.EOF], timeout=10)
[r"[Pp]assword:", pexpect.TIMEOUT, pexpect.EOF], timeout=60)
if rc == 0:
pty.sendline(my_pwd)
time.sleep(0.5)
Expand Down Expand Up @@ -1509,17 +1509,17 @@ def get_login(self, host, term_obj, pty, prompt):
else: # timeout eof
pty.sendline()
rc = pty.expect(
['login: ', pexpect.TIMEOUT, pexpect.EOF], timeout=10)
['login: ', pexpect.TIMEOUT, pexpect.EOF], timeout=60)
if rc == 0:
pty.sendline(my_user)
time.sleep(0.1)
rc = pty.expect(
[r"[Pp]assword:", pexpect.TIMEOUT, pexpect.EOF], timeout=10)
[r"[Pp]assword:", pexpect.TIMEOUT, pexpect.EOF], timeout=60)
if rc == 0:
pty.sendline(my_pwd)
time.sleep(0.5)
rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", ":~",
'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10)
'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=60)
if rc not in [1, 2, 3, 4, 5]:
if term_obj.setup_term_quiet == 0:
log.warning("OpTestSystem Problem with the login and/or password prompt,"
Expand Down Expand Up @@ -1658,7 +1658,7 @@ def setup_term(self, system, pty, ssh_obj=None, block=0):
return

rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~>", "~ #",
'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10)
'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=30)
if rc == 0:
track_obj.PS1_set, track_obj.LOGIN_set = self.get_login(
system_obj.cv_HOST, term_obj, pty, self.build_prompt(system_obj.prompt))
Expand Down Expand Up @@ -1688,7 +1688,7 @@ def setup_term(self, system, pty, ssh_obj=None, block=0):
# Ctrl-L may cause a esc[J (erase) character to appear in the buffer.
# Include this in the patterns that expect $ (end of line)
rc = pty.expect(['login: (\x1b\[J)*$', ".*#(\x1b\[J)*$", ".*# (\x1b\[J)*$", ".*\$(\x1b\[J)*",
"~>(\x1b\[J)", "~ #(\x1b\[J)", ":~(\x1b\[J)", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10)
"~>(\x1b\[J)", "~ #(\x1b\[J)", ":~(\x1b\[J)", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=30)
if rc == 0:
track_obj.PS1_set, track_obj.LOGIN_set = self.get_login(
system_obj.cv_HOST, term_obj, pty, self.build_prompt(system_obj.prompt))
Expand Down

0 comments on commit 40328e6

Please sign in to comment.