mirror of https://github.com/torvalds/linux.git
mm/damon/tests/core-kunit: add damos_commit_filter test
Add unit test to verify that damos_commmit_filter() change dest value well. Link: https://lkml.kernel.org/r/20250817021348.570692-1-ekffu200098@gmail.com Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com> Reviewed-by: SeongJae Park <sj@kernel.org> Cc: Honggyu Kim <honggyu.kim@sk.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
4bd22a7ae5
commit
f6a4a150f1
|
|
@ -419,6 +419,22 @@ static void damos_test_new_filter(struct kunit *test)
|
||||||
damos_destroy_filter(filter);
|
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)
|
static void damos_test_filter_out(struct kunit *test)
|
||||||
{
|
{
|
||||||
struct damon_target *t;
|
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_set_attrs),
|
||||||
KUNIT_CASE(damon_test_moving_sum),
|
KUNIT_CASE(damon_test_moving_sum),
|
||||||
KUNIT_CASE(damos_test_new_filter),
|
KUNIT_CASE(damos_test_new_filter),
|
||||||
|
KUNIT_CASE(damos_test_commit_filter),
|
||||||
KUNIT_CASE(damos_test_filter_out),
|
KUNIT_CASE(damos_test_filter_out),
|
||||||
KUNIT_CASE(damon_test_feed_loop_next_input),
|
KUNIT_CASE(damon_test_feed_loop_next_input),
|
||||||
KUNIT_CASE(damon_test_set_filters_default_reject),
|
KUNIT_CASE(damon_test_set_filters_default_reject),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue