@@ -151,6 +151,10 @@ def coverage_gained(b, m):
151151 return sorted (b ["unobserved" ] - m ["unobserved" ]) if m ["ran" ] else []
152152
153153
154+ def coverage_lost (b , m ):
155+ return sorted (m ["unobserved" ] - b ["unobserved" ]) if b ["ran" ] and m ["ran" ] else []
156+
157+
154158def distribution (summary , cls , metric ):
155159 values = []
156160 for sample in summary ["samples" ]:
@@ -177,12 +181,14 @@ def compare_case(b, m, rel, abs_):
177181 return "N/A" , ["unsupported on baseline: " + "; " .join (b .get ("why" , [])[:1 ])]
178182 if not b ["ran" ] and not m ["ran" ]:
179183 return "EQUAL" , []
184+ lost = coverage_lost (b , m )
185+ worse .extend (f"{ cls } : baseline observed -> main unobserved (lost coverage)" for cls in lost )
180186 bc , mc = b ["classes" ], m ["classes" ]
181187 stochastic = "missing-after-hold"
182188 distribution_classes = (set (bc ) | set (mc )) & {stochastic }
183189 if b ["case" ].startswith ("recording/" ) or m ["case" ].startswith ("recording/" ):
184190 distribution_classes .add (stochastic )
185- for cls in sorted (distribution_classes ):
191+ for cls in sorted (distribution_classes - set ( lost ) ):
186192 metrics = {"count" } | set (b ["measures" ].get (cls , {})) | set (m ["measures" ].get (cls , {}))
187193 for metric in sorted (metrics ):
188194 bv , mv = distribution (b , cls , metric ), distribution (m , cls , metric )
@@ -252,8 +258,8 @@ def main():
252258 out = {}
253259 print (f"# { args .title } \n " )
254260 print (f"tolerance: rel { args .rel_tol } , abs { args .abs_tol } \n " )
255- print ("| lane | cases base/main | WORSE | BETTER | EQUAL | coverage gained | insufficient | overlapping distributions | n/a on base | only base | only main | junit WORSE | junit BETTER |" )
256- print ("|---|---|---|---|---|---|---|---|---|---|---|---|---|" )
261+ print ("| lane | cases base/main | WORSE | BETTER | EQUAL | coverage gained | coverage lost | insufficient | overlapping distributions | n/a on base | only base | only main | junit WORSE | junit BETTER |" )
262+ print ("|---|---|---|---|---|---|---|---|---|---|---|---|---|---| " )
257263 detail = []
258264 for lane in lanes :
259265 b , m = brec .get (lane , {}), mrec .get (lane , {})
@@ -278,6 +284,9 @@ def main():
278284 gained = coverage_gained (bs , ms )
279285 if gained and verdict != "COVERAGE-GAINED" :
280286 res ["COVERAGE-GAINED" ].append ((key , [f"{ cls } : baseline unobserved -> main observed" for cls in gained ]))
287+ lost = coverage_lost (bs , ms )
288+ if lost :
289+ res ["COVERAGE-LOST" ].append ((key , [f"{ cls } : baseline observed -> main unobserved (lost coverage)" for cls in lost ]))
281290 bj , mj = bjunit .get (lane , {}), mjunit .get (lane , {})
282291 jworse , jbetter = [], []
283292 bad = {"fail" , "error" }
@@ -298,12 +307,12 @@ def main():
298307 jworse .append ((test , ["fail -> error (crash/timeout)" ]))
299308 print (
300309 f"| { lane } | { len (b )} /{ len (m )} | { len (res ['WORSE' ])} | { len (res ['BETTER' ])} | { len (res ['EQUAL' ])} "
301- f" | { len (res ['COVERAGE-GAINED' ])} | { len (res ['INSUFFICIENT' ])} | { len (res ['OVERLAP' ])} | { len (res ['N/A' ])} | { len (res ['ONLY-BASE' ])} | { len (res ['ONLY-MAIN' ])} | { len (jworse )} | { len (jbetter )} |"
310+ f" | { len (res ['COVERAGE-GAINED' ])} | { len (res ['COVERAGE-LOST' ]) } | { len ( res [ ' INSUFFICIENT' ])} | { len (res ['OVERLAP' ])} | { len (res ['N/A' ])} | { len (res ['ONLY-BASE' ])} | { len (res ['ONLY-MAIN' ])} | { len (jworse )} | { len (jbetter )} |"
302311 )
303312 out [lane ] = {k : v for k , v in res .items ()}
304313 out [lane ]["JUNIT-WORSE" ] = jworse
305314 out [lane ]["JUNIT-BETTER" ] = jbetter
306- for label in ("WORSE" , "BETTER" , "COVERAGE-GAINED" , "INSUFFICIENT" , "OVERLAP" , "JUNIT-WORSE" , "JUNIT-BETTER" , "N/A" , "ONLY-BASE" , "ONLY-MAIN" ):
315+ for label in ("WORSE" , "BETTER" , "COVERAGE-GAINED" , "COVERAGE-LOST" , " INSUFFICIENT" , "OVERLAP" , "JUNIT-WORSE" , "JUNIT-BETTER" , "N/A" , "ONLY-BASE" , "ONLY-MAIN" ):
307316 items = out [lane ].get (label ) or []
308317 if not items :
309318 continue
0 commit comments