From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SeongJae Park <sj@kernel.org>, Shuah Khan <shuah@kernel.org>,
damon@lists.linux.dev, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 03/10] selftests/damon/_damon_sysfs: find sysfs mount point from /proc/mounts
Date: Fri, 3 May 2024 11:03:11 -0700 [thread overview]
Message-ID: <20240503180318.72798-4-sj@kernel.org> (raw)
In-Reply-To: <20240503180318.72798-1-sj@kernel.org>
_damon_sysfs.py assumes sysfs is mounted at /sys. In some systems, that
might not be true. Find the mount point from /proc/mounts file content.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
tools/testing/selftests/damon/_damon_sysfs.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/selftests/damon/_damon_sysfs.py
index fffa74a78bd7..5367e98817a9 100644
--- a/tools/testing/selftests/damon/_damon_sysfs.py
+++ b/tools/testing/selftests/damon/_damon_sysfs.py
@@ -2,7 +2,18 @@
import os
-sysfs_root = '/sys/kernel/mm/damon/admin'
+ksft_skip=4
+
+sysfs_root = None
+with open('/proc/mounts', 'r') as f:
+ for line in f:
+ dev_name, mount_point, dev_fs = line.split()[:3]
+ if dev_fs == 'sysfs':
+ sysfs_root = '%s/kernel/mm/damon/admin' % mount_point
+ break
+if sysfs_root is None:
+ print('Seems sysfs not mounted?')
+ exit(ksft_skip)
def write_file(path, string):
"Returns error string if failed, or None otherwise"
--
2.39.2
next prev parent reply other threads:[~2024-05-03 18:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 18:03 [PATCH 00/10] mm/damon: misc fixes and improvements SeongJae Park
2024-05-03 18:03 ` [PATCH 01/10] mm/damon/core: initialize ->esz_bp from damos_quota_init_priv() SeongJae Park
2024-05-03 18:03 ` [PATCH 02/10] selftests/damon/_damon_sysfs: check errors from nr_schemes file reads SeongJae Park
2024-05-03 18:03 ` SeongJae Park [this message]
2024-05-03 18:03 ` [PATCH 05/10] selftests/damon: classify tests for functionalities and regressions SeongJae Park
2024-05-03 18:03 ` [PATCH 06/10] Docs/admin-guide/mm/damon/usage: fix wrong example of DAMOS filter matching sysfs file SeongJae Park
2024-05-03 18:03 ` [PATCH 07/10] Docs/admin-guide/mm/damon/usage: fix wrong schemes effective quota update command SeongJae Park
2024-05-03 18:03 ` [PATCH 08/10] Docs/mm/damon/design: use a list for supported filters SeongJae Park
2024-05-03 18:03 ` [PATCH 09/10] Docs/mm/damon/maintainer-profile: change the maintainer's timezone from PST to PT SeongJae Park
2024-05-03 18:03 ` [PATCH 10/10] Docs/mm/damon/maintainer-profile: allow posting patches based on damon/next tree SeongJae Park
2024-05-03 18:06 ` [PATCH 00/10] mm/damon: misc fixes and improvements SeongJae 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=20240503180318.72798-4-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shuah@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