* [PATCH] selftests/damon: check correct path in ensure_file() not_exist case
@ 2026-07-06 13:43 wang wei
2026-07-06 14:29 ` SJ Park
0 siblings, 1 reply; 2+ messages in thread
From: wang wei @ 2026-07-06 13:43 UTC (permalink / raw)
To: sj, shuah, damon, linux-mm, linux-kselftest, linux-kernel; +Cc: wang wei
In the ensure_file() function, the "not_exist" code path checks
whether $dir exists as a regular file. However, the intent is to
verify that the target file ($file) does not exist, not the $dir.
Testing $dir makes the existence check effectively useless --
it tests the wrong path and thus never catches the case
where the file is unexpectedly present.
Replace $dir with $file so the not_exist verification targets the
correct path.
Signed-off-by: wang wei <a929244872@163.com>
---
tools/testing/selftests/damon/sysfs.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/damon/sysfs.sh b/tools/testing/selftests/damon/sysfs.sh
index 78f4badb5..bf4684d36 100755
--- a/tools/testing/selftests/damon/sysfs.sh
+++ b/tools/testing/selftests/damon/sysfs.sh
@@ -67,7 +67,7 @@ ensure_file()
echo "$file permission: expected $permission but $perm"
exit 1
fi
- elif [ "$to_ensure" = "not_exist" ] && [ -f "$dir" ]
+ elif [ "$to_ensure" = "not_exist" ] && [ -f "$file" ]
then
echo "$file is not expected but found"
exit 1
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests/damon: check correct path in ensure_file() not_exist case
2026-07-06 13:43 [PATCH] selftests/damon: check correct path in ensure_file() not_exist case wang wei
@ 2026-07-06 14:29 ` SJ Park
0 siblings, 0 replies; 2+ messages in thread
From: SJ Park @ 2026-07-06 14:29 UTC (permalink / raw)
To: wang wei
Cc: SJ Park, shuah, damon, linux-mm, linux-kselftest, linux-kernel,
Andrew Morton
+ Andrew
On Mon, 6 Jul 2026 21:43:04 +0800 wang wei <a929244872@163.com> wrote:
> In the ensure_file() function, the "not_exist" code path checks
> whether $dir exists as a regular file. However, the intent is to
> verify that the target file ($file) does not exist, not the $dir.
> Testing $dir makes the existence check effectively useless --
> it tests the wrong path and thus never catches the case
> where the file is unexpectedly present.
>
> Replace $dir with $file so the not_exist verification targets the
> correct path.
Nice catch, thank you!
>
> Signed-off-by: wang wei <a929244872@163.com>
Reviewed-by: SJ Park <sj@kernel.org>
This patch is applied to damon/next [1] tree. If this patch is not added to
mm.git in short term (~1 week?), I will ask mm.git maintainer (Andrew Morton)
to pick this. So, no action from your side is needed for now. If it seems I
also forgot doing that or you cannot wait for my action, please feel free to
directly ask that to Andrew.
[1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-06 14:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06 13:43 [PATCH] selftests/damon: check correct path in ensure_file() not_exist case wang wei
2026-07-06 14:29 ` SJ Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox