selftests/damon: three fixes for false results
Subsystems (4)
SeongJae Park
maintainercover selftests/damon: three fixes for false results
Fix three DAMON selftest bugs that causes two and one false positive failures and success.
SeongJae Park (3):
selftests/damon/damos_quota: make real expectation of quota exceeds selftests/damon/damon_nr_regions: set ops update for merge results
check to 100ms
selftests/damon/damon_nr_regions: sort collected regiosn before
checking with min/max boundaries
tools/testing/selftests/damon/damon_nr_regions.py | 2 ++ tools/testing/selftests/damon/damos_quota.py | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)
base-commit: 0ab548cd0961a01f9ef65aa999ca84febcdb04ab
Signature · 1 line
2.39.5
SeongJae Park
maintainerPATCH 1/3 selftests/damon/damos_quota: make real expectation of quota exceeds
damos_quota.py assumes the quota will always exceeded. But whether quota will be exceeded or not depend on the monitoring results. Actually the monitored workload has chaning access pattern and hence sometimes the quota may not really be exceeded. As a result, false positive test failures happen. Expect how much time the quota will be exceeded by checking the monitoring results, and use it instead of the naive assumption.
--- tools/testing/selftests/damon/damos_quota.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
tools/testing/selftests/damon/damos_quota.py +6 -3
@@ -51,16 +51,19 @@ def main(): nr_quota_exceeds = scheme.stats.qt_exceeds wss_collected.sort() + nr_expected_quota_exceeds = 0 for wss in wss_collected: if wss > sz_quota: print('quota is not kept: %s > %s' % (wss, sz_quota)) print('collected samples are as below') print('\n'.join(['%d' % wss for wss in wss_collected])) exit(1) + if wss == sz_quota: + nr_expected_quota_exceeds += 1 - if nr_quota_exceeds < len(wss_collected): - print('quota is not always exceeded: %d > %d' % - (len(wss_collected), nr_quota_exceeds)) + if nr_quota_exceeds < nr_expected_quota_exceeds: + print('quota is exceeded less than expected: %d < %d' % + (nr_quota_exceeds, nr_expected_quota_exceeds)) exit(1) if __name__ == '__main__':
Signature · 1 line
2.39.5
SeongJae Park
maintainerPATCH 2/3 selftests/damon/damon_nr_regions: set ops update for merge results check to 100ms
In reply to SeongJae Parkdamon_nr_regions.py updates max_nr_regions to a number smaller than expected number of real regions and confirms DAMON respect the harsh limit. To give time for DAMON to make changes for the regions, 3 aggregation intervals (300 milliseconds) are given.
The internal mechanism works with not only the max_nr_regions, but also sz_limit, though. It avoids merging region if that casn make region of size larger than sz_limit. In the test, sz_limit is set too small to achive the new max_nr_regions, unless it is updated for the new min_nr_regions. But the update is done only once per operations set update interval, which is one second by default.
Hence, the test randomly incurs false positive failures. Fix it by setting the ops interval same to aggregation interval, to make sure sz_limit is updated by the time of the check.
--- tools/testing/selftests/damon/damon_nr_regions.py | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/damon/damon_nr_regions.py +1 -0
@@ -109,6 +109,7 @@ def main(): attrs = kdamonds.kdamonds[0].contexts[0].monitoring_attrs attrs.min_nr_regions = 3 attrs.max_nr_regions = 7 + attrs.update_us = 100000 err = kdamonds.kdamonds[0].commit() if err is not None: proc.terminate()
Signature · 1 line
2.39.5
SeongJae Park
maintainerPATCH 3/3 selftests/damon/damon_nr_regions: sort collected regiosn before checking with min/max boundaries
In reply to SeongJae Parkdamon_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.
--- tools/testing/selftests/damon/damon_nr_regions.py | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/damon/damon_nr_regions.py +1 -0
@@ -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)
Signature · 1 line
2.39.5