Preserve prior original mod builds when upgrading test instances
This commit is contained in:
@@ -22,6 +22,23 @@ Version 0.2.0 targets Minecraft 26.3 / Fabric 0.19.5 / Java 25. This is an initi
|
||||
|
||||
## Interpretation limits
|
||||
|
||||
The 0.3.0 adaptive profile rendered the actual demo world and applied live DH duty-cycle
|
||||
changes from 0.5 down to 0.05 under software-renderer frame pressure. Opening the pause
|
||||
menu released the override and reported an effective ratio of 0.5 again. A separate
|
||||
baseline instance starts without DH. API adapter tests cover suspension/resumption,
|
||||
changed user ceilings, and yielding to an existing or changed override from another mod.
|
||||
The real recorder wrote 193 frame intervals and 1,651 integrated-server tick samples,
|
||||
with matching CSV counts, sampled heap peaks and process CPU data. Dedicated-server
|
||||
0.3.0 dependencies initialize and exit with EULA false. No populated server result
|
||||
is inferred. The updated offline suite has 19 Python tests, including upgrade backups
|
||||
and refusing to replace an unrelated JAR with a matching filename.
|
||||
|
||||
A 60-second JFR recording identified foreground, server and DH worker activity. It
|
||||
also demonstrated why allocation sampling must be corroborated: large sample weights
|
||||
at timestamp boxing did not correspond to the largest per-thread allocation counter
|
||||
deltas. Profiles stay private under `.local/`; neither sample weights nor this
|
||||
software-renderer workload establish a real-hardware optimization result.
|
||||
|
||||
The local Linux host uses **Mesa llvmpipe software rendering**. It is useful for mod/mixin/startup/report validation, not for predicting M2 Pro, Windows GPU or Linux discrete-GPU performance. Warm-up/world loading on this host is slow. Demo credentials produce expected unavailable account-properties/Realms logs, and chat availability can be restricted; the independent F8 measurement shortcut avoids relying on chat.
|
||||
|
||||
CI compiles/builds on Linux, Windows and Apple Silicon macOS. Successful compilation is not graphics, authentication, UI or Mac-driver runtime validation. macOS 27 and the user's actual M2 Pro have not been tested here. Optional cinematic shaders and Vulkan are experiments; the OpenGL balanced pack is the first manual test.
|
||||
|
||||
@@ -10,6 +10,37 @@ from tools import build_pack, compare_benchmarks, runtime
|
||||
|
||||
|
||||
class PackTests(unittest.TestCase):
|
||||
def test_original_mod_upgrade_preserves_backup_and_other_mods(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
root = Path(temp)
|
||||
mods = root / "instance/mods"
|
||||
mods.mkdir(parents=True)
|
||||
old = mods / "horizon-lab-0.2.0.jar"
|
||||
with zipfile.ZipFile(old, "w") as archive:
|
||||
archive.writestr("fabric.mod.json", json.dumps({"id": "horizonlab"}))
|
||||
old_bytes = old.read_bytes()
|
||||
other = mods / "other.jar"
|
||||
other.write_bytes(b"another mod")
|
||||
new = root / "horizon-lab-0.3.0.jar"
|
||||
new.write_bytes(b"new original fixture")
|
||||
runtime.install_original_mod(new, mods)
|
||||
self.assertFalse(old.exists())
|
||||
self.assertEqual((mods / new.name).read_bytes(), new.read_bytes())
|
||||
self.assertEqual(other.read_bytes(), b"another mod")
|
||||
backups = list((mods.parent / ".horizon-mod-backups").glob("*.jar"))
|
||||
self.assertEqual(len(backups), 1)
|
||||
self.assertEqual(backups[0].read_bytes(), old_bytes)
|
||||
|
||||
def test_original_mod_upgrade_refuses_unrelated_named_jar(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
root = Path(temp)
|
||||
with zipfile.ZipFile(root / "horizon-lab-0.1.0.jar", "w") as archive:
|
||||
archive.writestr("fabric.mod.json", json.dumps({"id": "someoneelse"}))
|
||||
new = root / "horizon-lab-0.3.0.jar"
|
||||
new.write_bytes(b"new original fixture")
|
||||
with self.assertRaisesRegex(ValueError, "another mod"):
|
||||
runtime.install_original_mod(new, root)
|
||||
|
||||
def test_every_profile_has_correct_game_and_exact_dependency_closure(self):
|
||||
lock = build_pack.read_lock()
|
||||
for profile in build_pack.PROFILES.values():
|
||||
|
||||
@@ -128,7 +128,10 @@ def prepare_instance(profile_name, destination, mod_jar):
|
||||
target = destination / mod_path(entry)
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copyfile(source, target)
|
||||
runtime.install_original_mod(mod_jar, destination / "mods", f"horizon-lab-{lock['pack_version']}.jar")
|
||||
for name, data in overrides(profile_name, mod_jar.read_bytes()).items():
|
||||
if name.startswith("mods/"):
|
||||
continue
|
||||
target = destination / name
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
target.write_bytes(data)
|
||||
|
||||
@@ -8,6 +8,7 @@ import os
|
||||
from pathlib import Path
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
@@ -20,6 +21,24 @@ except ImportError:
|
||||
import lab
|
||||
|
||||
ROOT = lab.ROOT
|
||||
|
||||
|
||||
def install_original_mod(source, mod_dir, filename=None):
|
||||
"""Replace our own previous versions, retaining backups outside Fabric's mod scan."""
|
||||
mod_dir.mkdir(parents=True, exist_ok=True)
|
||||
filename = filename or source.name
|
||||
for old in mod_dir.glob("horizon-lab-*.jar"):
|
||||
if old.name == filename:
|
||||
continue
|
||||
with zipfile.ZipFile(old) as archive:
|
||||
if json.loads(archive.read("fabric.mod.json"))["id"] != "horizonlab":
|
||||
raise ValueError(f"Refusing to replace another mod: {old}")
|
||||
backup = mod_dir.parent / ".horizon-mod-backups"
|
||||
backup.mkdir(exist_ok=True)
|
||||
destination = backup / f"{old.stem}-{lab.digest(old, 'sha256')[:12]}.jar"
|
||||
shutil.move(str(old), str(destination))
|
||||
if source.resolve() != (mod_dir / filename).resolve():
|
||||
shutil.copyfile(source, mod_dir / filename)
|
||||
CACHE = ROOT / ".local" / "runtime"
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ def prepare(instance, baseline=False):
|
||||
original = ROOT / "dist" / f"horizon-lab-{pack_lock['pack_version']}.jar"
|
||||
if not original.exists():
|
||||
raise FileNotFoundError("Build the original mod first with tools/build_mod.py, or use the server starter ZIP")
|
||||
shutil.copyfile(original, mod_dir / original.name)
|
||||
runtime.install_original_mod(original, mod_dir)
|
||||
return libraries
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user