diff options
author | SeongJae Park <sj@kernel.org> | 2025-07-20 10:16:48 -0700 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2025-07-26 15:08:20 -0700 |
commit | 771d7754ab28597c0370a588887f50db229d1c0d (patch) | |
tree | 45e8277466614097a88b24a97c5d0bf1b03b9a9a | |
parent | 53f800581f79555e84aeabff81a90cf954803b83 (diff) |
selftests/damon/sysfs.py: generalize DAMOS schemes commit assertion
DAMOS schemes 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.
Link: https://lkml.kernel.org/r/20250720171652.92309-19-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>
-rwxr-xr-x | tools/testing/selftests/damon/sysfs.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftests/damon/sysfs.py index 6471cb8c6de2..4d13da00733e 100755 --- a/tools/testing/selftests/damon/sysfs.py +++ b/tools/testing/selftests/damon/sysfs.py @@ -136,6 +136,11 @@ def assert_scheme_committed(scheme, dump): for idx, f in enumerate(scheme.ops_filters.filters): assert_filter_committed(f, dump['ops_filters'][idx]) +def assert_schemes_committed(schemes, dump): + assert_true(len(schemes) == len(dump), 'len_schemes', dump) + for idx, scheme in enumerate(schemes): + assert_scheme_committed(scheme, dump[idx]) + def main(): kdamonds = _damon_sysfs.Kdamonds( [_damon_sysfs.Kdamond( @@ -180,10 +185,7 @@ def main(): { 'pid': 0, 'nr_regions': 0, 'regions_list': []}]: fail('adaptive targets', status) - if len(ctx['schemes']) != 1: - fail('number of schemes', status) - - assert_scheme_committed(_damon_sysfs.Damos(), ctx['schemes'][0]) + assert_schemes_committed([_damon_sysfs.Damos()], ctx['schemes']) kdamonds.stop() |