* [PATCH] mm/damon/tests/core-kunit: add damos_commit_filter test
@ 2025-08-17 2:13 Sang-Heon Jeon
2025-08-17 17:16 ` SeongJae Park
0 siblings, 1 reply; 2+ messages in thread
From: Sang-Heon Jeon @ 2025-08-17 2:13 UTC (permalink / raw)
To: sj, honggyu.kim; +Cc: damon, linux-mm, Sang-Heon Jeon
Add unit test to verify that damos_commmit_filter() change dest value well.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
This test will be succeeded after this patch [1] applied.
[1] https://lore.kernel.org/damon/20250816015116.194589-1-ekffu200098@gmail.com/
---
mm/damon/tests/core-kunit.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h
index dfedfff19940..5f5dc9db2e90 100644
--- a/mm/damon/tests/core-kunit.h
+++ b/mm/damon/tests/core-kunit.h
@@ -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),
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/damon/tests/core-kunit: add damos_commit_filter test
2025-08-17 2:13 [PATCH] mm/damon/tests/core-kunit: add damos_commit_filter test Sang-Heon Jeon
@ 2025-08-17 17:16 ` SeongJae Park
0 siblings, 0 replies; 2+ messages in thread
From: SeongJae Park @ 2025-08-17 17:16 UTC (permalink / raw)
To: Sang-Heon Jeon; +Cc: SeongJae Park, honggyu.kim, damon, linux-mm, Andrew Morton
+ Andrew
On Sun, 17 Aug 2025 11:13:48 +0900 Sang-Heon Jeon <ekffu200098@gmail.com> wrote:
> Add unit test to verify that damos_commmit_filter() change dest value well.
>
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
> ---
> This test will be succeeded after this patch [1] applied.
>
> [1] https://lore.kernel.org/damon/20250816015116.194589-1-ekffu200098@gmail.com/
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
[...]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-17 17:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-17 2:13 [PATCH] mm/damon/tests/core-kunit: add damos_commit_filter test Sang-Heon Jeon
2025-08-17 17:16 ` SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).