Skip to content

Commit bd0487a

Browse files
sjp38akpm00
authored andcommitted
selftests/damon/sysfs.py: test DAMOS destinations commitment
Current DAMOS commitment assertion is not testing quota destinations commitment. Add the test. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: SeongJae Park <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 84dc442 commit bd0487a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tools/testing/selftests/damon/sysfs.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ def assert_quota_committed(quota, dump):
7373
assert_true(
7474
dump['weight_age'] == quota.weight_age_permil, 'weight_age', dump)
7575

76+
77+
def assert_migrate_dests_committed(dests, dump):
78+
assert_true(dump['nr_dests'] == len(dests.dests), 'nr_dests', dump)
79+
for idx, dest in enumerate(dests.dests):
80+
assert_true(dump['node_id_arr'][idx] == dest.id, 'node_id', dump)
81+
assert_true(dump['weight_arr'][idx] == dest.weight, 'weight', dump)
82+
7683
def main():
7784
kdamonds = _damon_sysfs.Kdamonds(
7885
[_damon_sysfs.Kdamond(
@@ -137,14 +144,8 @@ def main():
137144
if scheme['target_nid'] != -1:
138145
fail('damos target nid', status)
139146

140-
migrate_dests = scheme['migrate_dests']
141-
if migrate_dests['nr_dests'] != 0:
142-
fail('nr_dests', status)
143-
if migrate_dests['node_id_arr'] != []:
144-
fail('node_id_arr', status)
145-
if migrate_dests['weight_arr'] != []:
146-
fail('weight_arr', status)
147-
147+
assert_migrate_dests_committed(_damon_sysfs.DamosDests(),
148+
scheme['migrate_dests'])
148149
assert_quota_committed(_damon_sysfs.DamosQuota(), scheme['quota'])
149150
assert_watermarks_committed(_damon_sysfs.DamosWatermarks(),
150151
scheme['wmarks'])

0 commit comments

Comments
 (0)