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 test cases to damos_test_commit_filter()

damos_test_commit_filter() is covering only a single test case. Extend it
to cover multiple combinations of inputs.

Link: https://lkml.kernel.org/r/20251111184415.141757-5-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
3caf767e 1b43b795

+47 -6
+47 -6
mm/damon/tests/core-kunit.h
··· 528 528 529 529 static void damos_test_commit_filter(struct kunit *test) 530 530 { 531 - struct damos_filter src_filter = { 532 - .type = DAMOS_FILTER_TYPE_ANON, 533 - .matching = true, 534 - .allow = true}; 535 - struct damos_filter dst_filter = { 531 + struct damos_filter dst = { 536 532 .type = DAMOS_FILTER_TYPE_ACTIVE, 537 533 .matching = false, 538 534 .allow = false, 539 535 }; 540 536 541 - damos_test_commit_filter_for(test, &dst_filter, &src_filter); 537 + damos_test_commit_filter_for(test, &dst, 538 + &(struct damos_filter){ 539 + .type = DAMOS_FILTER_TYPE_ANON, 540 + .matching = true, 541 + .allow = true, 542 + }); 543 + damos_test_commit_filter_for(test, &dst, 544 + &(struct damos_filter){ 545 + .type = DAMOS_FILTER_TYPE_MEMCG, 546 + .matching = false, 547 + .allow = false, 548 + .memcg_id = 123, 549 + }); 550 + damos_test_commit_filter_for(test, &dst, 551 + &(struct damos_filter){ 552 + .type = DAMOS_FILTER_TYPE_YOUNG, 553 + .matching = true, 554 + .allow = true, 555 + }); 556 + damos_test_commit_filter_for(test, &dst, 557 + &(struct damos_filter){ 558 + .type = DAMOS_FILTER_TYPE_HUGEPAGE_SIZE, 559 + .matching = false, 560 + .allow = false, 561 + .sz_range = {.min = 234, .max = 345}, 562 + }); 563 + damos_test_commit_filter_for(test, &dst, 564 + &(struct damos_filter){ 565 + .type = DAMOS_FILTER_TYPE_UNMAPPED, 566 + .matching = true, 567 + .allow = true, 568 + }); 569 + damos_test_commit_filter_for(test, &dst, 570 + &(struct damos_filter){ 571 + .type = DAMOS_FILTER_TYPE_ADDR, 572 + .matching = false, 573 + .allow = false, 574 + .addr_range = {.start = 456, .end = 567}, 575 + }); 576 + damos_test_commit_filter_for(test, &dst, 577 + &(struct damos_filter){ 578 + .type = DAMOS_FILTER_TYPE_TARGET, 579 + .matching = true, 580 + .allow = true, 581 + .target_idx = 6, 582 + }); 542 583 } 543 584 544 585 static void damos_test_filter_out(struct kunit *test)