Skip to content

Commit 4df4380

Browse files
OpTestKernelDump.py: Cleanup /var/crash for both local and network dumps
Previously, cleanup of crash directories under /var/crash/ was restricted to local dumps and root user. However, in network-based (SSH/NFS) kdump scenarios, dump folders are also copied to /var/crash/, so they should be cleaned up as well. The cleanup logic in the finally block is now updated to remove crash directories for all cases when dump_server_user is root. Additionally: - Added setup_test() and verify_dump_file() support to the OpTestMakedump() test case. - The test now executes setup_test(), triggers a kernel crash, runs makedumpcheck, and finally verifies dump files. - verify_dump_file() also handles cleanup of the crash folder after dump verification. - Addressed scenarios where crash folders are created with the same names to ensure reliable dump verification and cleanup. Signed-off-by: Shirisha G <shirisha@linux.ibm.com>
1 parent d338ec7 commit 4df4380

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

testcases/OpTestKernelDump.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def verify_dump_file(self, boot_type=BootType.NORMAL, dump_place="local"):
308308
self.c.run_command("ls /var/crash/%s/opalcore*" %
309309
self.crash_content[0])
310310
finally:
311-
if dump_place == "local" and self.dump_server_user == 'root':
311+
if self.dump_server_user == 'root':
312312
log.info("Cleaning up crash directory /var/crash/%s" % self.crash_content[0])
313313
self.c.run_command("rm -rf /var/crash/%s; sync" % self.crash_content[0])
314314

@@ -1327,8 +1327,10 @@ def runTest(self):
13271327
obj = OpTestInstallUtil.InstallUtil()
13281328
obj.update_kernel_cmdline(self.distro, remove_args="disable_radix",
13291329
reboot=True, reboot_cmd=True)
1330+
self.setup_test()
13301331
self.kernel_crash()
13311332
self.makedump_check()
1333+
self.verify_dump_file(boot_type)
13321334

13331335

13341336
class KernelCrash_KdumpPMEM(OptestKernelDump):

0 commit comments

Comments
 (0)