Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion common/OpTestInstallUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,14 @@ def update_kernel_cmdline(self, distro, args="", remove_args="", reboot=True,
if reboot and (req_args or req_remove_args):
# Reboot the host for the kernel command to reflect
if reboot_cmd:
# Always reopen console fresh to avoid stale session after first reboot
self.cv_SYSTEM.console.close()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below we are anyway opening new console, is it really required?

Also, when reboot is executed, all the consoles will become inactive anyway right?

raw_pty = self.cv_SYSTEM.console.get_console()
raw_pty.sendline("reboot")
raw_pty.expect("login:", timeout=900)
login_patterns = [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you facing issues with only "login:" prompt?

Trying to understand why we need login_patterns. If its really needed, can you use re expression to match any prompt ending with login:

"login:", "root login:", "Ubuntu login:", "Password:",
]
raw_pty.expect(login_patterns, timeout=900)
else:
self.cv_SYSTEM.goto_state(OpSystemState.OFF)
self.cv_SYSTEM.goto_state(OpSystemState.OS)
Expand Down
8 changes: 8 additions & 0 deletions common/OpTestSOL.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ def nontimeout_run(self):
self.c.expect("\n", timeout=60)
except pexpect.TIMEOUT:
pass
except OSError as e:
# File descriptor closed (reboot / rmvterm)
print(f"[OpTestSOL] Console closed: {e}, stopping SOL thread.")
break
except Exception as e:
# Catch-all for any other console errors
print(f"[OpTestSOL] Unexpected error in SOL thread: {e}, stopping.")
break
except pexpect.EOF:
self.c.close()
self.c = self.system.console.get_console()
Expand Down
44 changes: 44 additions & 0 deletions testcases/OpTestDlpar.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,30 @@
lpar2_name - name of destination lpar for move operation
loop_num - number of times to run loop
'''
import time
import unittest
import logging
import os.path
from os import path
import OpTestConfiguration
import OpTestLogger
from testcases.grub import Grub
from common import OpTestHMC, OpTestFSP
from common import OpTestHMC
from common.OpTestSystem import OpSystemState
from common.OpTestConstants import OpTestConstants as BMC_CONST
from random import randint
from common.OpTestSystem import OpSystemState
from common.OpTestSOL import OpSOLMonitorThread
from common import OpTestInstallUtil
from common.OpTestUtil import OpTestUtil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove additional line

log = OpTestLogger.optest_logger_glob.get_logger(__name__)
class OpTestDlpar(unittest.TestCase):
def setUp(self):
conf = OpTestConfiguration.conf
self.op_test_util = OpTestUtil(conf)
self.distro = self.op_test_util.distro_name()
self.cv_SYSTEM = conf.system()
self.console = self.cv_SYSTEM.console
conf = OpTestConfiguration.conf
Expand Down Expand Up @@ -315,6 +322,43 @@ def runTest(self):
log.debug("Deleting smt script")
self.console.run_command("rm ./smt_script")


class Dlpar_mem_hotplug(OpTestDlpar, unittest.TestCase):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use standard convention of writing class name?
Something like this. DlparMemHotPlug or something similar.

"""Class for DLPAR Memory hotplug Tests
This class executes test cases from OpTestDlpar.DlparMemBasic.

Step 1 : memory_hotplug.memmap_on_memory=0 * test dlpar memory add, memory remove
Step 2 : memory_hotplug.memmap_on_memory=1 * test dlpar memory add, memory remove
Step 3 : memory_hotplug.memmap_on_memory=force * test dlpar memory add, memory remove
"""

def setUp(self):
super(Dlpar_mem_hotplug, self).setUp()

def runTest(self):
obj = OpTestInstallUtil.InstallUtil()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can obj be replaced with something more meaningful


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove additional line

test_settings = [0, 1, 'force']
for setting in test_settings:
obj.update_kernel_cmdline(
self.distro,
args=f"memory_hotplug.memmap_on_memory={setting}",
reboot=True,
reboot_cmd=True
)
# Establish SSH connection
con = self.cv_SYSTEM.cv_HOST.get_ssh_connection()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all additional lines.

log.debug("Memory hotplug with setting: %s", setting)
log.debug("=================")
# Add memory resource
self.AddRemove("mem", "-q", "a", self.mem_resource)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional lines

#log.debug("Memory hotplug removal with setting: %s", setting)
log.debug("=================")
# Remove memory resource
self.AddRemove("mem", "-q", "r", self.mem_resource)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove additional line

def tearDown(self):
self.console_thread.console_terminate()
#reboot machine & delete script smt_script
Expand Down