mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-01 00:27:20 -05:00
fix: link tested files, read the negative check
This commit is contained in:
1 parent
14b7fd1c98
commit
ca7bac6293
4 files changed
+54
-5
No files matched your search
@@ -9335,6 +9335,19 @@ def _summary_table(files: list[dict], indexes: list[int], cell: Callable[[int, s
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _tested_file_hrefs(name: str, files: list[dict]) -> dict[str, str]:
|
||||||
|
"""The card each file name a test varies leads to: its name, aliases
|
||||||
|
and path, folded to lower case, the first card of a name winning."""
|
||||||
|
hrefs: dict[str, str] = {}
|
||||||
|
for f, anchor in zip(files, emulator_file_anchors(files)):
|
||||||
|
page = emulator_card_page(name, anchor)
|
||||||
|
href = f"#{anchor}" if page == name else markup.site_href(f"emulators/{page}/") + f"#{anchor}"
|
||||||
|
for label in (f.get("name"), *(f.get("aliases") or ()), f.get("path")):
|
||||||
|
if label:
|
||||||
|
hrefs.setdefault(Path(str(label)).name.casefold(), href)
|
||||||
|
return hrefs
|
||||||
|
|
||||||
|
|
||||||
def plan_emulator_pages(profiles: dict) -> None:
|
def plan_emulator_pages(profiles: dict) -> None:
|
||||||
"""Record which page holds each emulator card, before any page links one."""
|
"""Record which page holds each emulator card, before any page links one."""
|
||||||
stems = set()
|
stems = set()
|
||||||
@@ -9726,7 +9739,8 @@ def emulator_pages(
|
|||||||
[files[i] for i in entries],
|
[files[i] for i in entries],
|
||||||
[rows[i] for i in entries] if table_form else None)
|
[rows[i] for i in entries] if table_form else None)
|
||||||
|
|
||||||
lines.extend(sitemeasurements.tested_section(name, _MEASUREMENT_ITEMS.get(name, [])))
|
lines.extend(sitemeasurements.tested_section(
|
||||||
|
name, _MEASUREMENT_ITEMS.get(name, []), _tested_file_hrefs(name, files)))
|
||||||
|
|
||||||
blocks = _render_structured_blocks(profile)
|
blocks = _render_structured_blocks(profile)
|
||||||
if blocks:
|
if blocks:
|
||||||
|
|||||||
@@ -967,6 +967,11 @@ def _dots(item: dict) -> str:
|
|||||||
|
|
||||||
def _chip(item: dict) -> str:
|
def _chip(item: dict) -> str:
|
||||||
words, kind = RESULT_WORDS.get(item["status"], (item["status"], "muted"))
|
words, kind = RESULT_WORDS.get(item["status"], (item["status"], "muted"))
|
||||||
|
# A wrong-files test claims the core refuses zeros, half the file and
|
||||||
|
# other regions' dumps: when every one boots the claim fails, and
|
||||||
|
# "works" in green read as a pass.
|
||||||
|
if item["status"] == "boots" and str(item.get("subject") or "").startswith("negative-"):
|
||||||
|
words, kind = "accepts wrong files", "info"
|
||||||
return f'<span class="rb-badge rb-badge-{kind}">{_cell(words)}</span>'
|
return f'<span class="rb-badge rb-badge-{kind}">{_cell(words)}</span>'
|
||||||
|
|
||||||
|
|
||||||
@@ -1051,18 +1056,23 @@ def summary_line(items: list[dict], page_host: str) -> str:
|
|||||||
run and its computer."""
|
run and its computer."""
|
||||||
counts = tested_counts(items)
|
counts = tested_counts(items)
|
||||||
parts = [f"{counts['tests']} test{'s' if counts['tests'] != 1 else ''}"]
|
parts = [f"{counts['tests']} test{'s' if counts['tests'] != 1 else ''}"]
|
||||||
parts += [f"{counts[key]} {key}" for key in ("confirmed", "open") if counts[key]]
|
if counts["confirmed"]:
|
||||||
|
parts.append(f"{counts['confirmed']} confirmed in the profile")
|
||||||
|
if counts["open"]:
|
||||||
|
parts.append(f"{counts['open']} open finding{'s' if counts['open'] != 1 else ''}")
|
||||||
parts.append(f"last run {counts['last']} on {page_host}")
|
parts.append(f"last run {counts['last']} on {page_host}")
|
||||||
return " · ".join(parts) + "."
|
return " · ".join(parts) + "."
|
||||||
|
|
||||||
|
|
||||||
def tested_section(name: str, items: list[dict]) -> list[str]:
|
def tested_section(name: str, items: list[dict],
|
||||||
|
file_hrefs: dict[str, str] | None = None) -> list[str]:
|
||||||
"""The Tested block of an emulator page, empty when nothing was recorded.
|
"""The Tested block of an emulator page, empty when nothing was recorded.
|
||||||
|
|
||||||
The answer first: one summary line, then the tests under the file each
|
The answer first: one summary line, then the tests under the file each
|
||||||
one varies, a row per test with its result chip, a dot per variant and
|
one varies, a row per test with its result chip, a dot per variant and
|
||||||
its date. What proves it (method, claim, computer, core build, record)
|
its date. What proves it (method, claim, computer, core build, record)
|
||||||
waits in each row's details. Tests recorded before the boot oracle fold
|
waits in each row's details. ``file_hrefs`` links a file, by its name
|
||||||
|
folded to lower case, to its card on the page. Tests recorded before the boot oracle fold
|
||||||
under one line, and benchmarks get their own table at the end.
|
under one line, and benchmarks get their own table at the end.
|
||||||
"""
|
"""
|
||||||
if not items:
|
if not items:
|
||||||
@@ -1090,6 +1100,9 @@ def tested_section(name: str, items: list[dict]) -> list[str]:
|
|||||||
"<span>Result</span><span>Variants</span><span>Date</span></div>")
|
"<span>Result</span><span>Variants</span><span>Date</span></div>")
|
||||||
for file, group in by_file(current):
|
for file, group in by_file(current):
|
||||||
label = f"<code>{_cell(file)}</code>" if file else "No file varied"
|
label = f"<code>{_cell(file)}</code>" if file else "No file varied"
|
||||||
|
href = (file_hrefs or {}).get(file.casefold()) if file else None
|
||||||
|
if href:
|
||||||
|
label = f'<a href="{_attr(href)}">{label}</a>'
|
||||||
lines.append(f'<p class="rb-tested-file">{label}</p>')
|
lines.append(f'<p class="rb-tested-file">{label}</p>')
|
||||||
for item in group:
|
for item in group:
|
||||||
lines += _row(item, titles[item["id"]], page_host, main_core)
|
lines += _row(item, titles[item["id"]], page_host, main_core)
|
||||||
|
|||||||
@@ -451,9 +451,21 @@ class SitePages(unittest.TestCase):
|
|||||||
self.assertEqual(sm.tested_counts(items), {"tests": 3, "confirmed": 1, "open": 2, "benchmarks": 1,
|
self.assertEqual(sm.tested_counts(items), {"tests": 3, "confirmed": 1, "open": 2, "benchmarks": 1,
|
||||||
"last": "2026-10-28"})
|
"last": "2026-10-28"})
|
||||||
text = "\n".join(sm.tested_section("beetle_saturn", items))
|
text = "\n".join(sm.tested_section("beetle_saturn", items))
|
||||||
self.assertIn("3 tests · 1 confirmed · 2 open · last run 2026-10-28 on Test CPU, Linux.", text)
|
self.assertIn("3 tests · 1 confirmed in the profile · 2 open findings · last run 2026-10-28 "
|
||||||
|
"on Test CPU, Linux.", text)
|
||||||
self.assertIn("<td>1.500</td><td>660.0</td>", text)
|
self.assertIn("<td>1.500</td><td>660.0</td>", text)
|
||||||
|
|
||||||
|
def test_wrong_files_that_all_boot_fail_the_claim(self) -> None:
|
||||||
|
negative = self.item(subject="negative-scph5501-bin-x", status="boots")
|
||||||
|
self.assertIn(">accepts wrong files</span>", sm._chip(negative))
|
||||||
|
self.assertIn('rb-badge-info', sm._chip(negative))
|
||||||
|
self.assertIn(">works</span>", sm._chip(self.item(subject="alone-scph5501-bin-x", status="boots")))
|
||||||
|
|
||||||
|
def test_the_file_label_links_its_card(self) -> None:
|
||||||
|
text = "\n".join(sm.tested_section("beetle_saturn", [self.ITEM],
|
||||||
|
{"mpeg_card.bin": "#file-mpeg-card-bin"}))
|
||||||
|
self.assertIn('<a href="#file-mpeg-card-bin"><code>mpeg_card.bin</code></a>', text)
|
||||||
|
|
||||||
def test_short_titles(self) -> None:
|
def test_short_titles(self) -> None:
|
||||||
cases = [
|
cases = [
|
||||||
({"subject": "mpeg-card-lunar-cr2-build", "variable": "mpeg_card.bin",
|
({"subject": "mpeg-card-lunar-cr2-build", "variable": "mpeg_card.bin",
|
||||||
|
|||||||
@@ -192,5 +192,15 @@ class AnElementBudget(unittest.TestCase):
|
|||||||
self.assertLess(page.elements, validate_site.MAX_PAGE_ELEMENTS)
|
self.assertLess(page.elements, validate_site.MAX_PAGE_ELEMENTS)
|
||||||
|
|
||||||
|
|
||||||
|
class TestedFilesLeadToTheirCard(unittest.TestCase):
|
||||||
|
def test_a_name_or_alias_finds_the_card(self):
|
||||||
|
files = [{"name": "scph5501.bin", "aliases": ["SCPH-5501.BIN"]}, {"name": "other.bin"}]
|
||||||
|
hrefs = gs._tested_file_hrefs("x", files)
|
||||||
|
self.assertEqual(hrefs["scph5501.bin"], "#file-scph5501-bin")
|
||||||
|
self.assertEqual(hrefs["scph-5501.bin"], "#file-scph5501-bin")
|
||||||
|
self.assertEqual(hrefs["other.bin"], "#file-other-bin")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
Reference in new issue
Block a user