Public Access
59 lines
2.5 KiB
Python
59 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Focused Flooded checks in one disposable 26.3 server; fixtures never ship."""
|
|
import subprocess
|
|
import tempfile
|
|
from pathlib import Path
|
|
from server_test_lock import server_test_lock
|
|
from smoke_server import stop
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def run():
|
|
logs = ROOT / "build/verification/flood107"
|
|
logs.mkdir(parents=True, exist_ok=True)
|
|
log = logs / "mc263.log"
|
|
with server_test_lock(), tempfile.TemporaryDirectory(prefix="rivencraft-flood263-") as directory:
|
|
work = Path(directory)
|
|
init = work / "fixture.gradle"
|
|
init.write_text("""
|
|
gradle.beforeProject { p ->
|
|
p.layout.buildDirectory.set(p.file('""" + str(work / "build") + """'))
|
|
p.afterEvaluate {
|
|
p.sourceSets.main.java.srcDir(p.file('""" + str(ROOT / "scripts/fixtures/flood263") + """'))
|
|
}
|
|
}
|
|
""")
|
|
server = work / "server"
|
|
server.mkdir()
|
|
(server / "eula.txt").write_text("eula=true\n")
|
|
(server / "server.properties").write_text(
|
|
"server-ip=127.0.0.1\nserver-port=0\nonline-mode=false\nwhite-list=false\n"
|
|
"level-type=minecraft:flat\nlevel-seed=107\nview-distance=2\nsimulation-distance=2\n"
|
|
'generator-settings={"layers":[{"height":1,"block":"minecraft:bedrock"}],"biome":"minecraft:plains"}\n')
|
|
process = None
|
|
try:
|
|
with log.open("w") as output:
|
|
process = subprocess.Popen([str(ROOT / "gradlew"), "-p", str(ROOT / "ports/mc263"),
|
|
"--no-daemon", "-I", str(init), "runServer", f"-PserverRunDir={server}", "--console=plain"],
|
|
cwd=ROOT, stdin=subprocess.PIPE, stdout=output, stderr=subprocess.STDOUT,
|
|
text=True, start_new_session=True)
|
|
try:
|
|
process.wait(timeout=60)
|
|
except subprocess.TimeoutExpired:
|
|
print("HANDOFF: Flooded probe stalled; stopping without retry. Use docs/FLOODED_PAGES.md.")
|
|
return 2
|
|
text = log.read_text()
|
|
if process.returncode or "FLOODED263_PASS" not in text or "FLOODED263_FAIL" in text:
|
|
print(text[-10000:])
|
|
return 1
|
|
print(next(line for line in text.splitlines() if "FLOODED263_PASS" in line))
|
|
return 0
|
|
finally:
|
|
stop(process)
|
|
print("Removing temporary server world, fixture configuration and isolated outputs. Log:", log)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(run())
|