diff --git a/tests/test_port_harness.py b/tests/test_port_harness.py index 3d60ab68e..2aa8acfca 100644 --- a/tests/test_port_harness.py +++ b/tests/test_port_harness.py @@ -51,6 +51,20 @@ class ClassifyTests(unittest.TestCase): class AssetTests(unittest.TestCase): + def test_the_reports_link_goes_before_horizon_prepare(self): + with tempfile.TemporaryDirectory() as tmp: + root, store = Path(tmp) / "candidate", Path(tmp) / "store-reports" + (store / "minecraft").mkdir(parents=True) + reports = root / ".local" / "datagen" / "out" / "reports" + reports.parent.mkdir(parents=True) + reports.symlink_to(store) + harness.own_reports(root) + self.assertFalse(reports.exists() or reports.is_symlink()) + self.assertTrue((store / "minecraft").is_dir()) + reports.mkdir() # its own reports, from an earlier horizon-prepare, stay + harness.own_reports(root) + self.assertTrue(reports.is_dir()) + def test_sounds_and_panorama_only(self): self.assertTrue(harness.wanted_asset("minecraft/sounds.json")) self.assertTrue(harness.wanted_asset("minecraft/sounds/mob/cow/say1.ogg")) diff --git a/tools/port_harness.py b/tools/port_harness.py index f2c4f706f..9339e4d5c 100644 --- a/tools/port_harness.py +++ b/tools/port_harness.py @@ -56,8 +56,18 @@ def launcher_assets(tree, manifest, jobs=8): return len(hashes) +def own_reports(root): + """Replace the candidate's link to the store's data generator reports (regen reads them) by nothing: + horizon-prepare runs the data generator itself, and it must write into the candidate, not through the link + into the version store (the generator also deletes the link as stale).""" + reports = root / ".local" / "datagen" / "out" / "reports" + if reports.is_symlink(): + reports.unlink() + + def prepare_resources(root, version, store): """horizon-prepare against the candidate's version: {status: ok | failed, error, compile_errors}.""" + own_reports(root) log = root / ".local" / "port-regen" / "horizon-prepare.log" log.parent.mkdir(parents=True, exist_ok=True) env = dict(os.environ, CARGO_TARGET_DIR=str(root / ".local" / "port-target"))