Skip to content

Commit

Permalink
mm/damon/core-test: fix wrong expectations for 'damon_split_regions_o…
Browse files Browse the repository at this point in the history
…f()'

Kunit test cases for 'damon_split_regions_of()' expects the number of
regions after calling the function will be same to their request
('nr_sub').  However, the requested number is just an upper-limit,
because the function randomly decides the size of each sub-region.

This fixes the wrong expectation.

Link: https://lkml.kernel.org/r/[email protected]
Fixes: 17ccae8 ("mm/damon: add kunit tests")
Signed-off-by: SeongJae Park <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
sjp38 authored and torvalds committed Oct 29, 2021
1 parent a4aeaa0 commit 2e01466
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/damon/core-test.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,14 @@ static void damon_test_split_regions_of(struct kunit *test)
r = damon_new_region(0, 22);
damon_add_region(r, t);
damon_split_regions_of(c, t, 2);
KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 2u);
KUNIT_EXPECT_LE(test, damon_nr_regions(t), 2u);
damon_free_target(t);

t = damon_new_target(42);
r = damon_new_region(0, 220);
damon_add_region(r, t);
damon_split_regions_of(c, t, 4);
KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 4u);
KUNIT_EXPECT_LE(test, damon_nr_regions(t), 4u);
damon_free_target(t);
damon_destroy_ctx(c);
}
Expand Down

0 comments on commit 2e01466

Please sign in to comment.