Skip to content

Commit 5db3712

Browse files
Merge pull request #864 from Naresh-ibm/Gcov_enable_Sles
Adding Gcov enablement for Sles Dsitro to GcovSetup.py
2 parents 9fc07f3 + 6970a17 commit 5db3712

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

testcases/GcovSetup.py

+22-2
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,27 @@ def runTest(self):
6060
self.skipTest("Skip Gcov Setup as system already booted with Gcov Kernel")
6161
self.distro_name = self.util.distro_name()
6262
log.info("OS: %s" %self.distro_name)
63+
dep_packages = ["rpm-build", "gcc*", "perl*"]
6364
if self.distro_name == 'rhel':
6465
self.installer = "yum install"
66+
dep_packages.extend(["yum-utils", "tiny*"])
6567
elif self.distro_name == 'sles':
6668
self.installer = "zypper install"
67-
dep_packages = ["rpm-build", "gcc*", "perl*", "tiny*"]
69+
dep_packages.extend(["hmaccalc", "flex", "libelf-devel", "libopenssl-devel", "pesign-obs-integration", "dwarves"])
70+
log.info("\n\nNeed to enable Unsupported Modules for Sles....\n")
71+
log.info("enabling Unsupported Modules for Sles....\n")
72+
file_path = '/lib/modprobe.d/10-unsupported-modules.conf'
73+
cmd = f"sed -i 's/allow_unsupported_modules 0/allow_unsupported_modules 1/g' {file_path}"
74+
self.cv_HOST.host_run_command(cmd)
75+
out = self.cv_HOST.host_run_command(f"cat {file_path} | grep -i ^allow_unsupported_modules")
76+
for line in out:
77+
if line.split(" ")[-1] == '1':
78+
log.info("Successfuly enabled Unsupported Modules for Sles.")
79+
else:
80+
log.info("Failed to enabled Unsupported Modules for Sles.")
6881
log.info(f"\nInstalling following dependency packages\n {dep_packages}")
6982
for pkg in dep_packages:
7083
if self.distro_name == 'rhel':
71-
dep_packages.append("yum-utils")
7284
self.cv_HOST.host_run_command(f"{self.installer} {pkg} -y")
7385
elif self.distro_name == 'sles':
7486
self.cv_HOST.host_run_command(f"{self.installer} -y {pkg}")
@@ -119,6 +131,14 @@ def add_gcov_param(self, conf_file):
119131
"""
120132
k_config_params = ["CONFIG_GCOV_KERNEL=y", "CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y", "CONFIG_GCOV_PROFILE_ALL=y", "CONFIG_GCOV_PROFILE_FTRACE=y"]
121133
err_param = []
134+
135+
# Adding the Gcov parameter to new building kernel
136+
cmd = f"sed -i 's/CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=\"-Gcov\"/g' {conf_file}"
137+
self.cv_HOST.host_run_command(cmd)
138+
if self.distro_name == 'sles':
139+
cmd = f"sed -i 's/CONFIG_MODULE_SIG_KEY=.*/CONFIG_MODULE_SIG_KEY=\"\"/g' {conf_file}"
140+
self.cv_HOST.host_run_command(cmd)
141+
122142
for param in k_config_params:
123143
log.info("\n working on param %s" %param)
124144
unset_param = param

0 commit comments

Comments
 (0)