Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] selftests/damon/sysfs_memcg_path_leak: use common check_dependencies()
@ 2026-11-29  2:00 Enze Li
  2026-11-29  2:27 ` SJ Park
  0 siblings, 1 reply; 2+ messages in thread
From: Enze Li @ 2026-11-29  2:00 UTC (permalink / raw)
  To: sj, shuah; +Cc: damon, linux-mm, linux-kselftest, Enze Li

From: Enze Li <lienze@kylinos.cn>

The sysfs_memcg_path_leak test is the only DAMON selftest shell script
that does not source _common.sh.  Instead it open-codes the root
permission check that check_dependencies() already provides.

Source _common.sh and call check_dependencies() to drop the duplicate.

Signed-off-by: Enze Li <lienze@kylinos.cn>
---
 tools/testing/selftests/damon/sysfs_memcg_path_leak.sh | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh b/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh
index d407dddb879e..23e4940d7843 100755
--- a/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh
+++ b/tools/testing/selftests/damon/sysfs_memcg_path_leak.sh
@@ -1,14 +1,12 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
+source _common.sh
+
 # Kselftest framework requirement - SKIP code is 4.
 ksft_skip=4
 
-if [ $EUID -ne 0 ]
-then
-	echo "Run as root"
-	exit $ksft_skip
-fi
+check_dependencies
 
 damon_sysfs="/sys/kernel/mm/damon/admin"
 if [ ! -d "$damon_sysfs" ]

base-commit: 23cd682622886800b912219e307cf46a99f69c10
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-29  2:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29  2:00 [PATCH] selftests/damon/sysfs_memcg_path_leak: use common check_dependencies() Enze Li
2026-11-29  2:27 ` SJ Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox