@@ -164,6 +164,21 @@ def assert_monitoring_attrs_committed(attrs, dump):
164
164
assert_true (dump ['max_nr_regions' ] == attrs .max_nr_regions ,
165
165
'max_nr_regions' , dump )
166
166
167
+ def assert_ctx_committed (ctx , dump ):
168
+ ops_val = {
169
+ 'vaddr' : 0 ,
170
+ 'fvaddr' : 1 ,
171
+ 'paddr' : 2 ,
172
+ }
173
+ assert_true (dump ['ops' ]['id' ] == ops_val [ctx .ops ], 'ops_id' , dump )
174
+ assert_monitoring_attrs_committed (ctx .monitoring_attrs , dump ['attrs' ])
175
+ assert_schemes_committed (ctx .schemes , dump ['schemes' ])
176
+
177
+ def assert_ctxs_committed (ctxs , dump ):
178
+ assert_true (len (ctxs ) == len (dump ), 'ctxs length' , dump )
179
+ for idx , ctx in enumerate (ctxs ):
180
+ assert_ctx_committed (ctx , dump [idx ])
181
+
167
182
def main ():
168
183
kdamonds = _damon_sysfs .Kdamonds (
169
184
[_damon_sysfs .Kdamond (
@@ -182,18 +197,7 @@ def main():
182
197
kdamonds .stop ()
183
198
exit (1 )
184
199
185
- if len (status ['contexts' ]) != 1 :
186
- fail ('number of contexts' , status )
187
-
188
- ctx = status ['contexts' ][0 ]
189
-
190
- assert_monitoring_attrs_committed (_damon_sysfs .DamonAttrs (), ctx ['attrs' ])
191
-
192
- if ctx ['adaptive_targets' ] != [
193
- { 'pid' : 0 , 'nr_regions' : 0 , 'regions_list' : []}]:
194
- fail ('adaptive targets' , status )
195
-
196
- assert_schemes_committed ([_damon_sysfs .Damos ()], ctx ['schemes' ])
200
+ assert_ctxs_committed (kdamonds .kdamonds [0 ].contexts , status ['contexts' ])
197
201
198
202
kdamonds .stop ()
199
203
0 commit comments