From: SeongJae Park Date: Tue, 11 Nov 2025 18:44:01 +0000 (-0800) Subject: mm/damon/tests/core-kunit: split out damos_test_commit_filter() core logic X-Git-Tag: v6.19-rc1~112^2~123 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1968236f7517ffde240433f2cd84d902ecd11499;p=thirdparty%2Flinux.git mm/damon/tests/core-kunit: split out damos_test_commit_filter() core logic damos_test_commit_filter() is written for only a single test case. Split out the core logic of damos_test_commit_filter() as a general one so that it can be reused for multiple test cases. Link: https://lkml.kernel.org/r/20251111184415.141757-3-sj@kernel.org Signed-off-by: SeongJae Park Cc: Brendan Higgins Cc: David Gow Signed-off-by: Andrew Morton --- diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h index ae97886137dc5..31f90cfcabf3a 100644 --- a/mm/damon/tests/core-kunit.h +++ b/mm/damon/tests/core-kunit.h @@ -497,6 +497,15 @@ static void damos_test_new_filter(struct kunit *test) damos_destroy_filter(filter); } +static void damos_test_commit_filter_for(struct kunit *test, + struct damos_filter *dst, struct damos_filter *src) +{ + damos_commit_filter(dst, src); + KUNIT_EXPECT_EQ(test, dst->type, src->type); + KUNIT_EXPECT_EQ(test, dst->matching, src->matching); + KUNIT_EXPECT_EQ(test, dst->allow, src->allow); +} + static void damos_test_commit_filter(struct kunit *test) { struct damos_filter src_filter = { @@ -509,10 +518,7 @@ static void damos_test_commit_filter(struct kunit *test) .allow = 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_test_commit_filter_for(test, &dst_filter, &src_filter); } static void damos_test_filter_out(struct kunit *test)