docs: show the handy output verify prints

This commit is contained in:
Abdessamad Derraz committed 2026-10-21 09:52:57 +02:00
1 parent f2628c1170
commit a6d37e40ae
3 files changed
+28 -6

No files matched your search

+1 -1
View File
@@ -1465,7 +1465,7 @@ def _format_ground_truth_aggregate(ground_truth: list[dict]) -> str:
def _format_ground_truth_verbose(ground_truth: list[dict]) -> list[str]:
"""Format ground truth as one line per core with expected values and source ref.
Example: handy validates size=512,crc32=0d973c9d [rom.h:48-49]
Example: handy validates crc32=0d973c9d,size=512 [lynx/rom.h:48-49]
"""
lines = []
for gt in ground_truth:
+19
View File
@@ -478,5 +478,24 @@ class DeriveFiguresLiveWithTheTool(unittest.TestCase):
self.assertIn("derivable.json", paragraph)
class EmulatorVerboseSample(unittest.TestCase):
"""advanced-usage.md showed `handy validates size=512 crc32=0x0d973c9d
[src/handy/system.h:45]`, a format verify.py does not print and a
reference handy.yml does not cite."""
def test_every_sample_line_is_printed(self):
import subprocess
section = _section(_page("advanced-usage.md"), "Per-emulator checks")
sample = [body for lang, body in re.findall(r"(?ms)^```(\w*)\n(.*?)^```", section) if not lang][-1]
printed = subprocess.run(
[sys.executable, "scripts/verify.py", "--emulator", "handy", "--verbose"],
cwd=ROOT, capture_output=True, text=True, check=True,
).stdout.splitlines()
for line in sample.splitlines():
with self.subTest(line=line):
self.assertIn(line, printed)
if __name__ == "__main__":
unittest.main()
+8 -5
View File
@@ -377,13 +377,16 @@ python scripts/verify.py --emulator handy
python scripts/verify.py --emulator handy --verbose
```
Default output shows aggregate results per file: the core name and which checks apply.
With `--verbose`, each file expands to one line per core with the exact validation
parameters and source code reference:
The first line counts the files the profile declares and names the checks they
carry. A file that is missing or fails a check gets a line of its own, followed by
the cores that check it. `--verbose` also lists the files that pass, each followed
by one line per core with the values it expects and the source reference the
profile cites:
```
lynxboot.img
handy validates size=512 crc32=0x0d973c9d [src/handy/system.h:45]
handy: 2/2 OK [crc32+existence+size]
OK (optional): lynxboot.img
handy validates crc32=0d973c9d,size=512 [lynx/rom.h:48-49 (ROM_SIZE=0x200, ROM_CRC32=0x0D973C9D), lynx/rom.cpp:76-129 (CRom constructor), libretro/libretro.cpp:1231-1258 (bios path + CSystem init)]
```
### Per-system checks