Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <sj@kernel.org>
Cc: Brendan Higgins <brendan.higgins@linux.dev>
Cc: David Gow <davidgow@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
1968236f 37104286

+10 -4
+10 -4
mm/damon/tests/core-kunit.h
··· 497 497 damos_destroy_filter(filter); 498 498 } 499 499 500 + static void damos_test_commit_filter_for(struct kunit *test, 501 + struct damos_filter *dst, struct damos_filter *src) 502 + { 503 + damos_commit_filter(dst, src); 504 + KUNIT_EXPECT_EQ(test, dst->type, src->type); 505 + KUNIT_EXPECT_EQ(test, dst->matching, src->matching); 506 + KUNIT_EXPECT_EQ(test, dst->allow, src->allow); 507 + } 508 + 500 509 static void damos_test_commit_filter(struct kunit *test) 501 510 { 502 511 struct damos_filter src_filter = { ··· 518 509 .allow = false, 519 510 }; 520 511 521 - damos_commit_filter(&dst_filter, &src_filter); 522 - KUNIT_EXPECT_EQ(test, dst_filter.type, src_filter.type); 523 - KUNIT_EXPECT_EQ(test, dst_filter.matching, src_filter.matching); 524 - KUNIT_EXPECT_EQ(test, dst_filter.allow, src_filter.allow); 512 + damos_test_commit_filter_for(test, &dst_filter, &src_filter); 525 513 } 526 514 527 515 static void damos_test_filter_out(struct kunit *test)