aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuís Henriques <lhenriques@suse.de>2023-07-13 09:26:31 +0100
committerZorro Lang <zlang@kernel.org>2023-07-23 12:56:22 +0800
commit05574f3cfc49df09af8d98b68db5e44a4cf9c0ee (patch)
tree15ca6312c9d33d2b72625d581b8df6f4485912f0
parentf2c9af189a76ecd0920466fb4afd8e542a5dc5e9 (diff)
downloadxfstests-dev-05574f3cfc49df09af8d98b68db5e44a4cf9c0ee.tar.gz
common/rc: cleanup old .kmemleak files
I've spent a non-negligible amount of time looking into a kmemleak that didn't exist in the code I was testing because there was an old .kmemleak file in the results directory. I don't think this is an intended behaviour, so I'm proposing to remove these files everytime we capture the result of a new scan. Signed-off-by: Luís Henriques <lhenriques@suse.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r--common/rc4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/rc b/common/rc
index 741579af82..5c4429ed04 100644
--- a/common/rc
+++ b/common/rc
@@ -4433,6 +4433,10 @@ _capture_kmemleak()
local kern_knob="$DEBUGFS_MNT/kmemleak"
local leak_file="$1"
+ # Some callers pass in /dev/null when they want to clear the
+ # kernel's leak report file and do not care what was in that.
+ [ -f "$leak_file" ] && rm -f "$leak_file"
+
# Tell the kernel to scan for memory leaks. Apparently the write
# returns before the scan is complete, so do it twice in the hopes
# that twice is enough to capture all the leaks.