[PATCH 09/10] selftests/damon/sysfs_memcg_path_leak: fail only for real DAMON leak

From: SJ Park

Date: Thu Sep 17 2026 - 10:41:06 EST


The selftest can fail for any leak if it happens while the test is
running. Remove the false positive test failures by further checking if
the expected leaking function is called out on the report.

Signed-off-by: SJ Park <sj@xxxxxxxxxx>
---
tools/testing/selftests/damon/sysfs_memcg_path_leak.sh | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh b/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh
index 33a7ff43ed6cc..34c37129c49fe 100755
--- a/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh
+++ b/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh
@@ -41,5 +41,12 @@ if [ "$kmemleak_report" = "" ]
then
exit 0
fi
+if ! echo "$kmemleak_report" | grep "memcg_path_store" --quiet
+then
+ echo "[WARN] memleak found; apparently not from DAMON, though"
+ echo "$kmemleak_report"
+ exit 0
+fi
+
echo "$kmemleak_report"
exit 1
--
2.47.3