fix: clone MAME and FBNeo sources per process

This commit is contained in:
Abdessamad Derraz committed 2026-10-18 19:53:02 +02:00
1 parent 4130abb7bc
commit 3584acada0
3 files changed
+20 -2

No files matched your search

+2 -1
View File
@@ -29,7 +29,8 @@ log = logging.getLogger(__name__)
REPO_URL = "https://github.com/finalburnneo/FBNeo.git"
REPO_ROOT = Path(__file__).resolve().parent.parent.parent
CLONE_DIR = REPO_ROOT / "tmp" / "fbneo"
# One clone per process, for the reason mame_hash_scraper gives.
CLONE_DIR = REPO_ROOT / "tmp" / f"fbneo-{os.getpid()}"
CACHE_PATH = REPO_ROOT / "data" / "fbneo-hashes.json"
EMULATORS_DIR = REPO_ROOT / "emulators"
STALE_HOURS = 24
+3 -1
View File
@@ -31,7 +31,9 @@ log = logging.getLogger(__name__)
_ROOT = Path(__file__).resolve().parents[2]
_CACHE_PATH = _ROOT / "data" / "mame-hashes.json"
_CLONE_DIR = _ROOT / "tmp" / "mame"
# One clone per process: a fixed tmp/mame was removed and recloned at another
# release by a second run while the first was still parsing it.
_CLONE_DIR = _ROOT / "tmp" / f"mame-{os.getpid()}"
_EMULATORS_DIR = _ROOT / "emulators"
_REPO_URL = "https://github.com/mamedev/mame.git"
_STALE_HOURS = 24
+15
View File
@@ -759,5 +759,20 @@ class WritersPutTheValuesOnDisk(unittest.TestCase):
self.assertEqual(member["crc32"], "9036d879")
class OneCloneDirectoryPerRun(unittest.TestCase):
"""Two runs shared tmp/mame: the second removed and recloned it at
another release while the first parsed it, and the first wrote 0.289
sets into a 0.278 profile."""
def test_the_clone_directory_names_the_process(self):
import os
from scripts.scraper import fbneo_hash_scraper, mame_hash_scraper
for clone in (mame_hash_scraper._CLONE_DIR, fbneo_hash_scraper.CLONE_DIR):
with self.subTest(clone=clone.name):
self.assertTrue(clone.name.endswith(f"-{os.getpid()}"))
if __name__ == "__main__":
unittest.main()