summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSeongJae Park <sj@kernel.org>2025-02-25 14:23:33 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-13 13:07:48 +0100
commit827ddcbfacf8210d58ab718dbf18f2700329d6f2 (patch)
tree69701e8b69d02b7aed75f4c46d3f9a855eff4a97 /tools
parentf91dcfa65993e8485a3d90e97c3a9a6f7e5f2eeb (diff)
downloadlinux-827ddcbfacf8210d58ab718dbf18f2700329d6f2.tar.gz
linux-827ddcbfacf8210d58ab718dbf18f2700329d6f2.tar.bz2
linux-827ddcbfacf8210d58ab718dbf18f2700329d6f2.zip
selftests/damon/damon_nr_regions: sort collected regiosn before checking with min/max boundaries
commit 582ccf78f6090d88b1c7066b1e90b3d9ec952d08 upstream. 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/20250225222333.505646-4-sj@kernel.org Fixes: 781497347d1b ("selftests/damon: implement test for min/max_nr_regions") Signed-off-by: SeongJae Park <sj@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/damon/damon_nr_regions.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/damon/damon_nr_regions.py b/tools/testing/selftests/damon/damon_nr_regions.py
index 6f1c1d88e309..58f3291fed12 100755
--- a/tools/testing/selftests/damon/damon_nr_regions.py
+++ b/tools/testing/selftests/damon/damon_nr_regions.py
@@ -65,6 +65,7 @@ def test_nr_regions(real_nr_regions, min_nr_regions, max_nr_regions):
test_name = 'nr_regions test with %d/%d/%d real/min/max nr_regions' % (
real_nr_regions, min_nr_regions, max_nr_regions)
+ collected_nr_regions.sort()
if (collected_nr_regions[0] < min_nr_regions or
collected_nr_regions[-1] > max_nr_regions):
print('fail %s' % test_name)