Skip to content

Commit

Permalink
added support in get kernel source in suse case
Browse files Browse the repository at this point in the history
Signed-off-by: Praveen K Pandey <[email protected]>
  • Loading branch information
PraveenPenguin committed Apr 16, 2024
1 parent 7e5730f commit a18e88b
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions testcases/GcovSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,21 @@ def runTest(self):
self.installer = "yum install"
elif self.distro_name == 'sles':
self.installer = "zypper install"
dep_packages = ["rpm-build", "yum-utils", "gcc*", "perl*", "tiny*"]
dep_packages = ["rpm-build", "gcc*", "perl*", "tiny*"]
distro = None
log.info(f"\nInstalling following dependency packages\n {dep_packages}")
for pkg in dep_packages:
self.cv_HOST.host_run_command(f"{self.installer} {pkg} -y")
if self.distro_name == 'rhel':
dep_packages.append("yum-utils")
self.cv_HOST.host_run_command(f"{self.installer} {pkg} -y")
elif self.distro_name == 'sles':
self.cv_HOST.host_run_command(f"{self.installer} -y {pkg}")
log.info("\nInstalling the ditro src...")
if self.distro_name == 'rhel':
src_path = self.util.get_distro_src('kernel', '/root', "-bp")
elif self.distro_name == 'sles':
src_path = self.util.get_distro_src('kernel-default', '/root', "-bp")
src_path = self.util.get_distro_src('kernel-default', '/root', "-bp", "linux")
distro = "sles"
src_path_base = src_path
out = self.cv_HOST.host_run_command(f"ls {src_path}")
for line in out:
Expand All @@ -81,7 +87,7 @@ def runTest(self):
self.cv_HOST.host_run_command('rm -rf %s' %src_path_base)
src_path = '/root/kernel/linux'
log.info("\nadding gcov_param....")
self.kernel_config(src_path)
self.kernel_config(src_path, distro)
log.info("Building the new kernel...")
self.build_and_boot(src_path)
log.info("rebooting the lpar after building the src with kernel parameters")
Expand All @@ -90,7 +96,7 @@ def runTest(self):
time.sleep(10)
self.validate_gcov_enablement(src_path)

def kernel_config(self, dest_path):
def kernel_config(self, dest_path, distro):
"""
Add the gcov related kernel config parameter
"""
Expand All @@ -103,9 +109,9 @@ def kernel_config(self, dest_path):
log.info(f"copying {boot_conf_file} {src_conf_file}")
self.cv_HOST.host_run_command(f"cp {boot_conf_file} {src_conf_file}")
log.info("\n\n Adding the kernel_config_parameter....")
self.add_gcov_param(src_conf_file)
self.add_gcov_param(src_conf_file, distro)

def add_gcov_param(self, conf_file):
def add_gcov_param(self, conf_file, distro=None):
"""
Adding the gcov kernel parameter to enable it.
"""
Expand Down Expand Up @@ -150,6 +156,8 @@ def add_gcov_param(self, conf_file):
log.info("param failed to change {param}")
err_param.append(param)
log.info("\n\n\n")
if distro is not None:
self.cv_HOST.host_run_command(f"sed -i 's/^.*CONFIG_SYSTEM_TRUSTED_KEYS/#&/g' {conf_file}")
if err_param:
self.fail("few param did not got updated: %s" %err_param)

Expand Down

0 comments on commit a18e88b

Please sign in to comment.