fix: list passing entries in verbose verify JSON

verify accepted --verbose beside --json and dropped it in every
mode, so the output was the same with or without it. The JSON now
lists every entry with its ground truth under --verbose.
This commit is contained in:
Abdessamad Derraz committed 2026-10-18 02:50:18 +02:00
1 parent 8a9d6919d9
commit 1bdfb8d75e
3 files changed
+46 -8

No files matched your search

+13 -7
View File
@@ -2165,9 +2165,7 @@ def _main(held: contextlib.ExitStack) -> None:
regions=requested_regions, platforms_dir=args.platforms_dir,
)
if args.json:
result["details"] = [
d for d in result["details"] if d["status"] != Status.OK
]
result["details"] = _json_details(result["details"], args.verbose)
print(json.dumps(result, indent=2))
else:
print_emulator_result(result, verbose=args.verbose)
@@ -2182,9 +2180,7 @@ def _main(held: contextlib.ExitStack) -> None:
regions=requested_regions, platforms_dir=args.platforms_dir,
)
if args.json:
result["details"] = [
d for d in result["details"] if d["status"] != Status.OK
]
result["details"] = _json_details(result["details"], args.verbose)
print(json.dumps(result, indent=2))
else:
print_emulator_result(result, verbose=args.verbose)
@@ -2255,12 +2251,22 @@ def _main(held: contextlib.ExitStack) -> None:
if args.json:
for r in all_results.values():
r["details"] = [d for d in r["details"] if d["status"] != Status.OK]
r["details"] = _json_details(r["details"], args.verbose)
print(json.dumps(all_results, indent=2))
_exit_if_strict(args.strict, [r for r, _ in group_results])
def _json_details(details: list[dict], verbose: bool) -> list[dict]:
"""The entries a JSON report lists: what needs attention, or every one.
--verbose shows each entry with its ground truth in the text report; it
used to be accepted beside --json and dropped, the output byte for byte
the same, so a script asking for the passing entries got nothing.
"""
return list(details) if verbose else [d for d in details if d["status"] != Status.OK]
def _exit_if_strict(strict: bool, results: list[dict]) -> None:
"""Exit 1 under --strict when a platform result counts a critical file:
a required file missing or rejected where the frontend reads hashes."""
+30
View File
@@ -345,6 +345,36 @@ class DoubledCitationPaths(unittest.TestCase):
self.assertEqual(errors, [])
class VerboseAppliesToJson(unittest.TestCase):
"""verify accepted --verbose beside --json in every mode and dropped it:
the output was byte for byte the same, and the passing entries a script
asked for never came."""
def _run(self, *args: str) -> dict:
import json
import subprocess
completed = subprocess.run(
[sys.executable, "scripts/verify.py", *args, "--json"],
capture_output=True, text=True, cwd=ROOT, timeout=900, check=False,
)
self.assertEqual(completed.returncode, 0, completed.stderr[-2000:])
return json.loads(completed.stdout)
def test_emulator_and_system_modes_list_the_passing_entries(self):
for mode in (("--emulator", "handy"), ("--system", "atari-lynx")):
with self.subTest(mode=mode[0]):
plain = self._run(*mode)
verbose = self._run(*mode, "--verbose")
self.assertGreater(len(verbose["details"]), len(plain["details"]))
self.assertIn("ok", {d["status"] for d in verbose["details"]})
def test_every_json_branch_reads_the_flag(self):
source = (ROOT / "scripts" / "verify.py").read_text()
self.assertEqual(source.count("_json_details("), 4)
self.assertNotIn('if d["status"] != Status.OK\n ]', source)
class FaqRegressions(unittest.TestCase):
"""The FAQ states facts the code owns; these tie it back to the source.
+3 -1
View File
@@ -210,8 +210,10 @@ python scripts/verify.py --system sony-playstation
# By hardware target
python scripts/verify.py --platform retroarch --target switch
# JSON for scripted processing
# JSON for scripted processing: the entries that need attention
python scripts/verify.py --platform retroarch --json
# every entry, passing ones included, with its ground truth
python scripts/verify.py --platform retroarch --json --verbose
```
## Installation script fails