forge: selftest_sweep report() Counter census refactor — single-scan verdict census replacing two full scans, 39/39 selftest cells + 21-tool live sweep pass
This commit is contained in:
1 parent
efa10638ae
commit
27c9869b62
3 files changed
+217
-5
No files matched your search
@@ -148,6 +148,7 @@ import re
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from collections import Counter
|
||||
|
||||
# The default target is the checkout this file lives in -- the same path in
|
||||
# place, a different path in a copy. An absolute literal here would make a bare
|
||||
@@ -500,7 +501,7 @@ def sweep(rows, repo: str, timeout: int, verbose: bool):
|
||||
# --------------------------------------------------------------------- report
|
||||
|
||||
def report(results, source, untracked, quiet=False):
|
||||
fatal = [r for r in results if r["verdict"] in FATAL]
|
||||
counts = Counter(r["verdict"] for r in results) # one census pass (was: fatal list-comp + ok sum = two full scans of results)
|
||||
if not quiet:
|
||||
print(f"discovery: {source}")
|
||||
for name in untracked:
|
||||
@@ -517,10 +518,11 @@ def report(results, source, untracked, quiet=False):
|
||||
print(f"{r['tool']:<{width}} {r['verdict']:<16} {claim_s:>12} "
|
||||
f"{printed_s:>12} {r['detail']}")
|
||||
print()
|
||||
ok = sum(1 for r in results if r["verdict"] == "OK")
|
||||
print(f"sweep: {len(results)} tools, {ok} OK, {len(fatal)} fatal"
|
||||
+ (f" ({', '.join(sorted({r['verdict'] for r in fatal}))})" if fatal else ""))
|
||||
return 1 if fatal else 0, ok, len(fatal)
|
||||
n_fatal = sum(counts[v] for v in FATAL)
|
||||
fatal_verdicts = sorted(v for v in counts if v in FATAL)
|
||||
print(f"sweep: {len(results)} tools, {counts['OK']} OK, {n_fatal} fatal"
|
||||
+ (f" ({', '.join(fatal_verdicts)})" if n_fatal else ""))
|
||||
return 1 if n_fatal else 0, counts["OK"], n_fatal
|
||||
|
||||
|
||||
# --------------------------------------------------------------- count pin
|
||||
|
||||
Reference in new issue
Block a user