]> www.infradead.org Git - users/hch/block.git/commitdiff
selftests/damon/_chk_dependency: get debugfs mount point from /proc/mounts
authorSeongJae Park <sj@kernel.org>
Wed, 7 Feb 2024 20:31:34 +0000 (12:31 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 22 Feb 2024 18:24:57 +0000 (10:24 -0800)
DAMON debugfs selftests dependency checker assumes debugfs would be
mounted at /sys/kernel/debug.  That would be ok for many cases, but some
systems might mounted the file system on some different places.  Parse the
real mount point using /proc/mounts file.

Link: https://lkml.kernel.org/r/20240207203134.69976-9-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/damon/_chk_dependency.sh

index 350f8c2b071dbc4ed0f9eb7c7ae2407e4757bfc5..dda3a87dc00a267a365d1116c987423f3510a823 100644 (file)
@@ -4,7 +4,14 @@
 # Kselftest framework requirement - SKIP code is 4.
 ksft_skip=4
 
-DBGFS=/sys/kernel/debug/damon
+DBGFS=$(grep debugfs /proc/mounts --max-count 1 | awk '{print $2}')
+if [ "$DBGFS" = "" ]
+then
+       echo "debugfs not mounted"
+       exit $ksft_skip
+fi
+
+DBGFS+="/damon"
 
 if [ $EUID -ne 0 ];
 then