mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 10:23:16 -05:00
fix: report ground truth as the site does
This commit is contained in:
1 parent
a81fcf0831
commit
6b9300f601
2 files changed
+47
-5
No files matched your search
+12
-5
@@ -1478,13 +1478,20 @@ def print_platform_result(
|
||||
print(f" No external files: {len(exclusions)} cores (--verbose lists them)")
|
||||
|
||||
gt_cov = result.get("ground_truth_coverage")
|
||||
if gt_cov and gt_cov["total"] > 0:
|
||||
pct = gt_cov["with_validation"] * 100 // gt_cov["total"]
|
||||
if gt_cov and not gt_cov.get("applicable", True):
|
||||
# MiSTer declares no core by design: its BiosDB is the answer, and
|
||||
# the site shows "-" for it rather than a 0% gap.
|
||||
print(" Ground truth: not applicable, the platform runs no profiled core")
|
||||
elif gt_cov and gt_cov["total"] > 0:
|
||||
# Rounded, as the site rounds: truncated, RetroArch read 20% here
|
||||
# and 21% there for one measure.
|
||||
pct = round(gt_cov["with_validation"] * 100 / gt_cov["total"])
|
||||
print(
|
||||
f" Ground truth: {gt_cov['with_validation']}/{gt_cov['total']} files have emulator validation ({pct}%)"
|
||||
)
|
||||
if gt_cov["platform_only"]:
|
||||
print(f" {gt_cov['platform_only']} platform-only (no emulator profile)")
|
||||
no_profile = gt_cov["total"] - gt_cov.get("with_profile", gt_cov["with_validation"])
|
||||
if no_profile:
|
||||
print(f" {no_profile} platform-only (no emulator profile)")
|
||||
|
||||
|
||||
# Emulator/system mode verification
|
||||
@@ -2077,7 +2084,7 @@ def print_emulator_result(result: dict, verbose: bool = False) -> None:
|
||||
# Ground truth coverage footer
|
||||
gt_cov = result.get("ground_truth_coverage")
|
||||
if gt_cov and gt_cov["total"] > 0:
|
||||
pct = gt_cov["with_validation"] * 100 // gt_cov["total"]
|
||||
pct = round(gt_cov["with_validation"] * 100 / gt_cov["total"])
|
||||
print(
|
||||
f" Ground truth: {gt_cov['with_validation']}/{gt_cov['total']} files have emulator validation ({pct}%)"
|
||||
)
|
||||
|
||||
@@ -5001,5 +5001,40 @@ class AFailedVerificationIsAnError(unittest.TestCase):
|
||||
self.assertIn('print(f"ERROR: packs failed verification: {\', \'.join(failing)}", file=sys.stderr)', source)
|
||||
|
||||
|
||||
|
||||
class TheGroundTruthFooterSaysWhatItCounts(unittest.TestCase):
|
||||
""""417 platform-only (no emulator profile)" where 369 of 526 files had
|
||||
a profile; 20% here for 21% on the site; and "0/81 (0%)" for MiSTer,
|
||||
which declares no core by design."""
|
||||
|
||||
def _footer(self, coverage):
|
||||
import io as _io
|
||||
from contextlib import redirect_stdout
|
||||
|
||||
from scripts.verify import Severity, print_platform_result
|
||||
|
||||
out = _io.StringIO()
|
||||
counts = {Severity.OK: 1, Severity.INFO: 0, Severity.WARNING: 0, Severity.CRITICAL: 0}
|
||||
result = {"platform": "X", "verification_mode": "existence", "total_files": 1,
|
||||
"severity_counts": counts, "status_counts": {"ok": 1},
|
||||
"undeclared_files": [], "exclusion_notes": [], "details": [],
|
||||
"ground_truth_coverage": coverage}
|
||||
with redirect_stdout(out):
|
||||
print_platform_result(result, ["X"])
|
||||
return out.getvalue()
|
||||
|
||||
def test_counts_and_rounding(self):
|
||||
text = self._footer({"with_validation": 109, "with_profile": 369,
|
||||
"platform_only": 417, "total": 526, "applicable": True})
|
||||
self.assertIn("(21%)", text)
|
||||
self.assertIn("157 platform-only", text)
|
||||
|
||||
def test_not_applicable(self):
|
||||
text = self._footer({"with_validation": 0, "with_profile": 0,
|
||||
"platform_only": 81, "total": 81, "applicable": False})
|
||||
self.assertIn("not applicable", text)
|
||||
self.assertNotIn("0/81", text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user