If access_memory exits before the first update_schemes_stats(), the schemes' stats stay None and reading nr_tried at the end crashes with: AttributeError: 'NoneType' object has no attribute 'nr_tried' Check for that and fail with the child's return code instead. Signed-off-by: Enze Li --- tools/testing/selftests/damon/damos_apply_interval.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/damon/damos_apply_interval.py b/tools/testing/selftests/damon/damos_apply_interval.py index 0ad110be0fb9..127253f29c9f 100755 --- a/tools/testing/selftests/damon/damos_apply_interval.py +++ b/tools/testing/selftests/damon/damos_apply_interval.py @@ -49,6 +49,12 @@ def main(): print('stats update failed: %s' % err) exit(1) schemes = kdamonds.kdamonds[0].contexts[0].schemes + if schemes[0].stats is None: + print('access_memory terminated early: %d' % proc.returncode) + err = kdamonds.kdamonds[0].stop() + if err is not None: + print('kdamond stop failed: %s' % err) + exit(1) nr_tried_stats = [s.stats.nr_tried for s in schemes] if nr_tried_stats[0] == 0 or nr_tried_stats[1] == 0: print('scheme(s) are not tried') -- 2.53.0