From: SJ Park <sj@kernel.org>
Cc: SJ Park <sj@kernel.org>, Shuah Khan <shuah@kernel.org>,
damon@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-mm@kvack.org
Subject: [RFC PATCH 5/6] selftests/damon/sysfs.py: extend commit assertion function for probes
Date: Wed, 29 Jul 2026 07:47:36 -0700 [thread overview]
Message-ID: <20260729144738.90895-6-sj@kernel.org> (raw)
In-Reply-To: <20260729144738.90895-1-sj@kernel.org>
Extend DAMON sysfs testing commit assertion helper function to check
probes too.
Signed-off-by: SJ Park <sj@kernel.org>
---
tools/testing/selftests/damon/sysfs.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftests/damon/sysfs.py
index 88a26422ff44c..159cbeac067f8 100755
--- a/tools/testing/selftests/damon/sysfs.py
+++ b/tools/testing/selftests/damon/sysfs.py
@@ -178,6 +178,24 @@ def assert_monitoring_attrs_committed(attrs, dump):
assert_true(dump['max_nr_regions'] == attrs.max_nr_regions,
'max_nr_regions', dump)
+def assert_damon_filters_committed(filters, dump):
+ assert_true(len(dump) == len(filters.filters), 'probe filters', dump)
+ for idx, damon_filter in enumerate(filters.filters):
+ filter_dump = dump[idx]
+ assert_true(filter_dump['type'] == damon_filter.type_, 'type',
+ filter_dump)
+ assert_true(filter_dump['matching'] == damon_filter.matching,
+ 'matching', filter_dump)
+ assert_true(filter_dump['allow'] == damon_filter.allow, 'allow',
+ filter_dump)
+
+def assert_probes_committed(probes, dump):
+ assert_true(len(dump) == len(probes.probes), 'probes length', dump)
+ for idx, probe in enumerate(probes.probes):
+ probe_dump = dump[idx]
+ assert_true(probe.weight == probe_dump['weight'], 'weight', probe_dump)
+ assert_damon_filters_committed(probe.filters, probe_dump['filters'])
+
def assert_monitoring_target_committed(target, dump):
# target.pid is the pid "number", while dump['pid'] is 'struct pid'
# pointer, and hence cannot be compared.
@@ -196,6 +214,7 @@ def assert_ctx_committed(ctx, dump):
}
assert_true(dump['ops']['id'] == ops_val[ctx.ops], 'ops_id', dump)
assert_monitoring_attrs_committed(ctx.monitoring_attrs, dump['attrs'])
+ assert_probes_committed(ctx.monitoring_attrs.probes, dump['probes'])
assert_monitoring_targets_committed(ctx.targets, dump['adaptive_targets'])
assert_schemes_committed(ctx.schemes, dump['schemes'])
assert_true(dump['pause'] == ctx.pause, 'pause', dump)
--
2.47.3
next prev parent reply other threads:[~2026-07-29 14:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 14:47 [RFC PATCH 0/6] mm/damon: add kunit and selftests for probes and probe weights SJ Park
2026-07-29 14:47 ` [RFC PATCH 1/6] mm/damon/tests/core-kunit: test damon_commit_filter() SJ Park
2026-07-29 14:47 ` [RFC PATCH 2/6] mm/damon/tests/core-kunit: add damon_commit_probes() test SJ Park
2026-07-29 14:47 ` [RFC PATCH 3/6] selftests/damon/_damon_sysfs: implement DamonProbes SJ Park
2026-07-29 14:47 ` [RFC PATCH 4/6] selftests/damon/drgn_dump_damon_status: dump probes SJ Park
2026-07-29 14:47 ` SJ Park [this message]
2026-07-29 14:47 ` [RFC PATCH 6/6] selftests/damon/sysfs.py: test damon probes SJ 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=20260729144738.90895-6-sj@kernel.org \
--to=sj@kernel.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