Skip to content

Commit 86eeefb

Browse files
author
Sachin P Bappalige
committed
Fix false positives with kdump test to find vmcore file
Kdump creates vmcore files in different formats based on options configured. For example: vmcore, vmcore.flat, vmcore.1, vmcore.2 ....etc Two cases for PASS and FAIL scenarios listed below: CASE1: when vmcore generated successfully, crash folder has vmcore file (one of the above format) and "vmcore-dmesg.txt". CASE2: when vmcoe generation failed, crash folder usually have "vmcore-dmesg-incomplete.txt". Logic built around above scenarios to pick right vmcore file incase of success. Otherwise, check fails with OpTestError Signed-off-by: Sachin P Bappalige <sachinpb@linux.vnet.ibm.com>
1 parent 04c0e50 commit 86eeefb

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

testcases/PowerNVDump.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,19 @@ def verify_dump_file(self, boot_type=BootType.NORMAL, dump_place="local"):
265265
self.c.run_command("ls /var/crash/%s/dump*" %
266266
self.crash_content[0])
267267
else:
268-
self.c.run_command("ls /var/crash/%s/vmcore*" %
269-
self.crash_content[0])
268+
res = self.c.run_command("ls /var/crash/%s/vmcore*" %
269+
self.crash_content[0])
270+
paths = res[0].split()
271+
file_names = [os.path.basename(path) for path in paths]
272+
# Check if vmcore-dmesg-incomplete.txt is present in file_names
273+
if "vmcore-dmesg-incomplete.txt" in file_names:
274+
raise OpTestError("kdump failed to create vmcore file")
275+
else:
276+
filtered_files = [f for f in file_names if f.startswith("vmcore") and not f == "vmcore-dmesg.txt"]
277+
if filtered_files:
278+
log.debug("vmcore file %s exists in crash dir" % filtered_files)
279+
else:
280+
raise OpTestError("kdump failed to create vmcore file")
270281
if boot_type == BootType.MPIPL:
271282
self.c.run_command("ls /var/crash/%s/opalcore*" %
272283
self.crash_content[0])

0 commit comments

Comments
 (0)