From f9e4dc03adc70d23f66595fbfd4a36a93e49c8d1 Mon Sep 17 00:00:00 2001 From: Abdul Haleem Date: Fri, 24 Nov 2023 16:56:20 +0530 Subject: [PATCH] IO LPAR specific timeouts When LPAR is loaded with devices and adpater and network load is high, the console, boot and prompt response is slow so increase wait time to handle these Signed-off-by: Abdul Haleem --- common/OpTestHMC.py | 2 +- common/OpTestUtil.py | 14 +++++++------- testcases/InstallUpstreamKernel.py | 10 +++++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/common/OpTestHMC.py b/common/OpTestHMC.py index de9473755..773f23453 100644 --- a/common/OpTestHMC.py +++ b/common/OpTestHMC.py @@ -53,7 +53,7 @@ log = OpTestLogger.optest_logger_glob.get_logger(__name__) -WAITTIME = 15 +WAITTIME = 25 SYS_WAITTIME = 200 BOOTTIME = 500 STALLTIME = 5 diff --git a/common/OpTestUtil.py b/common/OpTestUtil.py index 03e2d5676..b7c9a84a5 100644 --- a/common/OpTestUtil.py +++ b/common/OpTestUtil.py @@ -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) @@ -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]: if term_obj.setup_term_quiet == 0: 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): 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)) @@ -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)", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10) + "~>(\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)) diff --git a/testcases/InstallUpstreamKernel.py b/testcases/InstallUpstreamKernel.py index aa69d82f8..94741e4f4 100644 --- a/testcases/InstallUpstreamKernel.py +++ b/testcases/InstallUpstreamKernel.py @@ -115,11 +115,11 @@ def is_url(path): self.config_path, sourcedir="", dstdir=os.path.join(linux_path, ".config")) con.run_command("make %s" % self.config) # Capture kernel version & release - res = con.run_command("make kernelrelease") + ker_ver = con.run_command("make kernelrelease") sha = con.run_command("git rev-parse HEAD") tcommit = con.run_command("export 'TERM=xterm-256color';git show -s --format=%ci") tcommit = re.sub(r"\x1b\[[0-9;]*[mGKHF]", "", tcommit[1]) - log.info("Upstream kernel version: %s", res[-1]) + log.info("Upstream kernel version: %s", ker_ver[-1]) log.info("Upstream kernel commit-id: %s", sha[-1]) log.info("Upstream kernel commit-time: %s", tcommit) log.debug("Compile and install linux kernel") @@ -127,9 +127,11 @@ def is_url(path): onlinecpus, timeout=self.host_cmd_timeout) if not self.use_kexec: # FIXME: Handle distributions which do not support grub - con.run_command("grubby --set-default /boot/vmlinuz-%s" % res[-1]) + con.run_command("grubby --set-default /boot/vmlinuz-%s" % ker_ver[-1]) log.debug("Rebooting after kernel install...") self.console_thread.console_terminate() + self.prompt = self.cv_SYSTEM.util.build_prompt() + self.console_thread.console_terminate() con.close() time.sleep(10) raw_pty = self.cv_SYSTEM.console.get_console() @@ -175,6 +177,8 @@ def is_url(path): con = self.cv_SYSTEM.cv_HOST.get_ssh_connection() res = con.run_command("uname -r") log.info("Installed upstream kernel version: %s", res[-1]) + if ker_ver[-1] != res[-1]: + self.fail("Upstream kernel did not boot") if self.conf.args.host_cmd: con.run_command(self.conf.args.host_cmd, timeout=self.host_cmd_timeout)