Skip to contentSkip to conversation

selftests-damon-sysfspy-generalize-damon-context-commit-assertion.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jul 26, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: selftests/damon/sysfs.py: generalize DAMON context commit assertion
has been removed from the -mm tree. Its filename was
selftests-damon-sysfspy-generalize-damon-context-commit-assertion.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: SeongJae Park <[email protected]>
Subject: selftests/damon/sysfs.py: generalize DAMON context commit assertion
Date: Sun, 20 Jul 2025 10:16:50 -0700

DAMON context commitment assertion is hard-coded for a specific test case. Split it out into a general version that can be reused for different test cases.

---

 tools/testing/selftests/damon/sysfs.py |   28 +++++++++++++----------
 1 file changed, 16 insertions(+), 12 deletions(-)
tools/testing/selftests/damon/sysfs.py renamed from tools/testing/selftests/damon/sysfs.py~selftests-damon-sysfspy-generalize-damon-context-commit-assertion +16 -12
@@ -164,6 +164,21 @@ def assert_monitoring_attrs_committed(at
     assert_true(dump['max_nr_regions'] == attrs.max_nr_regions,
                 'max_nr_regions', dump)
 
+def assert_ctx_committed(ctx, dump):
+    ops_val = {
+            'vaddr': 0,
+            'fvaddr': 1,
+            'paddr': 2,
+            }
+    assert_true(dump['ops']['id'] == ops_val[ctx.ops], 'ops_id', dump)
+    assert_monitoring_attrs_committed(ctx.monitoring_attrs, dump['attrs'])
+    assert_schemes_committed(ctx.schemes, dump['schemes'])
+
+def assert_ctxs_committed(ctxs, dump):
+    assert_true(len(ctxs) == len(dump), 'ctxs length', dump)
+    for idx, ctx in enumerate(ctxs):
+        assert_ctx_committed(ctx, dump[idx])
+
 def main():
     kdamonds = _damon_sysfs.Kdamonds(
             [_damon_sysfs.Kdamond(
@@ -182,18 +197,7 @@ def main():
         kdamonds.stop()
         exit(1)
 
-    if len(status['contexts']) != 1:
-        fail('number of contexts', status)
-
-    ctx = status['contexts'][0]
-
-    assert_monitoring_attrs_committed(_damon_sysfs.DamonAttrs(), ctx['attrs'])
-
-    if ctx['adaptive_targets'] != [
-            { 'pid': 0, 'nr_regions': 0, 'regions_list': []}]:
-        fail('adaptive targets', status)
-
-    assert_schemes_committed([_damon_sysfs.Damos()], ctx['schemes'])
+    assert_ctxs_committed(kdamonds.kdamonds[0].contexts, status['contexts'])
 
     kdamonds.stop()
 

_

Patches currently in -mm which might be from [email protected] are