@@ -195,7 +195,9 @@ def scan_executed_xml(xml_root: Path, valid_types: set[str]) -> dict[tuple[str,
195195        sketch  =  parts [t_idx  +  1 ]
196196        target  =  parts [t_idx  +  2 ]
197197        key  =  (platform , target , test_type , sketch )
198-         counts [key ] =  counts .get (key , 0 ) +  1 
198+         old_count  =  counts .get (key , 0 )
199+         counts [key ] =  old_count  +  1 
200+         print (f"[DEBUG]  Executed XML #{ old_count  +  1 } { platform } { target } { test_type } { sketch } { xml_path .name }  , file = sys .stderr )
199201    print (f"[DEBUG] Executed entries discovered: { len (counts )}  , file = sys .stderr )
200202    return  counts 
201203
@@ -266,22 +268,45 @@ def main():
266268    if  qemu_enabled :
267269        enabled_plats .add ("qemu" )
268270
269-     target_set  =  set (hw_targets  +  wokwi_targets  +  qemu_targets )
270-     type_set  =  set (hw_types  +  wokwi_types  +  qemu_types )
271+     # Build platform-specific target and type sets 
272+     plat_targets  =  {
273+         "hardware" : set (hw_targets ),
274+         "wokwi" : set (wokwi_targets ),
275+         "qemu" : set (qemu_targets ),
276+     }
277+     plat_types  =  {
278+         "hardware" : set (hw_types ),
279+         "wokwi" : set (wokwi_types ),
280+         "qemu" : set (qemu_types ),
281+     }
271282
272283    missing_total  =  0 
284+     extra_total  =  0 
273285    for  (plat , target , test_type , sketch ), exp_count  in  expected .items ():
274286        if  plat  not  in enabled_plats :
275287            continue 
276-         if  target  not  in target_set  or  test_type  not  in type_set :
288+         # Check if target and type are valid for this specific platform 
289+         if  target  not  in plat_targets .get (plat , set ()):
290+             continue 
291+         if  test_type  not  in plat_types .get (plat , set ()):
277292            continue 
278293        got  =  executed .get ((plat , target , test_type , sketch ), 0 )
279294        if  got  <  exp_count :
280295            print (f"[DEBUG] Missing: plat={ plat } { target } { test_type } { sketch } { exp_count } { got }  , file = sys .stderr )
281296            write_missing_xml (out_root , plat , target , test_type , sketch , exp_count  -  got )
282297            missing_total  +=  (exp_count  -  got )
298+         elif  got  >  exp_count :
299+             print (f"[DEBUG] Extra runs: plat={ plat } { target } { test_type } { sketch } { exp_count } { got }  , file = sys .stderr )
300+             extra_total  +=  (got  -  exp_count )
301+ 
302+     # Check for executed tests that were not expected at all 
303+     for  (plat , target , test_type , sketch ), got  in  executed .items ():
304+         if  (plat , target , test_type , sketch ) not  in expected :
305+             print (f"[DEBUG] Unexpected test: plat={ plat } { target } { test_type } { sketch } { got }  , file = sys .stderr )
283306
284307    print (f"Generated { missing_total }  , file = sys .stderr )
308+     if  extra_total  >  0 :
309+         print (f"WARNING: { extra_total }  , file = sys .stderr )
285310
286311
287312if  __name__  ==  "__main__" :
0 commit comments