should not work
- Shell 83.3%
- Python 16.7%
Standalone copy of the auto-test.sh + bin2png.py harness so other Minecraft mod projects can reuse it without taking on Voxy or Vulkan dependencies. 100% original work — no Voxy code, no MCRcortex copyright. Released MIT. Adapted-for-other-mods notes in README. |
||
|---|---|---|
| scripts | ||
| LICENSE | ||
| README.md | ||
mc-test-harness
Generic, headless test harness for Fabric Minecraft mods. Carved out of the voxy-vulkan-mac project so other mod work can reuse it without dragging in Voxy or Vulkan dependencies.
What it does
scripts/auto-test.sh— boots a Fabric MC instance via./gradlew runClientwith offline auth +--quickPlaySingleplayerpointed at a deterministic test world, lets it run for N seconds, and reports diagnostic log lines + screenshots back to the caller.EXIT/INT/TERMtrap guarantees the MC process always dies, even on crash /set -ebail /^C. No more zombie MC instances eating your CPU.- Polls the MC log for early-fail markers and bails immediately on init/composite errors instead of waiting for the timeout.
devworld.templatemechanism: keep a clean snapshot world, restore from it before each run for deterministic state.- Screenshot mode: writes raw RGBA bins via the mod's GameRenderer TAIL hook, then converts to PNG.
- Panorama mode: rotates the player yaw 0/90/180/270 over four spaced frames, captures each.
scripts/bin2png.py— converts the harness'sVOXSHOT-headered raw RGBA dumps into PNGs (bottom-up flip, no external deps).
Requirements
- macOS or Linux
- bash 4+
- python 3.6+
- The mod under test must:
- Use Fabric Loom + offer a
runClientGradle task - Implement an end-of-frame screenshot capture (the harness expects
bins at
run/logs/voxy-vk-shot*.bin— adapt the path for your mod) - Print a diagnostic log line per Nth frame so the harness can confirm the mod is rendering
- Use Fabric Loom + offer a
Adapt for your mod
The script as-shipped is hardcoded for the voxy-vulkan-mac project. To adapt:
- Change the
PROJECTpath at the top ofauto-test.sh - Update
EXTRA_PROPSto match your mod's-Pflag conventions - Update the
EXPECTED_SHOTSarray if your screenshot filenames differ - Update the early-fail regex if your mod logs different markers
A future v2 should make these all CLI flags or an auto-test.config
file. PRs welcome.
License
MIT — see LICENSE.