mm/damon/tests/core-kunit: add damos_commit_filter test
Subsystems (2)
PATCH 1/1 mm/damon/tests/core-kunit: add damos_commit_filter test
Add unit test to verify that damos_commmit_filter() change dest value well.
Signed-off-by Sang-Heon Jeon <[email protected]>
---
This test will be succeeded after this patch [1] applied.
[1] https://lore.kernel.org/damon/[email protected]/
--- mm/damon/tests/core-kunit.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
mm/damon/tests/core-kunit.h +17 -0
@@ -419,6 +419,22 @@ static void damos_test_new_filter(struct kunit *test)damos_destroy_filter (filter); } +static void damos_test_commit_filter (struct kunit *test) +{ +struct damos_filter *src_filter =damos_new_filter ( +DAMOS_FILTER_TYPE_ANON , true, true); +struct damos_filter *dst_filter =damos_new_filter ( +DAMOS_FILTER_TYPE_ACTIVE , false, false); + +damos_commit_filter (dst_filter, src_filter); +KUNIT_EXPECT_EQ (test, dst_filter->type, src_filter->type); +KUNIT_EXPECT_EQ (test, dst_filter->matching, src_filter->matching); +KUNIT_EXPECT_EQ (test, dst_filter->allow, src_filter->allow); + +damos_destroy_filter (src_filter); +damos_destroy_filter (dst_filter); +} +static void damos_test_filter_out (struct kunit *test) {struct damon_target *t;
@@ -594,6 +610,7 @@ static struct kunit_case damon_test_cases[] = {KUNIT_CASE (damon_test_set_attrs),KUNIT_CASE (damon_test_moving_sum),KUNIT_CASE (damos_test_new_filter), +KUNIT_CASE (damos_test_commit_filter),KUNIT_CASE (damos_test_filter_out),KUNIT_CASE (damon_test_feed_loop_next_input), KUNIT_CASE(damon_test_set_filters_default_reject),
Signature · 1 line
2.43.0
+ Andrew
Quoted 3 lines · On Sun, 17 Aug 2025 11:13:48 +0900 Sang-Heon Jeon <[email protected]> wrote:
Add unit test to verify that
damos_commmit_filter()change dest value well.Signed-off-by Sang-Heon Jeon <[email protected]>
Reviewed-by SeongJae Park <[email protected]>
Quoted 4 lines
---
This test will be succeeded after this patch [1] applied.
FWIW, the subject of the patch is "mm/damon/core: fix damos_commit_filter not changing allow". This patch should be applied _after_ the fix, since the new test that this patch is adding will fail and make 'git bisect' complicated, otherwise.
Thanks,
SJ
[...]