Skip to content

Commit 40328e6

Browse files
Merge pull request #844 from abdhaleegit/fix-login
Fix timing issue when login and passowrd
2 parents 42f6483 + 575b12e commit 40328e6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

common/OpTestHMC.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
log = OpTestLogger.optest_logger_glob.get_logger(__name__)
5454

55-
WAITTIME = 15
55+
WAITTIME = 25
5656
SYS_WAITTIME = 200
5757
BOOTTIME = 500
5858
STALLTIME = 5

common/OpTestUtil.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1475,12 +1475,12 @@ def get_login(self, host, term_obj, pty, prompt):
14751475
my_user = host.username()
14761476
my_pwd = host.password()
14771477
pty.sendline()
1478-
rc = pty.expect(['login: ', pexpect.TIMEOUT, pexpect.EOF], timeout=10)
1478+
rc = pty.expect(['login: ', pexpect.TIMEOUT, pexpect.EOF], timeout=60)
14791479
if rc == 0:
14801480
pty.sendline(my_user)
14811481
time.sleep(0.1)
14821482
rc = pty.expect(
1483-
[r"[Pp]assword:", pexpect.TIMEOUT, pexpect.EOF], timeout=10)
1483+
[r"[Pp]assword:", pexpect.TIMEOUT, pexpect.EOF], timeout=60)
14841484
if rc == 0:
14851485
pty.sendline(my_pwd)
14861486
time.sleep(0.5)
@@ -1509,17 +1509,17 @@ def get_login(self, host, term_obj, pty, prompt):
15091509
else: # timeout eof
15101510
pty.sendline()
15111511
rc = pty.expect(
1512-
['login: ', pexpect.TIMEOUT, pexpect.EOF], timeout=10)
1512+
['login: ', pexpect.TIMEOUT, pexpect.EOF], timeout=60)
15131513
if rc == 0:
15141514
pty.sendline(my_user)
15151515
time.sleep(0.1)
15161516
rc = pty.expect(
1517-
[r"[Pp]assword:", pexpect.TIMEOUT, pexpect.EOF], timeout=10)
1517+
[r"[Pp]assword:", pexpect.TIMEOUT, pexpect.EOF], timeout=60)
15181518
if rc == 0:
15191519
pty.sendline(my_pwd)
15201520
time.sleep(0.5)
15211521
rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", ":~",
1522-
'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10)
1522+
'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=60)
15231523
if rc not in [1, 2, 3, 4, 5]:
15241524
if term_obj.setup_term_quiet == 0:
15251525
log.warning("OpTestSystem Problem with the login and/or password prompt,"
@@ -1658,7 +1658,7 @@ def setup_term(self, system, pty, ssh_obj=None, block=0):
16581658
return
16591659

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

0 commit comments

Comments
 (0)