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: add damos_commit_quota() test

Add a new unit test for damos_commit_quota().

Link: https://lkml.kernel.org/r/20251111184415.141757-8-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
11bb980d d9adfb8a

+33
+33
mm/damon/tests/core-kunit.h
··· 660 660 (struct damos_quota_goal[]){}, 0); 661 661 } 662 662 663 + static void damos_test_commit_quota(struct kunit *test) 664 + { 665 + struct damos_quota dst = { 666 + .reset_interval = 1, 667 + .ms = 2, 668 + .sz = 3, 669 + .weight_sz = 4, 670 + .weight_nr_accesses = 5, 671 + .weight_age = 6, 672 + }; 673 + struct damos_quota src = { 674 + .reset_interval = 7, 675 + .ms = 8, 676 + .sz = 9, 677 + .weight_sz = 10, 678 + .weight_nr_accesses = 11, 679 + .weight_age = 12, 680 + }; 681 + 682 + INIT_LIST_HEAD(&dst.goals); 683 + INIT_LIST_HEAD(&src.goals); 684 + 685 + damos_commit_quota(&dst, &src); 686 + 687 + KUNIT_EXPECT_EQ(test, dst.reset_interval, src.reset_interval); 688 + KUNIT_EXPECT_EQ(test, dst.ms, src.ms); 689 + KUNIT_EXPECT_EQ(test, dst.sz, src.sz); 690 + KUNIT_EXPECT_EQ(test, dst.weight_sz, src.weight_sz); 691 + KUNIT_EXPECT_EQ(test, dst.weight_nr_accesses, src.weight_nr_accesses); 692 + KUNIT_EXPECT_EQ(test, dst.weight_age, src.weight_age); 693 + } 694 + 663 695 static void damos_test_commit_filter_for(struct kunit *test, 664 696 struct damos_filter *dst, struct damos_filter *src) 665 697 { ··· 979 947 KUNIT_CASE(damos_test_new_filter), 980 948 KUNIT_CASE(damos_test_commit_quota_goal), 981 949 KUNIT_CASE(damos_test_commit_quota_goals), 950 + KUNIT_CASE(damos_test_commit_quota), 982 951 KUNIT_CASE(damos_test_commit_filter), 983 952 KUNIT_CASE(damos_test_filter_out), 984 953 KUNIT_CASE(damon_test_feed_loop_next_input),