From: Enze Li 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 Reviewed-by: SJ Park Signed-off-by: SJ Park --- Changes from v1 - v1: https://lore.kernel.org/20261129020003.45921-1-enze.li@linux.dev - Collect R-b: from SJ. - Rebase to the lates mm-new. 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" ] -- 2.47.3