Skip to content

Commit 0ac71ee

Browse files
authored
Merge pull request avocado-framework#4211 from liang-cong-red-hat/libvirt_bios_add_image_mode_kernel_config_2
Add kernel config which available in image mode
2 parents 853e007 + 9836f0d commit 0ac71ee

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

virttest/utils_libvirt/libvirt_bios.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,22 @@ def check_boot_config(session, test, check_list):
4040
:param check_list: checking list.
4141
:raises: test.fail if checking fails.
4242
"""
43+
current_boot = session.cmd("uname -r").strip()
44+
kernel_configs = [
45+
"/boot/config-%s" % current_boot,
46+
"/usr/lib/modules/%s/config" % current_boot,
47+
]
48+
valid_config = next(
49+
(c for c in kernel_configs if not session.cmd_status("ls %s" % c)), None
50+
)
51+
if not valid_config:
52+
test.fail("no kernel config found at %s" % kernel_configs)
53+
4354
if not isinstance(check_list, list):
4455
check_list = [check_list]
45-
current_boot = session.cmd("uname -r").strip()
46-
content = session.cmd("cat /boot/config-%s" % current_boot).strip()
56+
content = session.cmd("cat %s" % valid_config).strip()
4757
for item in check_list:
4858
if item in content:
49-
test.log.debug("/boot/config content: %s exist", item)
59+
test.log.debug("%s content: %s exist", valid_config, item)
5060
else:
51-
test.fail("/boot/config content not correct: %s not exist" % item)
61+
test.fail("%s content not correct: %s not exist" % (valid_config, item))

0 commit comments

Comments
 (0)