Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Enze Li <enze.li@linux.dev>
To: sj@kernel.org, shuah@kernel.org
Cc: damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kselftest@vger.kernel.org, Enze Li <lienze@kylinos.cn>
Subject: [PATCH] selftests/damon/sysfs_memcg_path_leak: use common check_dependencies()
Date: Sun, 29 Nov 2026 10:00:03 +0800	[thread overview]
Message-ID: <20261129020003.45921-1-enze.li@linux.dev> (raw)

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


             reply	other threads:[~2026-11-29  2:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  2:00 Enze Li [this message]
2026-11-29  2:27 ` [PATCH] selftests/damon/sysfs_memcg_path_leak: use common check_dependencies() SJ Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261129020003.45921-1-enze.li@linux.dev \
    --to=enze.li@linux.dev \
    --cc=damon@lists.linux.dev \
    --cc=lienze@kylinos.cn \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.org \
    --cc=sj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox