summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwang wei <a929244872@163.com>2026-07-06 21:43:04 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-07-30 19:48:08 -0700
commitb389d3122522cd68595f74a4b5c1fdad39a818b2 (patch)
treeb3d676399afaf6116f52fc1a97028bde253176c3
parentae10cd55844a11a8293bb0aec082cd4700c8890e (diff)
downloadlinux-next-b389d3122522cd68595f74a4b5c1fdad39a818b2.tar.gz
linux-next-b389d3122522cd68595f74a4b5c1fdad39a818b2.zip
selftests/damon: check correct path in ensure_file() not_exist case
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. Link: https://lore.kernel.org/20260706134305.5224-1-a929244872@163.com Signed-off-by: wang wei <a929244872@163.com> Reviewed-by: SJ Park <sj@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rwxr-xr-xtools/testing/selftests/damon/sysfs.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/damon/sysfs.sh b/tools/testing/selftests/damon/sysfs.sh
index b43deee60fe9..f7fb94b84e71 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