Skip to content

Commit d6e5506

Browse files
committed
Repoint test fixtures to PSPReverse/Test-PSPTool
The previous submodule URL git@github.com:cwerling/PSPTool-fixtures.git returns 'Repository not found' (likely casualty of the LFS-quota recreations the commit log mentions). PSPReverse/Test-PSPTool is the active firmware corpus for the org (54+ ROMs spanning AM4 / X399 / X470 / Threadripper / Naples) and the natural home for the new EPYC fixtures. Submodule path stays at tests/integration/fixtures; layout changes from fixtures/roms/ to fixtures/test_files/ to match the corpus repo's flat layout. The TestZenGenerationBackfill class' filename keys are updated to the new Vendor_Model_BIOS.ext naming convention. Pinned at Test-PSPTool master HEAD bca9c0e for now; bump once the companion PR (Add EPYC test ROMs + split test_psptool.py) lands. Until then TestZenGenerationBackfill skips with the documented no-fixtures-present message; integration smoke tests run as before against the existing 54-file corpus.
1 parent ec0d48a commit d6e5506

3 files changed

Lines changed: 61 additions & 3 deletions

File tree

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "tests/integration/fixtures"]
22
path = tests/integration/fixtures
3-
url = git@github.com:cwerling/PSPTool-fixtures.git
3+
url = git@github.com:PSPReverse/Test-PSPTool.git

tests/integration/fixtures

tests/integration/test_rom_files.py

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from psptool.header_file import HeaderFile
99

1010
dirname = os.path.dirname(__file__)
11-
rom_fixtures_path = os.path.join(dirname, 'fixtures/roms')
11+
rom_fixtures_path = os.path.join(dirname, 'fixtures/test_files')
1212

1313
# todo: add extraction tests
1414
# - extract entry and make sure it has the correct size
@@ -94,6 +94,64 @@ def test_extract_advanced(self):
9494
self.assertEqual(stderr_buf.getvalue(), "")
9595

9696

97+
class TestZenGenerationBackfill(unittest.TestCase):
98+
# Maps fixture filename (relative to fixtures/roms) to the substring
99+
# that must appear in zen_generation for every directory in the ROM.
100+
# Single-generation EPYC images are the negative test set fixed by the
101+
# PSP_FW_BOOT_LOADER back-fill path. Each entry corresponds to a row
102+
# in issue.md's "Test ROMs — direct download URLs" section; SHA-256s
103+
# there can be used to verify the unwrapped ROM matches.
104+
EPYC_EXPECTATIONS = {
105+
'ASUS_KRPA-U16-ASUS-4501.CAP': 'Zen 2', # Rome (SP3)
106+
'ASUS_KRPA-U16-M-ASUS-1002.CAP': 'Zen 3', # Milan (SP3)
107+
'ASUS_K14PA-U12-ASUS-2305.CAP': 'Zen 4', # Genoa (SP5)
108+
'ASUS_S14NA-U12-ASUS-0903.CAP': 'Zen 4', # Siena (SP6); Zen 4c shares Zen 4 BL major
109+
'Tyan_S8050GM4NE-2T_V3.04.rom': 'Zen 5', # Turin (SP5)
110+
}
111+
112+
def _find_fixture(self, basename):
113+
for subdir, _dirs, files in os.walk(rom_fixtures_path):
114+
if basename in files:
115+
return os.path.join(subdir, basename)
116+
return None
117+
118+
def test_epyc_zen_generation_set(self):
119+
present = {n: p for n, p in
120+
((n, self._find_fixture(n)) for n in self.EPYC_EXPECTATIONS)
121+
if p is not None}
122+
if not present:
123+
self.skipTest(
124+
"No EPYC fixtures present under tests/integration/fixtures/roms; "
125+
"see issue.md for download URLs"
126+
)
127+
for name, path in present.items():
128+
expected = self.EPYC_EXPECTATIONS[name]
129+
with self.subTest(name):
130+
with io.StringIO() as stderr_buf, contextlib.redirect_stderr(stderr_buf):
131+
pt = psptool.PSPTool.from_file(path)
132+
self.assertTrue(len(pt.blob.roms) > 0, f"{name}: no ROMs parsed")
133+
# Find at least one ROM whose directories all match the
134+
# expected generation. Multi-ROM BIOSes (e.g. Tyan Turin
135+
# ships a Genoa+Turin pair) may carry one ROM at a different
136+
# generation, but the expected one must be present.
137+
matching_roms = [
138+
r for r in pt.blob.roms
139+
if r.directories and all(
140+
d.zen_generation is not None and expected in d.zen_generation
141+
for d in r.directories
142+
)
143+
]
144+
self.assertTrue(
145+
matching_roms,
146+
f"{name}: no ROM in the file has all directories tagged {expected!r}; "
147+
f"got "
148+
+ repr([
149+
[d.zen_generation for d in r.directories]
150+
for r in pt.blob.roms
151+
])
152+
)
153+
154+
97155
if __name__ == '__main__':
98156
print(f"\nTesting module {psptool.__version__}")
99157
unittest.main()

0 commit comments

Comments
 (0)