fix: name a missing --from-md5-file

This commit is contained in:
Abdessamad Derraz committed 2026-11-06 03:27:29 +01:00
1 parent 7d33bd6e8e
commit f96e7c10f4
2 files changed
+26

No files matched your search

+3
View File
@@ -3573,6 +3573,9 @@ def _main(held: contextlib.ExitStack) -> None:
except ValueError as exc:
print(f"ERROR: {exc}", file=sys.stderr)
sys.exit(1)
except OSError as exc:
print(f"ERROR: --from-md5-file {args.from_md5_file}: {exc.strerror}", file=sys.stderr)
sys.exit(1)
if not hashes:
print(
f"ERROR: no hash in the input. Accepted: {ACCEPTED_HASHES}",
+23
View File
@@ -375,6 +375,29 @@ class AMissingPlatformsDirIsRefused(unittest.TestCase):
self.assertRegex(proc.stderr, r"ERROR: .*nosuch")
class AMissingInputFileIsNamed(unittest.TestCase):
"""The documented `--from-md5-file missing.txt` ended on a
FileNotFoundError at the bottom of a stack trace."""
def _refused(self, argv: list[str], message: str) -> None:
proc = subprocess.run(
[sys.executable, *argv], capture_output=True, text=True,
cwd=str(REPO_ROOT), timeout=600, check=False,
env={**os.environ, "RETROBIOS_OFFLINE": "1"},
)
self.assertNotEqual(proc.returncode, 0, proc.stdout[-500:])
self.assertNotIn("Traceback", proc.stderr, proc.stderr[-1500:])
self.assertIn(message, proc.stderr)
def test_a_missing_hash_list_is_named(self):
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as tmp:
self._refused(
["scripts/generate_pack.py", "--platform", "batocera", "--from-md5-file",
"nosuch.txt", "--offline", "--output-dir", tmp],
"ERROR: --from-md5-file nosuch.txt: No such file or directory",
)
class StrictVerifyFailsOnACriticalMiss(unittest.TestCase):
"""verify exited 0 with a required file missing on an md5 platform, so
the pipeline printed "verify OK" over a pack the frontend rejects."""