Check that the built hactool starts with an empty home folder, so a malformed key in the builder's own keys file no longer fails the build.

This commit is contained in:
Wellington Dias committed 2026-10-30 21:32:12 -03:00
1 parent ff72b2e241
commit efe1b5db54
1 file changed
+6 -1
+6 -1
View File
@@ -14,6 +14,7 @@ import os
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
@@ -79,7 +80,11 @@ def main():
out.mkdir(parents=True, exist_ok=True)
shutil.copy2(src / EXE, out / EXE)
shutil.copy2(src / 'LICENSE', out / 'LICENSE')
banner = subprocess.run([str(out / EXE)], capture_output=True, text=True)
# hactool reads ~/.switch/prod.keys before it prints the banner and exits on a malformed key there, so the check
# runs with an empty home: it tests the binary, not the builder's keys.
with tempfile.TemporaryDirectory() as home:
env = dict(os.environ, HOME=home, USERPROFILE=home)
banner = subprocess.run([str(out / EXE)], capture_output=True, text=True, env=env)
if 'hactool (c) SciresM' not in banner.stdout + banner.stderr:
sys.exit(f'{out / EXE} does not start')
print(f'{out / EXE}: {COMMIT[:7]} + {", ".join(p.name for p in PATCHES)}')