Skip to content

Commit 582ccf7

Browse files
sjp38akpm00
authored andcommitted
selftests/damon/damon_nr_regions: sort collected regiosn before checking with min/max boundaries
damon_nr_regions.py starts DAMON, periodically collect number of regions in snapshots, and see if it is in the requested range. The check code assumes the numbers are sorted on the collection list, but there is no such guarantee. Hence this can result in false positive test success. Sort the list before doing the check. Link: https://lkml.kernel.org/r/[email protected] Fixes: 7814973 ("selftests/damon: implement test for min/max_nr_regions") Signed-off-by: SeongJae Park <[email protected]> Cc: Shuah Khan <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 695469c commit 582ccf7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/testing/selftests/damon/damon_nr_regions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def test_nr_regions(real_nr_regions, min_nr_regions, max_nr_regions):
6565

6666
test_name = 'nr_regions test with %d/%d/%d real/min/max nr_regions' % (
6767
real_nr_regions, min_nr_regions, max_nr_regions)
68+
collected_nr_regions.sort()
6869
if (collected_nr_regions[0] < min_nr_regions or
6970
collected_nr_regions[-1] > max_nr_regions):
7071
print('fail %s' % test_name)

0 commit comments

Comments
 (0)