Merge remote-tracking branch 'upstream/main' into fix/piston-entity-push
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
# the shared vanilla data) that nothing touched for STALE_DAYS go; a harness that runs again rebuilds its own.
|
||||
# .local/parity-runner (run state, oracle cache) stays.
|
||||
# - The shared prepared resources keep their KEEP_PREPARED newest preparations, only while no runner works.
|
||||
# - Java processes harnesses left behind (vanilla servers, oracles) go once ORPHAN_HOURS old: those whose parent
|
||||
# is gone (adopted by launchd, init or systemd --user) and whose command line names a runner's checkout or a
|
||||
# worktree's .local/. A job cancelled while it ran left such servers for days (2026-10-26); tools/parity.py now
|
||||
# stops its harnesses on SIGTERM, and this catches what it can't (SIGKILL, a harness run by hand).
|
||||
set -euo pipefail
|
||||
root=${RUNNERS:-$HOME/.actions-runners}
|
||||
max_kb=$(( ${MAX_TARGET_GB:-12} * 1024 * 1024 ))
|
||||
@@ -42,6 +46,25 @@ for runner in "$root"/horizon "$root"/horizon-[0-9]*; do
|
||||
fi
|
||||
done
|
||||
|
||||
# [[dd-]hh:]mm:ss, as ps prints a process's age, in minutes.
|
||||
minutes() {
|
||||
local t=$1 d=0 h=0 m a b c
|
||||
if [[ $t == *-* ]]; then d=${t%%-*}; t=${t#*-}; fi
|
||||
IFS=: read -r a b c <<< "$t"
|
||||
if [ -n "$c" ]; then h=$a m=$b; else m=$a; fi
|
||||
echo $(( 10#$d * 1440 + 10#$h * 60 + 10#$m ))
|
||||
}
|
||||
orphan_min=$(( ${ORPHAN_HOURS:-3} * 60 ))
|
||||
ps -A -o pid=,ppid=,etime=,command= | while read -r pid ppid etime command; do
|
||||
case "$command" in *java*) ;; *) continue ;; esac
|
||||
case "$command" in *"$root"/*/_work/*|*/.claude/worktrees/*/.local/*|*/code/horizon/.local/*) ;; *) continue ;; esac
|
||||
[ "$(minutes "$etime")" -ge "$orphan_min" ] || continue
|
||||
if [ "$ppid" != 1 ]; then
|
||||
case "$(ps -o command= -p "$ppid" 2>/dev/null)" in *"systemd --user"*) ;; *) continue ;; esac
|
||||
fi
|
||||
if kill "$pid" 2>/dev/null; then echo "orphaned java $pid ($etime old) stopped: ${command:0:160}"; fi
|
||||
done
|
||||
|
||||
prepared="$root/horizon/_work/horizon/shared-local/prepared"
|
||||
if [ "$any_busy" = 0 ] && [ -d "$prepared" ] && mkdir "$prepared/.lock" 2>/dev/null; then
|
||||
trap 'rmdir "$prepared/.lock" 2>/dev/null || true' EXIT
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate crates/horizon-client/src/command/vanilla_order.rs: the order of
|
||||
"""Generate crates/horizon-command/src/vanilla_order.rs: the order of
|
||||
the children of each node of vanilla's command tree where Horizon's tree
|
||||
registers them in a different order. Brigadier keeps children in
|
||||
registration order, and /help (smart usage) lists them that way.
|
||||
@@ -19,7 +19,7 @@ def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
parser.add_argument("vanilla", type=Path)
|
||||
parser.add_argument("rust", type=Path)
|
||||
parser.add_argument("--out", type=Path, default=ROOT / "crates/horizon-client/src/command/vanilla_order.rs")
|
||||
parser.add_argument("--out", type=Path, default=ROOT / "crates/horizon-command/src/vanilla_order.rs")
|
||||
args = parser.parse_args()
|
||||
vanilla = json.loads(args.vanilla.read_text())
|
||||
rust = json.loads(args.rust.read_text())
|
||||
|
||||
+101
-12
@@ -341,8 +341,9 @@ class Game:
|
||||
def wait(self, ticks):
|
||||
self.d('wait', ticks=ticks)
|
||||
|
||||
def script(self, lines):
|
||||
"""Keep tick-sensitive input in one ctl process, through the normal control commands."""
|
||||
def script(self, lines, every=False):
|
||||
"""Keep tick-sensitive input in one ctl process, through the normal control commands. Returns the last
|
||||
reply, or with every=True all of them in order."""
|
||||
result = subprocess.run(self.d.base + ['script'], input='\n'.join(lines) + '\n',
|
||||
cwd=self.work, env=self.d.env, capture_output=True, text=True,
|
||||
timeout=600)
|
||||
@@ -350,7 +351,7 @@ class Game:
|
||||
ticks = [r['ticks'] for r in replies if 'ticks' in r]
|
||||
print(f'[{self.name}] script {lines} -> {replies[-1] if replies else result.stderr[:400]}; ticks={ticks}')
|
||||
assert result.returncode == 0 and replies and not any('error' in r for r in replies), result.stdout
|
||||
return replies[-1]
|
||||
return replies if every else replies[-1]
|
||||
|
||||
def until(self, observe, predicate, ticks=100):
|
||||
"""Wait for an observable answer, within the existing tick budget."""
|
||||
@@ -3132,13 +3133,15 @@ def check_fireworks(host, guest, out):
|
||||
game('command', command=f'tp @s {x + dx + 0.5} {y} {z + 0.5}')
|
||||
game.raw('look-at', x + 0.5, y + 1.5, z + 3.5)
|
||||
|
||||
def red(path):
|
||||
def reds(path):
|
||||
"""The red pixels' positions, above the hotbar."""
|
||||
rows, bpp = png_rows(path)
|
||||
# Exclude the hotbar and chat at the bottom of the view.
|
||||
return sum(row[i] > 80 and row[i] > 2 * row[i + 1] and row[i] > 2 * row[i + 2]
|
||||
for row in rows[:len(rows) * 3 // 4] for i in range(0, len(row), bpp))
|
||||
return {(y, i) for y, row in enumerate(rows[:len(rows) * 3 // 4]) for i in range(0, len(row), bpp)
|
||||
if row[i] > 80 and row[i] > 2 * row[i + 1] and row[i] > 2 * row[i + 2]}
|
||||
|
||||
baseline = {g.name: red(g.shot(out, 'fireworks-before')) for g in (host, guest)}
|
||||
# Red where the view had none: the setup's own red chat lines (a fill that changed nothing) are in the
|
||||
# baseline, and fade out before the later shots, which a plain count difference would take as missing sparks.
|
||||
baseline = {g.name: reds(g.shot(out, 'fireworks-before')) for g in (host, guest)}
|
||||
before = {g.name: made(g, 'flash') for g in (host, guest)}
|
||||
host('command', command='item replace entity @s weapon.mainhand with minecraft:firework_rocket'
|
||||
'[fireworks={flight_duration:0,explosions:[{shape:"large_ball",colors:[I;16711680],has_trail:true}]}]')
|
||||
@@ -3151,12 +3154,14 @@ def check_fireworks(host, guest, out):
|
||||
break
|
||||
flashes = {g.name: made(g, 'flash') - before[g.name] for g in (host, guest)}
|
||||
assert all(n == 1 for n in flashes.values()), f'configured burst missing or duplicated: {flashes}'
|
||||
# Capture both views before decoding PNGs: decoding must not consume the sparks' lifetime.
|
||||
# Capture both views before decoding PNGs: decoding must not consume the sparks' lifetime (48-59 ticks). A
|
||||
# screenshot takes ~0.6 s where the frame is drawn on the CPU (lavapipe), so the later shots come 4 ticks after
|
||||
# the burst's, not more: by then the tracked rocket is gone.
|
||||
burst_shots = {g.name: g.shot(out, 'fireworks-burst') for g in (host, guest)}
|
||||
host.wait(16)
|
||||
host.wait(4)
|
||||
trail_shots = {g.name: g.shot(out, 'fireworks-trail-fade') for g in (host, guest)}
|
||||
burst = {name: red(path) - baseline[name] for name, path in burst_shots.items()}
|
||||
trails = {name: red(path) - baseline[name] for name, path in trail_shots.items()}
|
||||
burst = {name: len(reds(path) - baseline[name]) for name, path in burst_shots.items()}
|
||||
trails = {name: len(reds(path) - baseline[name]) for name, path in trail_shots.items()}
|
||||
rockets = {g.name: g('status')['rockets'] for g in (host, guest)}
|
||||
assert not any(rockets.values()), f'exploded rocket remains: {rockets}'
|
||||
assert all(n > 20 for n in burst.values()), f'no red burst: {burst}'
|
||||
@@ -7311,6 +7316,90 @@ CHECKS += ['guardian-beams']
|
||||
CHECK_FNS['guardian-beams'] = check_guardian_beams
|
||||
|
||||
|
||||
def check_fangs(host, guest, out):
|
||||
"""EvokerFangs: authoritative spawn, event 4, client animation and server removal (#1482)."""
|
||||
x, y, z = (int(v // 1) for v in pos_of(host))
|
||||
tag = 'lan_evoker_fangs'
|
||||
selector = f'@e[type=minecraft:evoker,tag={tag},limit=1]'
|
||||
paths = {g.name: {} for g in (host, guest)}
|
||||
warmup = dict.fromkeys(paths, False)
|
||||
drawn = dict.fromkeys(paths, False)
|
||||
stopped = False
|
||||
photographed = False
|
||||
|
||||
def fangs(status):
|
||||
return [p for p in status['projectiles'] if p['kind'] == 'minecraft:evoker_fangs']
|
||||
|
||||
try:
|
||||
host('command', command='difficulty normal')
|
||||
host('command', command='gamemode creative')
|
||||
guest('command', command='gamemode survival')
|
||||
guest('command', command='effect give @s minecraft:resistance 120 4 true')
|
||||
host('command', command=f'fill {x - 10} {y - 1} {z - 10} {x + 10} {y - 1} {z + 18} minecraft:stone')
|
||||
host('command', command=f'fill {x - 10} {y} {z - 10} {x + 10} {y + 8} {z + 18} minecraft:air')
|
||||
host('command', command=f'tp @s {x + 4.5} {y} {z - 2.5}')
|
||||
guest('command', command=f'tp @s {x + 0.5} {y} {z + 0.5}')
|
||||
guest.wait(10)
|
||||
host('command', command=f'summon minecraft:evoker {x + 0.5} {y} {z + 9.5} '
|
||||
f'{{PersistenceRequired:1b,Tags:["{tag}"]}}')
|
||||
for game in (host, guest):
|
||||
game.raw('look-at', x + 0.5, y + 0.5, z + 5.5)
|
||||
for _ in range(200):
|
||||
guest.wait(2)
|
||||
statuses = {g.name: g('status') for g in (host, guest)}
|
||||
for name, status in statuses.items():
|
||||
live = fangs(status)
|
||||
ids = [f['id'] for f in live]
|
||||
assert all(ids) and len(ids) == len(set(ids)), f'{name}: invalid fang ids {ids}'
|
||||
warmup[name] |= any(not f['started'] for f in live)
|
||||
drawn[name] |= status['fangs_vertices'] > 0
|
||||
for f in live:
|
||||
paths[name].setdefault(f['id'], []).append(f)
|
||||
if paths['host'] and not stopped:
|
||||
host('command', command=f'data merge entity {selector} {{NoAI:1b}}')
|
||||
stopped = True
|
||||
if (all(drawn.values()) and not photographed
|
||||
and any(f['started'] and 8 <= f['life'] <= 16
|
||||
for f in fangs(statuses['guest']))):
|
||||
host('command', command='tick freeze')
|
||||
try:
|
||||
for game in (host, guest):
|
||||
game.raw('key', 'f1', 'tap')
|
||||
try:
|
||||
game.shot(out, 'evoker-fangs')
|
||||
finally:
|
||||
game.raw('key', 'f1', 'tap')
|
||||
finally:
|
||||
host('command', command='tick unfreeze')
|
||||
photographed = True
|
||||
if stopped and not any(fangs(s) for s in statuses.values()):
|
||||
break
|
||||
lab.write_json(out / 'evoker-fangs.json', {'paths': paths, 'warmup': warmup, 'drawn': drawn})
|
||||
assert all(warmup.values()), f'fang warmup not received: {warmup}'
|
||||
assert all(drawn.values()), f'fang renderer produced no geometry: {drawn}'
|
||||
assert paths['host'].keys() == paths['guest'].keys(), 'clients received different fang ids'
|
||||
for id, samples in paths['host'].items():
|
||||
other = paths['guest'][id]
|
||||
assert all(f['position'] == samples[0]['position'] for f in samples + other), \
|
||||
f'fang {id} is not at its authoritative position'
|
||||
for name, frames in (('host', samples), ('guest', other)):
|
||||
life = {f['life'] for f in frames if f['started']}
|
||||
assert len(life) > 1, f'{name}: fang {id} did not animate: {frames}'
|
||||
assert not any(fangs(g('status')) for g in (host, guest)), 'fangs survived server removal'
|
||||
finally:
|
||||
host('command', command='tick unfreeze')
|
||||
host('command', command=f'kill @e[tag={tag}]')
|
||||
# The evoker can summon vexes before fangs; killing it leaves those summons alive.
|
||||
host('command', command=f'kill @e[type=minecraft:vex,x={x},y={y},z={z},distance=..32]')
|
||||
guest('command', command='effect clear @s')
|
||||
face_each_other(host, guest)
|
||||
return {'fangs': len(paths['host']), 'warmup': warmup, 'drawn': drawn, 'removed': True}
|
||||
|
||||
|
||||
CHECKS += ['fangs']
|
||||
CHECK_FNS.update(fangs=check_fangs)
|
||||
|
||||
|
||||
def check_sonic(host, guest, out):
|
||||
"""A real warden's ray reaches connected clients once, with normal damage.
|
||||
|
||||
|
||||
+126
-9
@@ -48,6 +48,7 @@ import os
|
||||
from pathlib import Path, PurePosixPath
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -1134,6 +1135,14 @@ def run(selected, state, hasher, environment_digest, executors, reuse_oracles, r
|
||||
return results, time.monotonic() - started_all
|
||||
|
||||
|
||||
def exit_on_termination():
|
||||
"""SIGTERM and SIGHUP (a cancelled CI job, a dropped ssh) end this process through its finally blocks, which stop
|
||||
the running harnesses. Each runs in its own session, so without that they, and the vanilla servers they started,
|
||||
outlive it (orphans of days were found on the Mac mini's runners, 2026-10-26)."""
|
||||
for number in (signal.SIGTERM, signal.SIGHUP):
|
||||
signal.signal(number, lambda received, _frame: sys.exit(128 + received))
|
||||
|
||||
|
||||
def worker_main(shared_local):
|
||||
"""`parity.py --worker SHARED_LOCAL`: run harnesses sent as JSON lines on stdin, answer on stdout."""
|
||||
import queue as queues
|
||||
@@ -1169,13 +1178,20 @@ def worker_main(shared_local):
|
||||
built, errors = prebuild(first["prebuild"], default_build_jobs()) if first["prebuild"] else (True, "")
|
||||
executor = LocalExecutor(MACHINE_JOBS, int(memory_available() * 0.75), first["timeout"])
|
||||
send({"hello": {"jobs": MACHINE_JOBS, "memory": executor.memory_budget, "built": built, "errors": errors[-4000:]}})
|
||||
try:
|
||||
return serve(executor, inbox, queues.Empty, send, state, hasher)
|
||||
finally:
|
||||
executor.stop()
|
||||
|
||||
|
||||
def serve(executor, inbox, empty, send, state, hasher):
|
||||
"""The worker's loop: start what the coordinating runner sends, report what finished, until its stdin ends."""
|
||||
while True:
|
||||
try:
|
||||
message = inbox.get(timeout=0.2)
|
||||
except queues.Empty:
|
||||
except empty:
|
||||
message = False
|
||||
if message is None:
|
||||
executor.stop()
|
||||
save_state(state)
|
||||
return 0
|
||||
if message:
|
||||
@@ -1246,6 +1262,101 @@ def trace_main(output, script, arguments):
|
||||
|
||||
# Files every harness's result depends on (part of environment_key): a change to one affects them all.
|
||||
SHARED_INPUTS = {"research-lock.json", "Cargo.lock"}
|
||||
# Manifest sections that say what a crate is and where its targets are, not what it builds with.
|
||||
MANIFEST_SECTION_KEPT = re.compile(r"\[\[?(?:package|lib|bin|example|test|bench|lints|badges)\b[^\]]*\]\]?$")
|
||||
WORKSPACE_CRATE = r"(horizon[\w-]*|cargo-horizon-mod|xtask)"
|
||||
# A workspace crate named as a dependency (by path, or from the workspace's own table) without choosing its features,
|
||||
# or listed as a member.
|
||||
WORKSPACE_LINE = re.compile(WORKSPACE_CRATE + r'\s*=\s*(?:\{(?![^}]*\bfeatures\b)[^}]*\b(?:path|workspace)\s*=[^}]*\}|true)'
|
||||
r'|' + WORKSPACE_CRATE + r'\.workspace\s*=\s*true|"crates/[^"]+",?')
|
||||
# A workspace crate named as a dependency with some of its features turned on.
|
||||
WORKSPACE_FEATURES = re.compile(WORKSPACE_CRATE + r'\s*=\s*\{(?=[^}]*\b(?:path|workspace)\s*=)(?![^}]*default-features)'
|
||||
r'[^}]*\bfeatures\s*=\s*\[([^\]]*)\][^}]*\}')
|
||||
|
||||
|
||||
def git_show(base, path):
|
||||
"""path's content at commit base, or None where it didn't exist."""
|
||||
result = subprocess.run(["git", "show", f"{base}:{path}"], cwd=ROOT, capture_output=True, text=True)
|
||||
return result.stdout if result.returncode == 0 else None
|
||||
|
||||
|
||||
def manifest_lines(text):
|
||||
"""A Cargo.toml's lines that decide what is built: (section, line) pairs, without its package's identity and
|
||||
targets, comments, or workspace crates (whose code counts through its own sources)."""
|
||||
lines, section = set(), ""
|
||||
name = re.search(r'^\[package\][^\[]*?^name\s*=\s*"([^"]+)"', text or "", re.M | re.S)
|
||||
for raw in (text or "").splitlines():
|
||||
line = re.sub(r"\s+", " ", raw.split("#", 1)[0]).strip()
|
||||
if not line:
|
||||
continue
|
||||
if line.startswith("["):
|
||||
# A crate's features are its own: the same line in two crates means two things.
|
||||
section = f"[features] of {name.group(1) if name else '?'}" if line == "[features]" else line
|
||||
continue
|
||||
if MANIFEST_SECTION_KEPT.match(section) or WORKSPACE_LINE.fullmatch(line) or \
|
||||
section == "[workspace]" and (line.startswith("members =") or line.startswith('"') or line == "]"):
|
||||
continue
|
||||
lines.add((section, line))
|
||||
return lines
|
||||
|
||||
|
||||
def lock_packages(text):
|
||||
"""Cargo.lock's packages from a registry or git (with their versions and checksums); workspace crates' entries
|
||||
only list what their manifests say."""
|
||||
return {block.strip() for block in (text or "").split("[[package]]") if "\nsource = " in block}
|
||||
|
||||
|
||||
def workspace_only_manifests(changed, base):
|
||||
"""The changed Cargo.lock and Cargo.toml files whose changes only add, remove or move workspace crates (a crate
|
||||
split): no external package, version, feature, or build setting changed across them. Their crates' code counts
|
||||
through its own sources, so these files don't make every harness linking the crates rerun."""
|
||||
manifests = sorted(path for path in changed if path == "Cargo.lock" or path.endswith("Cargo.toml"))
|
||||
if not manifests or base is None:
|
||||
return set()
|
||||
if "Cargo.lock" in manifests and \
|
||||
lock_packages(git_show(base, "Cargo.lock")) != lock_packages((ROOT / "Cargo.lock").read_text(encoding="utf-8")):
|
||||
return set()
|
||||
tomls = [path for path in manifests if path != "Cargo.lock"]
|
||||
before = set().union(*(manifest_lines(git_show(base, path)) for path in tomls)) if tomls else set()
|
||||
after = set().union(*(manifest_lines((ROOT / path).read_text(encoding="utf-8") if (ROOT / path).exists() else None)
|
||||
for path in tomls)) if tomls else set()
|
||||
# Workspace crates' features that a changed line defines or turns on: they change what compiles of that crate's
|
||||
# sources, which is fine only where every source naming them changed too (a split: the crate's files are new).
|
||||
gated = set()
|
||||
for section, line in before ^ after:
|
||||
wanted = WORKSPACE_FEATURES.fullmatch(line)
|
||||
if wanted:
|
||||
gated |= {(wanted.group(1), feature) for feature in re.findall(r'"([^"]+)"', wanted.group(2))}
|
||||
elif section.startswith("[features] of ") and re.fullmatch(r'[\w-]+ = \[(?: ?"[\w-]+",?)*\s*\]', line):
|
||||
gated.add((section[len("[features] of "):], line.split(" ", 1)[0]))
|
||||
else:
|
||||
return set() # an external package, a feature reaching one ("dep:", "crate/feature"), a build setting
|
||||
return set(manifests) if all(feature_sources_changed(crate, feature, changed) for crate, feature in gated) else set()
|
||||
|
||||
|
||||
def feature_sources_changed(crate, feature, changed):
|
||||
"""Whether every Rust source of workspace crate `crate` that names `feature`, or a feature it turns on, is in
|
||||
changed (False where the crate isn't found)."""
|
||||
listed = subprocess.run(["git", "ls-files", "*Cargo.toml"], cwd=ROOT, capture_output=True, text=True)
|
||||
manifests = [ROOT / path for path in listed.stdout.split()] if listed.returncode == 0 else list(ROOT.rglob("Cargo.toml"))
|
||||
for manifest in manifests:
|
||||
text = manifest.read_text(encoding="utf-8") if manifest.exists() else ""
|
||||
if re.search(r'^\[package\][^\[]*?^name\s*=\s*"' + re.escape(crate) + '"', text, re.M | re.S):
|
||||
break
|
||||
else:
|
||||
return False
|
||||
table = re.search(r"^\[features\]\n(.*?)(?=^\[|\Z)", text, re.M | re.S)
|
||||
implies = {name: re.findall(r'"([^"]+)"', value) for name, value in
|
||||
re.findall(r'^([\w-]+)\s*=\s*\[([^\]]*)\]', table.group(1) if table else "", re.M)}
|
||||
names, todo = set(), [feature]
|
||||
while todo:
|
||||
name = todo.pop()
|
||||
if name not in names:
|
||||
names.add(name)
|
||||
todo += [implied for implied in implies.get(name, []) if "/" not in implied and ":" not in implied]
|
||||
named = re.compile(r'feature\s*=\s*"(?:' + "|".join(map(re.escape, sorted(names))) + r')"')
|
||||
return all(path.relative_to(ROOT).as_posix() in changed for path in manifest.parent.rglob("*.rs")
|
||||
if named.search(path.read_text(encoding="utf-8", errors="replace")))
|
||||
|
||||
|
||||
def changed_files(ref):
|
||||
@@ -1310,7 +1421,7 @@ def affected_harnesses(found, records, changed, reach=True, base=None):
|
||||
affected.add(name)
|
||||
continue
|
||||
plain = {path.split(KEEP)[0] for path in dependencies}
|
||||
hit = plain & changed
|
||||
hit = (plain & changed) | parity_reach.unrecorded(ROOT, plain, changed)
|
||||
if not hit:
|
||||
continue
|
||||
if graph is None or any(not path.startswith("crates/") for path in hit):
|
||||
@@ -1384,6 +1495,7 @@ def finished_run(failed):
|
||||
def main():
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "--trace":
|
||||
return trace_main(sys.argv[2], sys.argv[3], sys.argv[4:])
|
||||
exit_on_termination()
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "--worker":
|
||||
return worker_main(sys.argv[2])
|
||||
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
@@ -1449,7 +1561,11 @@ def main():
|
||||
if args.changed:
|
||||
merge_base = subprocess.run(["git", "merge-base", "HEAD", args.changed], cwd=ROOT, capture_output=True, text=True)
|
||||
base = merge_base.stdout.strip() or None
|
||||
affected = affected_harnesses(found, records, changed, reach=not args.by_crate, base=base)
|
||||
moved = workspace_only_manifests(changed, base) if not args.by_crate else set()
|
||||
if moved:
|
||||
print(f"{', '.join(sorted(moved))}: only workspace crates added, removed or moved; their sources count "
|
||||
"instead", flush=True)
|
||||
affected = affected_harnesses(found, records, changed - moved, reach=not args.by_crate, base=base)
|
||||
chosen = [name for name in found if name in affected and stale(name, state, hasher, environment)]
|
||||
print(f"{len(changed)} files changed{since}: {len(affected)} harnesses "
|
||||
f"depend on them, {len(chosen)} without a pass for their current inputs.", flush=True)
|
||||
@@ -1509,6 +1625,7 @@ def main():
|
||||
jobs = 1 # harnesses that can only run here still need a slot
|
||||
remotes = [RemoteExecutor(host, config["hosts"][host], artifacts, config.get("local_only", {}), args.timeout)
|
||||
for host in hosts]
|
||||
local = None
|
||||
try:
|
||||
if jobs:
|
||||
print("Building probes...", flush=True)
|
||||
@@ -1521,12 +1638,12 @@ def main():
|
||||
where = "".join(f", plus {host}" for host in hosts)
|
||||
print(f"Running {len(selected)} harnesses, {jobs} at a time here{where}...", flush=True)
|
||||
reuse_oracles = not (args.fresh or args.all)
|
||||
executors = [*remotes, LocalExecutor(jobs, int(memory_available() * 0.75), args.timeout,
|
||||
REMOTE_LOCAL_PEAK if remotes and args.jobs is None else None)]
|
||||
results, elapsed = run(selected, state, hasher, environment_key(hasher), executors, reuse_oracles, rounds,
|
||||
known_flaky(config))
|
||||
local = LocalExecutor(jobs, int(memory_available() * 0.75), args.timeout,
|
||||
REMOTE_LOCAL_PEAK if remotes and args.jobs is None else None)
|
||||
results, elapsed = run(selected, state, hasher, environment_key(hasher), [*remotes, local], reuse_oracles,
|
||||
rounds, known_flaky(config))
|
||||
finally:
|
||||
for executor in remotes:
|
||||
for executor in [*remotes, *([local] if local else [])]:
|
||||
executor.stop()
|
||||
save_state(state)
|
||||
failed = sorted(name for name, record in results.items() if record["status"] != "pass")
|
||||
|
||||
@@ -23,17 +23,17 @@
|
||||
"playhorizon": {
|
||||
"ssh": "ludovic@playhorizon",
|
||||
"root": ".actions-runners/horizon/parity-host",
|
||||
"shell": "systemd-run --user --scope --quiet --slice=horizon-ci.slice --unit=horizon-parity-worker-$$ bash -c",
|
||||
"shell": "systemd-run --user --scope --quiet --slice=horizon-ci.slice --unit=horizon-parity-worker-$$ taskset -c 0-3 bash -c",
|
||||
"setup": "test ! -e ~/.actions-runners/horizon/paused && set -a && . ~/.actions-runners/horizon/.env && set +a && export PATH=$(cat ~/.actions-runners/horizon/.path) && unset WAYLAND_DISPLAY && export DISPLAY=:$(cat ~/.actions-runners/horizon/display)",
|
||||
"python": "python3.13",
|
||||
"jobs": 6,
|
||||
"jobs": 3,
|
||||
"nice": 10,
|
||||
"exclude": {
|
||||
"mob_ai": "the vanilla oracle runs out of its 3 GB heap here (OutOfMemoryError in IO workers; passes on the desktop and the Mac) - 2026-10-26 trial",
|
||||
"lan_integration": "two clients rendered on the CPU (lavapipe): different timing subtests fail on each run (elytra, consume-release, barter, critical-hits) - 2026-10-26 trial",
|
||||
"world_reopen": "failed twice here (no Save and Quit button after reopening; the minecart-count flake), passes on the desktop - 2026-10-26 trial"
|
||||
},
|
||||
"note": "a partner's server (Ubuntu, 8 EPYC threads, 30 GB, Detroit; tailnet only), used by nothing else: 6 jobs, in the CI runner's environment, slice and Xvfb screen (tools/ci/linux-runner.sh); the always-on Linux host since the ThinkPad stopped running harnesses (2026-10-26)"
|
||||
"note": "a partner's server (Ubuntu, 8 EPYC threads, 30 GB, Detroit; tailnet only), its CI runner has CPUs 4-7, so workers get 0-3 (as tools/remote.sh runs do) and 3 jobs, in the CI runner's environment, slice and Xvfb screen (tools/ci/linux-runner.sh); the always-on Linux host since the ThinkPad stopped running harnesses (2026-10-26)"
|
||||
}
|
||||
},
|
||||
"local_only": {
|
||||
@@ -44,7 +44,6 @@
|
||||
"lan_integration": "the whole lan_e2e suite: ~40 min a run on a loaded runner, and single checks flake under load; run it by name, or tools/lan_e2e.py"
|
||||
},
|
||||
"known_flaky": {
|
||||
"remote_fireball": "samples the fireball on the wall clock, so a slow host sees it in too few samples (desktop runner, 3 times on 10-26)",
|
||||
"world_reopen": "counted 4 minecarts instead of 3 once on a loaded Mac mini runner, then passed at the same head (10-26)"
|
||||
}
|
||||
}
|
||||
|
||||
+40
-5
@@ -7,8 +7,8 @@ of the workspace's current sources whose nodes are items:
|
||||
|
||||
- everything in an entry is reached, and so is everything in a Rust file the module tree doesn't place (an
|
||||
`include!`d source);
|
||||
- a module is open when it is a crate root, holds reached code, or is named in a path (`name::`, `use ...name`) by
|
||||
reached code while its parent is open;
|
||||
- a module is open when it holds reached code, or is named in a path (`name::`, `use ...name`) by reached code while
|
||||
its parent is open; a library's root once reached code names its crate (`horizon_world`);
|
||||
- a free item (fn, struct, enum, union, trait, type, const, static, an item-level macro call's items) is reached when
|
||||
reached code in its own module or below it mentions its name, or when its module is open and reached code names
|
||||
it in a path or an import, or when its module is glob-imported (`use m::*`) and its name is mentioned;
|
||||
@@ -608,8 +608,8 @@ class SourceGraph:
|
||||
|
||||
try:
|
||||
for path in universe:
|
||||
if path.endswith("/src/lib.rs") or path in entries or path not in self.parent:
|
||||
open_module(path, "crate root or entry")
|
||||
if path in entries or path not in self.parent and not path.endswith("/src/lib.rs"):
|
||||
open_module(path, "entry, or a file no module places")
|
||||
for node in seeds:
|
||||
reach(node, "entry" if node[0] in entries else "always counted")
|
||||
for path in entries & universe:
|
||||
@@ -624,6 +624,12 @@ class SourceGraph:
|
||||
label = (item.get("names") or [item["kind"]])[0] if member is None else item["members"][member]["name"]
|
||||
source = sets_of(node, item)
|
||||
why = f"{path} ({label})"
|
||||
# A library's root opens once reached code names the crate (`horizon_world::`, `use horizon_command
|
||||
# as command`): its items are out of reach until then.
|
||||
for word in (source["mentions"] | source["paths"]) & idents.keys():
|
||||
root = f"crates/{idents[word]}/src/lib.rs"
|
||||
if root in universe and root not in opened:
|
||||
open_module(root, f"{why} names {word}")
|
||||
# Plain mentions reach items of this file and of the modules above it.
|
||||
ancestor, new = path, source["mentions"]
|
||||
while ancestor is not None and new:
|
||||
@@ -709,6 +715,35 @@ def is_workspace_rust(path):
|
||||
return path.startswith("crates/") and path.endswith(".rs") and path.count("/") >= 2
|
||||
|
||||
|
||||
PATH_DEPENDENCY = re.compile(r'path\s*=\s*"\.\./([\w-]+)"')
|
||||
|
||||
|
||||
@functools.cache
|
||||
def _path_dependencies(root, crate):
|
||||
manifest = Path(root) / "crates" / crate / "Cargo.toml"
|
||||
text = manifest.read_text(encoding="utf-8") if manifest.is_file() else ""
|
||||
return frozenset(PATH_DEPENDENCY.findall(text))
|
||||
|
||||
|
||||
def linked_crates(root, crates):
|
||||
"""The workspace crates (folders under crates/) that crates link, themselves included: their path dependencies,
|
||||
transitively. A harness recorded before code moved to a new crate links that crate without naming its files."""
|
||||
found, queue = set(crates), list(crates)
|
||||
while queue:
|
||||
for dependency in _path_dependencies(str(root), queue.pop()):
|
||||
if dependency not in found:
|
||||
found.add(dependency)
|
||||
queue.append(dependency)
|
||||
return found
|
||||
|
||||
|
||||
def unrecorded(root, plain, changed):
|
||||
"""Changed workspace Rust files of crates a harness's recorded crates link but its record doesn't name."""
|
||||
crates = {crate_of(path) for path in plain if path.startswith("crates/") and path.count("/") >= 2}
|
||||
linked = linked_crates(root, crates) - crates
|
||||
return {path for path in changed if is_workspace_rust(path) and crate_of(path) in linked}
|
||||
|
||||
|
||||
DECLARATION_LINE = re.compile(rf"\s*(?:pub(?:\([^)]*\))?\s+)?mod\s+({IDENT})\s*;")
|
||||
|
||||
|
||||
@@ -758,7 +793,7 @@ def narrow(dependencies, artifacts, graph, changed=(), stop=frozenset()):
|
||||
plain = [dependency.split("#keep:")[0] for dependency in dependencies]
|
||||
crates = {crate_of(path) for path in plain if path.startswith("crates/") and path.count("/") >= 2}
|
||||
rust = {path for path in plain if is_workspace_rust(path)}
|
||||
added = {path for path in changed if is_workspace_rust(path) and crate_of(path) in crates
|
||||
added = {path for path in changed if is_workspace_rust(path) and crate_of(path) in linked_crates(graph.root, crates)
|
||||
and path not in rust and (graph.root / path).is_file()}
|
||||
entries = graph.entries(artifacts, rust)
|
||||
if entries is None:
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@ GENERATORS = [
|
||||
("lan_command_order", ["crates/horizon-client/src/lan/command_order.rs"],
|
||||
lambda root, version, store, build: [python(), "tools/generate_lan_command_order.py"]),
|
||||
("command_suggestions", ["crates/horizon-client/src/lan/command_suggestions.rs"], gen_suggestions),
|
||||
("vanilla_command_order", ["crates/horizon-client/src/command/vanilla_order.rs"], gen_vanilla_order),
|
||||
("vanilla_command_order", ["crates/horizon-command/src/vanilla_order.rs"], gen_vanilla_order),
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ GENERATORS = [
|
||||
lambda d: bool(d["commands"]["added"] or d["commands"]["removed"] or d["commands"]["changed"])),
|
||||
("crates/horizon-client/src/lan/command_order.rs", "python3 tools/generate_lan_command_order.py",
|
||||
lambda d: bool(d["commands"]["added"] or d["commands"]["removed"])),
|
||||
("crates/horizon-client/src/command/vanilla_order.rs", "python3 tools/generate_command_order.py",
|
||||
("crates/horizon-command/src/vanilla_order.rs", "python3 tools/generate_command_order.py",
|
||||
lambda d: bool(d["commands"]["added"] or d["commands"]["removed"])),
|
||||
("crates/horizon-world/src/datafix/block_state_data.txt", "python3 tools/gen_block_state_data.py",
|
||||
lambda d: "net/minecraft/util/datafix/fixes/BlockStateData" in d["classes"]["changed"]),
|
||||
|
||||
+41
-12
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run a command on a Linux build host (default playhorizon) at a worktree's commit, and get its output back.
|
||||
#
|
||||
# tools/remote.sh [--host H] [--name N] [--cpus LIST] [--jobs J] <worktree> <command...>
|
||||
# tools/remote.sh [--host H] [--name N] [--cpus LIST] [--exclusive] [--jobs J] <worktree> <command...>
|
||||
# tools/remote.sh .claude/worktrees/my-fix cargo test -p horizon-world --lib
|
||||
# tools/remote.sh . python3 tools/parity.py food light
|
||||
# tools/remote.sh --cpus 0-3 --exclusive . python3 tools/perf_bench.py # a benchmark: CPUs 0-3 to itself
|
||||
# tools/remote.sh --list # checkouts on the host, their size and last use
|
||||
# tools/remote.sh --gc [DAYS] # remove checkouts unused for DAYS (default 2)
|
||||
#
|
||||
@@ -15,21 +16,27 @@
|
||||
# toolchains, a virtual screen and scratch homes for the game and launcher. .local/ links to the host's vanilla
|
||||
# data; a command that runs harnesses (it names parity, lan_e2e or horizon-prepare) also gets .local/horizon-client,
|
||||
# prepared as CI prepares it (tools/ci/vanilla-data.sh). Output streams back and is kept in ~/remote-work/<name>.logs/.
|
||||
# What the command leaves running is stopped when it ends; stopping this script stops the command on the host.
|
||||
# The exit status is the command's.
|
||||
#
|
||||
# CPUs: playhorizon's CI runner has CPUs 4-7 (a systemd drop-in pins it, docs/release-flow.md), so runs here get
|
||||
# 0-3 by default and never slow a pull request's parity job. A run holds its CPU set's lock shared; --exclusive (a
|
||||
# benchmark: name it with --cpus and say so in its pull request) holds it alone, so it starts only when no other run
|
||||
# uses those CPUs, and the others wait for it to end. --cpus 4-7 or all compete with CI: only when it is idle.
|
||||
#
|
||||
# The host is lent by a partner who keeps hypervisor access: never send secrets, tokens or credentials there,
|
||||
# and never treat a result from it as a CI result.
|
||||
set -euo pipefail
|
||||
|
||||
# CPUs 0-3 stay free for benchmarks (perf-world-entry measures on playhorizon pinned to them); --cpus all for every one.
|
||||
host=playhorizon name="" jobs="" cpus=4-7
|
||||
usage() { sed -n '2,8s/^# \{0,1\}//p' "$0" >&2; exit 2; }
|
||||
host=playhorizon name="" jobs="" cpus=0-3 exclusive=0
|
||||
usage() { sed -n '2,9s/^# \{0,1\}//p' "$0" >&2; exit 2; }
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--host) host=$2; shift 2;;
|
||||
--name) name=$2; shift 2;;
|
||||
--jobs) jobs=$2; shift 2;;
|
||||
--cpus) cpus=$2; shift 2;;
|
||||
--exclusive) exclusive=1; shift;;
|
||||
--list) exec ssh "ludovic@$host" 'cd ~/remote-work 2>/dev/null && for d in */; do d=${d%/};
|
||||
printf "%-32s %8s last used %s\n" "$d" "$(du -sh "$d" 2>/dev/null | cut -f1)" "$(stat -c %y "$d.logs" 2>/dev/null | cut -c1-16)"; done';;
|
||||
--gc) days=${2:-2}; exec ssh "ludovic@$host" "cd ~/remote-work 2>/dev/null || exit 0
|
||||
@@ -57,7 +64,8 @@ command=$(printf '%q ' "$@")
|
||||
# The host side reads its script and these four values on stdin (nothing is re-split by a remote shell); its
|
||||
# own environment comes from the runner's files there.
|
||||
{
|
||||
printf 'name=%q sha=%q jobs=%q cpus=%q command=%q\n' "$name" "$sha" "$jobs" "$cpus" "$command"
|
||||
[[ $cpus =~ ^[0-9,-]+$|^all$ ]] || { echo "remote.sh: --cpus takes a list such as 0-3, or all" >&2; exit 2; }
|
||||
printf 'name=%q sha=%q jobs=%q cpus=%q exclusive=%q command=%q\n' "$name" "$sha" "$jobs" "$cpus" "$exclusive" "$command"
|
||||
cat <<'REMOTE'
|
||||
set -euo pipefail
|
||||
if [ "$cpus" = all ]; then pin=(); jobs=${jobs:-$(nproc)}; else pin=(taskset -c "$cpus"); jobs=${jobs:-$(taskset -c "$cpus" nproc)}; fi
|
||||
@@ -70,19 +78,27 @@ unset WAYLAND_DISPLAY
|
||||
mkdir -p ~/remote-work && cd ~/remote-work
|
||||
exec 9> "$name.lock"
|
||||
flock -n 9 || { echo "remote.sh: $name is busy with another run" >&2; exit 75; }
|
||||
# The CPU set's lock: shared by ordinary runs, held alone by an --exclusive one (a benchmark).
|
||||
exec 8> ".cpus-$cpus.lock"
|
||||
if [ "$exclusive" = 1 ]; then
|
||||
flock -x -n 8 || { echo "remote.sh: other runs use CPUs $cpus; try again when they are done (--list)" >&2; exit 75; }
|
||||
elif ! flock -s -n 8; then
|
||||
echo "remote.sh: an exclusive run (a benchmark) has CPUs $cpus; waiting for it to end" >&2
|
||||
flock -s 8
|
||||
fi
|
||||
if [ ! -d "$name/.git" ]; then
|
||||
git clone -q --filter=blob:none --no-checkout https://github.com/ludovic111/horizon "$name" 9>&-
|
||||
git clone -q --filter=blob:none --no-checkout https://github.com/ludovic111/horizon "$name" 8>&- 9>&-
|
||||
fi
|
||||
cd "$name"
|
||||
# The lock's descriptor stays out of everything started here (9>&-): a daemon one of them starts (sccache's server,
|
||||
# The lock's descriptor stays out of everything started here (8>&- 9>&-): a daemon one of them starts (sccache's server,
|
||||
# from the preparer's build or the command's) would hold the lock after the run.
|
||||
git fetch -q --no-tags origin "$sha" 9>&-
|
||||
git fetch -q --no-tags origin "$sha" 8>&- 9>&-
|
||||
git checkout -q --force --detach "$sha"
|
||||
git clean -qfd -e /target -e /.local
|
||||
# The host's vanilla data, linked as CI's runner links it; for harnesses also .local/horizon-client, prepared by
|
||||
# this commit's own preparer (once per preparer version, kept beside the data and shared by every name).
|
||||
if [[ $command =~ parity|lan_e2e|horizon-prepare ]]; then
|
||||
RUNNER_WORKSPACE=$(dirname "$HORIZON_SHARED_SOURCE") RUNNER_TEMP=$(mktemp -d) bash tools/ci/vanilla-data.sh >&2 9>&-
|
||||
RUNNER_WORKSPACE=$(dirname "$HORIZON_SHARED_SOURCE") RUNNER_TEMP=$(mktemp -d) bash tools/ci/vanilla-data.sh >&2 8>&- 9>&-
|
||||
else
|
||||
mkdir -p .local
|
||||
for d in minecraft tools datagen; do
|
||||
@@ -96,9 +112,22 @@ export HORIZON_HOME=$scratch/game HORIZON_LAUNCHER_HOME=$scratch/launcher XDG_DA
|
||||
mkdir -p "$HORIZON_HOME" "$HORIZON_LAUNCHER_HOME" "$XDG_DATA_HOME" "$XDG_CONFIG_HOME" ../"$name.logs"
|
||||
log=../"$name.logs/$(date -u +%Y%m%dT%H%M%SZ)-${sha:0:9}.log"
|
||||
echo "remote.sh: $(hostname) at ${sha:0:9} in ~/remote-work/$name, CPUs $cpus, -j $jobs; log ~/remote-work/${log#../}" >&2
|
||||
# The command runs in a scope of its own, stopped with everything in it once the command is done (a game or a
|
||||
# daemon it left behind), when the caller goes away first (the ssh session ends), and before the next run here.
|
||||
unit=remote-$name.scope
|
||||
systemctl --user stop "$unit" 2>/dev/null || true
|
||||
session=$PPID
|
||||
( while kill -0 "$session" 2>/dev/null; do sleep 2; done; systemctl --user stop "$unit" 2>/dev/null ) \
|
||||
< /dev/null > /dev/null 2>&1 8>&- 9>&- &
|
||||
watcher=$!
|
||||
status=0
|
||||
systemd-run --user --scope --quiet --slice=horizon-ci.slice --unit="remote-$name-$$" \
|
||||
"${pin[@]}" nice -n 10 bash -c "$command" 2>&1 < /dev/null 9>&- | tee "$log" || status=${PIPESTATUS[0]}
|
||||
systemd-run --user --scope --quiet --slice=horizon-ci.slice --unit="$unit" \
|
||||
"${pin[@]}" nice -n 10 bash -c "$command" 2>&1 < /dev/null 8>&- 9>&- | tee "$log" || status=${PIPESTATUS[0]}
|
||||
kill "$watcher" 2>/dev/null || true
|
||||
systemctl --user stop "$unit" 2>/dev/null || true
|
||||
exit "$status"
|
||||
REMOTE
|
||||
} | ssh -o BatchMode=yes "ludovic@$host" bash -s
|
||||
} | ssh -o BatchMode=yes "ludovic@$host" bash -s &
|
||||
# Stopping this script ends the session, and the host then stops the command (above).
|
||||
trap 'kill $! 2>/dev/null' INT TERM HUP
|
||||
wait $!
|
||||
|
||||
@@ -180,9 +180,9 @@ def main():
|
||||
'-cp', dependencies, '-d', str(classes), str(java_root / 'dev/horizonlab/parity/VanillaDispenserOracle.java')])
|
||||
d.run(['java', '-Xmx3G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaDispenserOracle',
|
||||
str(resources), str(work / 'cases.jsonl'), str(work / 'native.txt')])
|
||||
d.run(['cargo', 'build', '-q', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
d.run(['cargo', 'build', '-q', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
env={**os.environ, 'CARGO_BUILD_JOBS': os.environ.get('CARGO_BUILD_JOBS', '3')})
|
||||
d.run([str(lab.cargo_target() / 'release/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
d.run([str(lab.cargo_target() / 'fast/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
env=lab.game_env(HORIZON_DISPENSE_FIXTURE=f'{work / "cases.jsonl"},{work / "rust.txt"}'))
|
||||
# Loot table names (D) are vanilla's bookkeeping; the drops themselves are compared.
|
||||
ignore = tuple(prefix + ' ' for prefix in args.ignore.split(',') if prefix) + ('D ',)
|
||||
|
||||
@@ -79,9 +79,9 @@ def main():
|
||||
run(['java', '-Xmx3G', '-Duser.timezone=UTC', '-cp', os.pathsep.join([str(classes), str(jars['server']), dependency_path]),
|
||||
'dev.horizonlab.parity.VanillaCommandExecOracle', vanilla_dir / 'universe', script_path, build / 'vanilla.jsonl', SEED], 'java', cwd=vanilla_dir)
|
||||
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], 'compile-rust', cwd=lab.ROOT)
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], 'compile-rust', cwd=lab.ROOT)
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
rust_dir = build / 'rust'
|
||||
shutil.rmtree(rust_dir, ignore_errors=True)
|
||||
rust_dir.mkdir()
|
||||
|
||||
@@ -64,9 +64,9 @@ def main():
|
||||
registries = json.loads((build / 'registries.json').read_text())
|
||||
corpus = corpus_module.corpus(tree, registries)
|
||||
(build / 'corpus.txt').write_text(''.join(line + '\n' for line in corpus), encoding='utf-8')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe')
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe')
|
||||
resources = lab.RESOURCES
|
||||
total_failures = 0
|
||||
summary = []
|
||||
|
||||
@@ -122,9 +122,9 @@ def main():
|
||||
'-cp', dependencies, '-d', str(classes), str(java_root / 'dev/horizonlab/parity/VanillaDispenserOracle.java')])
|
||||
d.run(['java', '-Xmx3G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaDispenserOracle',
|
||||
str(resources), str(work / 'cases.jsonl'), str(work / 'native.txt')])
|
||||
d.run(['cargo', 'build', '-q', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
d.run(['cargo', 'build', '-q', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
env={**os.environ, 'CARGO_BUILD_JOBS': os.environ.get('CARGO_BUILD_JOBS', '3')})
|
||||
d.run([str(lab.cargo_target() / 'release/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
d.run([str(lab.cargo_target() / 'fast/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
env=lab.game_env(HORIZON_DISPENSE_FIXTURE=f'{work / "cases.jsonl"},{work / "rust.txt"}'))
|
||||
ignore = tuple(prefix + ' ' for prefix in args.ignore.split(',') if prefix) + ('D ',)
|
||||
native = h.split_cases((work / 'native.txt').read_text(), ignore)
|
||||
|
||||
@@ -242,9 +242,9 @@ def main():
|
||||
'-cp', dependencies, '-d', str(classes), str(java_root / 'dev/horizonlab/parity/VanillaDispenserOracle.java')])
|
||||
d.run(['java', '-Xmx3G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaDispenserOracle',
|
||||
str(resources), str(work / 'cases.jsonl'), str(work / 'native.txt')])
|
||||
d.run(['cargo', 'build', '-q', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
d.run(['cargo', 'build', '-q', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
env={**os.environ, 'CARGO_BUILD_JOBS': os.environ.get('CARGO_BUILD_JOBS', '3')})
|
||||
d.run([str(lab.cargo_target() / 'release/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
d.run([str(lab.cargo_target() / 'fast/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
env=lab.game_env(HORIZON_DISPENSE_FIXTURE=f'{work / "cases.jsonl"},{work / "rust.txt"}'))
|
||||
ignore = tuple(prefix + ' ' for prefix in args.ignore.split(',') if prefix) + ('D ',)
|
||||
native = h.split_cases((work / 'native.txt').read_text(), ignore)
|
||||
|
||||
@@ -424,11 +424,11 @@ def main():
|
||||
oh.run_logged(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-nowarn', '-sourcepath',
|
||||
lab.ROOT / 'mods/horizon/src/test/java', '-cp', dependencies, '-d', classes, oracle],
|
||||
build, 'compile-java')
|
||||
oh.run_logged(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], build,
|
||||
oh.run_logged(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], build,
|
||||
'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
vanilla_server = ['java', '-Xmx2g', '-Duser.timezone=UTC', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', lab.RESOURCES, '--dedicated', '--nogui']
|
||||
|
||||
|
||||
@@ -417,9 +417,9 @@ def main():
|
||||
'-cp', dependencies, '-d', str(classes), str(java_root / 'dev/horizonlab/parity/VanillaDispenserOracle.java')])
|
||||
run(['java', '-Xmx3G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaDispenserOracle',
|
||||
str(resources), str(work / 'cases.jsonl'), str(work / 'native.txt')])
|
||||
run(['cargo', 'build', '-q', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
run(['cargo', 'build', '-q', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
env={**os.environ, 'CARGO_BUILD_JOBS': os.environ.get('CARGO_BUILD_JOBS', '3')})
|
||||
run([str(lab.cargo_target() / 'release/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
run([str(lab.cargo_target() / 'fast/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
env=lab.game_env(HORIZON_DISPENSE_FIXTURE=f'{work / "cases.jsonl"},{work / "rust.txt"}'))
|
||||
# Loot table names (D) are vanilla's bookkeeping; the drops themselves are compared.
|
||||
ignore = tuple(prefix + ' ' for prefix in args.ignore.split(',') if prefix) + ('D ',)
|
||||
|
||||
@@ -56,9 +56,9 @@ def main():
|
||||
with (build / (name + '.log')).open('w', encoding='utf-8') as log:
|
||||
base.run(list(map(str, command)), stdout=log, stderr=subprocess.STDOUT)
|
||||
run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'), '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe')
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe')
|
||||
run([binary, 'enchanting_fixture',resources, inputs, build / 'rust.txt'], 'rust')
|
||||
references = []
|
||||
for side in ['server']:
|
||||
|
||||
@@ -139,9 +139,9 @@ def main():
|
||||
'-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java')
|
||||
run(['java', '-Xmx2G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]),
|
||||
'dev.horizonlab.parity.VanillaEntityDeathLootOracle', inputs, build / 'server.txt'], 'server')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples/client_probe'
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples/client_probe'
|
||||
run([binary, 'entity_death_loot_fixture', resources, inputs, build / 'rust.txt'], 'rust')
|
||||
errors = [l for l in (build / 'server.txt').read_text().splitlines() if l.startswith('error ')]
|
||||
if errors:
|
||||
|
||||
@@ -148,9 +148,9 @@ def main():
|
||||
print(f'{len(vanilla)} oracle lines')
|
||||
return
|
||||
halloween = vanilla[0].split()[1]
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples/client_probe'
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples/client_probe'
|
||||
run([binary, 'finalize_spawn_fixture', resources, inputs, build / 'rust.txt', halloween], 'rust')
|
||||
rust = (build / 'rust.txt').read_text().splitlines()
|
||||
bad = [(a, b) for a, b in zip(vanilla, rust) if a != b]
|
||||
|
||||
Executable
+91
@@ -0,0 +1,91 @@
|
||||
#!/usr/bin/env python3
|
||||
"""The End of a dedicated server nobody has entered, force-loaded from the console, against vanilla's.
|
||||
|
||||
A vanilla dedicated server and Horizon's each open a copy of one world vanilla generated (its End not made yet).
|
||||
With no player online, the console force-loads the End's main island and its arena. A FORCED ticket keeps its level active
|
||||
(`ServerChunkCache.hasActiveTickets`, `TicketType.FORCED`), so the chunks are generated, loaded and ticked
|
||||
without a player in the dimension. With nobody in the fight, `EnderDragonFight.tick` neither scans the state nor
|
||||
places the exit portal: no bedrock and no torches around 0, 0. Both servers must answer the same.
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
try:
|
||||
from . import lab, test_rust_parity as base
|
||||
from .test_dedicated_server_parity import Server, wait_ticks
|
||||
from .test_locator_bar_parity import generate_world, server_dir
|
||||
except ImportError:
|
||||
import lab
|
||||
import test_rust_parity as base
|
||||
from test_dedicated_server_parity import Server, wait_ticks
|
||||
from test_locator_bar_parity import generate_world, server_dir
|
||||
|
||||
NAME = 'forced-end-parity'
|
||||
END = 'execute in minecraft:the_end'
|
||||
QUERIES = [
|
||||
f'{END} run fill -3 0 -3 3 255 3 minecraft:air replace minecraft:bedrock',
|
||||
f'{END} run fill -3 0 -3 3 255 3 minecraft:air replace minecraft:wall_torch',
|
||||
]
|
||||
|
||||
|
||||
def answer(server, command, n):
|
||||
start = len(server.lines)
|
||||
server.console(command)
|
||||
server.console(f'say done {n}')
|
||||
server.wait_for(rf'\[Server\] done {n}$', timeout=120)
|
||||
replies = [l.split(']: ', 1)[-1] for l in server.lines[start:] if 'done ' not in l]
|
||||
return ' / '.join(r for r in replies if r) or '(no reply)'
|
||||
|
||||
|
||||
def run_side(label, command, build, world):
|
||||
directory = build / label
|
||||
server_dir(directory, world)
|
||||
server = Server(command, directory, label)
|
||||
try:
|
||||
server.wait_for(r'Done \(')
|
||||
# The main island's arena (EnderDragonFight.isArenaLoaded: chunks -8..8), in pieces of at most 256 chunks.
|
||||
for area in ('-128 -128 143 -1', '-128 0 143 143'):
|
||||
server.console(f'{END} run forceload add {area}')
|
||||
deadline = time.time() + 600
|
||||
for poll in range(1_000_000):
|
||||
reply = answer(server, f'{END} if loaded 0 0 0', f'loaded {poll}')
|
||||
if 'passed' in reply:
|
||||
break
|
||||
if time.time() > deadline:
|
||||
raise AssertionError(f'{label}: the End centre never loaded')
|
||||
time.sleep(2)
|
||||
wait_ticks(server, 200)
|
||||
return {q: answer(server, q, i) for i, q in enumerate(QUERIES)}
|
||||
finally:
|
||||
server.stop()
|
||||
|
||||
|
||||
def main():
|
||||
_, jars, libraries = base.verify_artifacts()
|
||||
build = lab.LOCAL / NAME
|
||||
build.mkdir(parents=True, exist_ok=True)
|
||||
dependencies = os.pathsep.join(map(str, [jars['server'], *libraries]))
|
||||
subprocess.run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
check=True, capture_output=True)
|
||||
binary = lab.cargo_target() / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
vanilla_server = ['java', '-Xmx2g', '-Duser.timezone=UTC', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', lab.LOCAL / 'horizon-client/26.3', '--dedicated', '--nogui']
|
||||
world = generate_world(vanilla_server, build)
|
||||
vanilla = run_side('vanilla', vanilla_server, build, world)
|
||||
horizon = run_side('horizon', horizon_server, build, world)
|
||||
normal = lambda s: re.sub(r'\s+', ' ', s).strip()
|
||||
problems = [f'{q}\n vanilla: {vanilla[q]}\n horizon: {horizon[q]}'
|
||||
for q in QUERIES if normal(vanilla[q]) != normal(horizon[q])]
|
||||
if problems:
|
||||
raise AssertionError('the forced End differs:\n' + '\n'.join(problems))
|
||||
print(f'forced End: loaded and ticked with nobody in it, no exit portal, as vanilla ({vanilla[QUERIES[0]]})')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main()
|
||||
except AssertionError as error:
|
||||
sys.exit(f'{NAME}: {error}')
|
||||
+21
-1
@@ -137,6 +137,24 @@ def guest_pos(host, name):
|
||||
return next(g['position'] for g in guests if g['name'] == name)
|
||||
|
||||
|
||||
def open_ground(host, guest, name):
|
||||
"""Puts the guest on a cleared, flat floor beside the host and returns where it stands.
|
||||
|
||||
A player new to the world spawns at a random free spot near the world spawn, as in vanilla
|
||||
(`PlayerSpawnFinder`), often against a hill: walking and aiming need known, open ground.
|
||||
Commands, not the control socket: the server has the last word on where the guest stands.
|
||||
"""
|
||||
hp = host('status')['player']['position']
|
||||
x, y, z = math.floor(hp[0]) - 6, math.floor(hp[1]), math.floor(hp[2])
|
||||
host(f'command fill {x - 2} {y - 1} {z - 2} {x + 4} {y - 1} {z + 8} minecraft:stone')
|
||||
host(f'command fill {x - 2} {y} {z - 2} {x + 4} {y + 3} {z + 8} minecraft:air')
|
||||
spot = [x + 0.5, float(y), z + 0.5]
|
||||
host(f'command tp {name} {spot[0]} {spot[1]} {spot[2]} 0 0')
|
||||
guest.wait('status', lambda v: math.dist(v['player']['position'], spot) < 0.01 and v['player']['on_ground'], 20,
|
||||
'the guest on its ground')
|
||||
return spot
|
||||
|
||||
|
||||
def play_together(host, guest, name, round_index):
|
||||
"""Chat, movement and blocks seen from both sides."""
|
||||
host.wait('lan status', lambda v: any(g['name'] == name and g['placed'] for g in v['guests']), 60,
|
||||
@@ -150,6 +168,7 @@ def play_together(host, guest, name, round_index):
|
||||
guest.wait('status', lambda v: any(f'hello from the host {round_index}' in l for l in v['server']['chat']), 30,
|
||||
'host chat on the guest')
|
||||
# The guest walks; the host sees it move.
|
||||
open_ground(host, guest, name)
|
||||
before = guest_pos(host, name)
|
||||
guest('look 0 0')
|
||||
guest('key w down')
|
||||
@@ -167,7 +186,8 @@ def play_together(host, guest, name, round_index):
|
||||
guest.wait('status', lambda v: any(math.dist(p, target) < 0.6 for p in v['server']['player_positions']), 20,
|
||||
'host movement on the guest')
|
||||
# A block the host places, which the guest sees and then breaks.
|
||||
gp = guest('status')['player']['position']
|
||||
gp = guest.wait('status', lambda v: v['player']['on_ground'] and math.hypot(v['player']['velocity'][0],
|
||||
v['player']['velocity'][2]) < 1e-3, 10, 'the guest standing still')['player']['position']
|
||||
feet = [math.floor(gp[0]), math.floor(gp[1]), math.floor(gp[2])]
|
||||
block = [feet[0] + 2, feet[1] + 1, feet[2]]
|
||||
# Clear the line of sight (the test terrain has hills), then the block at eye level.
|
||||
|
||||
@@ -258,12 +258,12 @@ def sides(name):
|
||||
subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none', '-nowarn', '-sourcepath',
|
||||
lab.ROOT / 'mods/horizon/src/test/java', '-cp', dependencies, '-d', classes, oracle],
|
||||
cwd=lab.ROOT, check=True, capture_output=True)
|
||||
subprocess.run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
subprocess.run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
check=True, capture_output=True)
|
||||
import json
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
vanilla_server = ['java', '-Xmx2g', '-Duser.timezone=UTC', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', lab.LOCAL / 'horizon-client/26.3', '--dedicated', '--nogui']
|
||||
client = ['java', '-Xmx1g', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.LocatorBarClient']
|
||||
|
||||
@@ -35,7 +35,7 @@ if __name__ == '__main__':
|
||||
sources=[
|
||||
lab.ROOT / 'crates/horizon-client/src/item_tooltip.rs',
|
||||
lab.ROOT / 'crates/horizon-client/src/item_data.rs',
|
||||
lab.ROOT / 'crates/horizon-client/src/text.rs',
|
||||
lab.ROOT / 'crates/horizon-client/src/component.rs',
|
||||
lab.ROOT / 'crates/horizon-client-core/src/text.rs',
|
||||
lab.ROOT / 'crates/horizon-client-core/src/component.rs',
|
||||
],
|
||||
expected_lines=len(CASES))
|
||||
|
||||
@@ -167,9 +167,9 @@ def main():
|
||||
'-cp', dependencies, '-d', str(classes), str(java_root / 'dev/horizonlab/parity/VanillaDispenserOracle.java')])
|
||||
d.run(['java', '-Xmx3G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaDispenserOracle',
|
||||
str(resources), str(work / 'cases.jsonl'), str(work / 'native.txt')])
|
||||
d.run(['cargo', 'build', '-q', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
d.run(['cargo', 'build', '-q', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
env={**os.environ, 'CARGO_BUILD_JOBS': os.environ.get('CARGO_BUILD_JOBS', '3')})
|
||||
d.run([str(lab.cargo_target() / 'release/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
d.run([str(lab.cargo_target() / 'fast/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
env=lab.game_env(HORIZON_DISPENSE_FIXTURE=f'{work / "cases.jsonl"},{work / "rust.txt"}'))
|
||||
ignore = tuple(prefix + ' ' for prefix in args.ignore.split(',') if prefix) + ('D ',)
|
||||
native = h.split_cases((work / 'native.txt').read_text(), ignore)
|
||||
|
||||
@@ -525,7 +525,7 @@ def main():
|
||||
'dev.horizonlab.parity.VanillaMobAiOracle', inputs, build / 'vanilla.txt', world],
|
||||
build, 'vanilla', timeout=3600)
|
||||
if not args.java_only:
|
||||
command = ['cargo', 'build', '--locked', '--release', '-p', 'horizon-client', '--example', 'client_probe']
|
||||
command = ['cargo', 'build', '--locked', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe']
|
||||
target, env = lab.cargo_target(), None
|
||||
if args.trace:
|
||||
target = lab.LOCAL / 'mob-ai-trace-target'
|
||||
@@ -533,7 +533,7 @@ def main():
|
||||
env = dict(os.environ, CARGO_TARGET_DIR=str(target), CARGO_PROFILE_RELEASE_DEBUG='line-tables-only',
|
||||
CARGO_PROFILE_RELEASE_LTO='false', CARGO_PROFILE_RELEASE_CODEGEN_UNITS='16')
|
||||
oracle_harness.run_logged(command, build, 'compile-rust', env=env)
|
||||
binary = target / 'release/examples/client_probe'
|
||||
binary = target / 'fast/examples/client_probe'
|
||||
oracle_harness.run_logged([binary, 'mob_ai_probe', lab.RESOURCES, inputs, build / 'horizon.txt'], build, 'horizon')
|
||||
if args.java_only:
|
||||
return
|
||||
|
||||
@@ -62,8 +62,8 @@ def main():
|
||||
subprocess.run(list(map(str, cmd)), cwd=lab.ROOT, check=True, timeout=3600, stdout=log, stderr=subprocess.STDOUT)
|
||||
run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java')
|
||||
run(['java', '-Xmx1G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]), 'dev.horizonlab.parity.VanillaMobAttributesOracle', build / 'vanilla.txt'], 'java')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
binary = lab.cargo_target() / 'release/examples/client_probe'
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
binary = lab.cargo_target() / 'fast/examples/client_probe'
|
||||
resources = lab.RESOURCES
|
||||
run([binary, 'mob_attributes_fixture', resources, build / 'rust.txt'], 'rust')
|
||||
vanilla, rust = parse(build / 'vanilla.txt'), parse(build / 'rust.txt')
|
||||
|
||||
@@ -568,9 +568,9 @@ def main():
|
||||
'-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java')
|
||||
run(['java', '-Xmx3G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]),
|
||||
'dev.horizonlab.parity.VanillaNaturalSpawnOracle', inputs, build / 'server.txt'], 'server')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples/client_probe'
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples/client_probe'
|
||||
run([binary, 'natural_spawn_fixture', resources, inputs, build / 'rust.txt'], 'rust')
|
||||
vanilla = (build / 'server.txt').read_text().splitlines()
|
||||
errors = [l for l in vanilla if ' error ' in l]
|
||||
|
||||
@@ -351,11 +351,11 @@ def main():
|
||||
build.mkdir(parents=True, exist_ok=True)
|
||||
report = build / 'report.json'
|
||||
report.unlink(missing_ok=True)
|
||||
oh.run_logged(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], build,
|
||||
oh.run_logged(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], build,
|
||||
'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
dependencies = os.pathsep.join(map(str, [jars['server'], *libraries]))
|
||||
|
||||
services = Services()
|
||||
|
||||
@@ -335,9 +335,9 @@ def main():
|
||||
'-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java')
|
||||
run(['java', '-Xmx3G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]),
|
||||
'dev.horizonlab.parity.VanillaRaidOracle', inputs, build / 'server.txt'], 'server')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples/client_probe'
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples/client_probe'
|
||||
run([binary, 'raid_fixture', resources, inputs, build / 'rust.txt'], 'rust')
|
||||
vanilla = (build / 'server.txt').read_text().splitlines()
|
||||
errors = [l for l in vanilla if ' error ' in l]
|
||||
|
||||
@@ -18,15 +18,19 @@ def check_motion(host, guest, out):
|
||||
for game in (host, guest):
|
||||
game('command', command='gamemode creative')
|
||||
tag = 'remote_fireball_parity'
|
||||
host('command', command=f'fill {x + 2} {y + 18} {z - 1} {x + 48} {y + 23} {z + 1} minecraft:air')
|
||||
# A slow fireball (acceleration_power 0.02: under 0.4 blocks a tick, against ~2 by default) stays in the cleared
|
||||
# corridor and in the guest's tracking range for every sample, however many ticks a loaded host takes to answer.
|
||||
host('command', command=f'fill {x + 2} {y + 18} {z - 1} {x + 96} {y + 23} {z + 1} minecraft:air')
|
||||
host('command', command=f'summon minecraft:fireball {x + 3.5} {y + 20} {z + 0.5} '
|
||||
f'{{Tags:["{tag}"],Motion:[0.1d,0.0d,0.0d]}}')
|
||||
f'{{Tags:["{tag}"],Motion:[0.1d,0.0d,0.0d],acceleration_power:0.02d}}')
|
||||
samples = []
|
||||
try:
|
||||
for _ in range(8):
|
||||
balls = [p for p in guest('status')['projectiles'] if p['kind'] == 'LargeFireball']
|
||||
# One ctl process for all samples: a ctl process per sample took 10-16 ticks on a loaded runner, by
|
||||
# which time the fireball had left the cleared corridor and exploded.
|
||||
replies = guest.script(['status', 'wait 1'] * 16, every=True)
|
||||
for status in (reply for reply in replies if 'projectiles' in reply):
|
||||
balls = [p for p in status['projectiles'] if p['kind'] == 'LargeFireball']
|
||||
samples.append(balls[0]['position'][0] if balls else None)
|
||||
guest.wait(2)
|
||||
finally:
|
||||
host('command', command=f'kill @e[tag={tag}]')
|
||||
seen = [p for p in samples if p is not None]
|
||||
|
||||
@@ -129,7 +129,7 @@ def main():
|
||||
"Pack discovery, overlays, filters and the resource stacks vanilla merges.",
|
||||
sources=[lab.ROOT / "crates/horizon-client/src/packs.rs",
|
||||
lab.ROOT / "crates/horizon-client/src/sound_events.rs",
|
||||
lab.ROOT / "crates/horizon-client/src/lang.rs"])
|
||||
lab.ROOT / "crates/horizon-client-core/src/lang.rs"])
|
||||
total += len(QUERIES)
|
||||
print(f"{total} resource pack queries match the pinned client over {len(SELECTIONS)} selections")
|
||||
|
||||
|
||||
@@ -250,9 +250,9 @@ def main():
|
||||
inputs = build / 'inputs.jsonl'
|
||||
inputs.write_text(''.join(json.dumps(c, ensure_ascii=False) + '\n' for c in chosen), encoding='utf-8')
|
||||
run([*oracle, 'run', inputs, build / 'vanilla.jsonl'], 'vanilla')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe')
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe')
|
||||
run([binary, 'scoreboard_fixture',build / 'registries.json', inputs, build / 'rust.jsonl', build / 'vanilla.jsonl'], 'rust')
|
||||
read = lambda p: [json.loads(l) for l in p.read_text(encoding='utf-8').splitlines()]
|
||||
vanilla, rust = read(build / 'vanilla.jsonl'), read(build / 'rust.jsonl')
|
||||
|
||||
@@ -336,9 +336,9 @@ def main():
|
||||
'dev.horizonlab.parity.VanillaSculkOracle', inputs, build / 'vanilla.txt'],
|
||||
build, 'vanilla', timeout=3600)
|
||||
if not args.java_only:
|
||||
oracle_harness.run_logged(['cargo', 'build', '--locked', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'],
|
||||
oracle_harness.run_logged(['cargo', 'build', '--locked', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'],
|
||||
build, 'compile-rust')
|
||||
oracle_harness.run_logged([lab.cargo_target() / 'release/horizon-client', '--resources', resources], build, 'horizon',
|
||||
oracle_harness.run_logged([lab.cargo_target() / 'fast/horizon-client', '--resources', resources], build, 'horizon',
|
||||
env=lab.game_env(HORIZON_SCULK_FIXTURE=f'{inputs},{build / "horizon.txt"}'))
|
||||
if args.java_only:
|
||||
return
|
||||
|
||||
@@ -254,11 +254,11 @@ def main():
|
||||
oh.run_logged(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-nowarn', '-sourcepath',
|
||||
lab.ROOT / 'mods/horizon/src/test/java', '-cp', dependencies, '-d', classes, oracle],
|
||||
build, 'compile-java')
|
||||
oh.run_logged(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], build,
|
||||
oh.run_logged(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], build,
|
||||
'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
java = ['java', '-Xmx1g', '-Duser.timezone=UTC', '-cp', str(classes) + os.pathsep + dependencies,
|
||||
'dev.horizonlab.parity.SecureChatClient']
|
||||
oh.run_logged([*java, 'keys', build], build, 'keys')
|
||||
|
||||
@@ -118,12 +118,12 @@ def main():
|
||||
subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none', '-nowarn', '-sourcepath',
|
||||
lab.ROOT / 'mods/horizon/src/test/java', '-cp', dependencies, '-d', classes, oracle],
|
||||
cwd=lab.ROOT, check=True, capture_output=True)
|
||||
subprocess.run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
subprocess.run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
check=True, capture_output=True)
|
||||
import json
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
vanilla_server = ['java', '-Xmx2g', '-Duser.timezone=UTC', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', lab.LOCAL / 'horizon-client/26.3', '--dedicated', '--nogui']
|
||||
client = ['java', '-Xmx1g', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.LocatorBarClient']
|
||||
|
||||
@@ -101,12 +101,12 @@ def main():
|
||||
# SERVER_DRAGON_SIDES=vanilla (or horizon) runs one side and reads the other's last transcript.
|
||||
sides = [s for s in os.environ.get('SERVER_DRAGON_SIDES', 'vanilla,horizon').split(',') if s]
|
||||
if 'horizon' in sides:
|
||||
subprocess.run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
subprocess.run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
check=True, capture_output=True)
|
||||
import json
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
vanilla_server = ['java', '-Xmx2g', '-Duser.timezone=UTC', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', lab.LOCAL / 'horizon-client/26.3', '--dedicated', '--nogui']
|
||||
client = ['java', '-Xmx1g', '-Duser.timezone=UTC', '-cp', str(classes) + os.pathsep + dependencies,
|
||||
|
||||
@@ -157,12 +157,12 @@ def main():
|
||||
# SERVER_ENTITIES_SIDES=vanilla (or horizon) runs one side and reads the other's last transcript.
|
||||
sides = [s for s in os.environ.get('SERVER_ENTITIES_SIDES', 'vanilla,horizon').split(',') if s]
|
||||
if 'horizon' in sides:
|
||||
subprocess.run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
subprocess.run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
check=True, capture_output=True)
|
||||
import json
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
vanilla_server = ['java', '-Xmx2g', '-Duser.timezone=UTC', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', lab.LOCAL / 'horizon-client/26.3', '--dedicated', '--nogui']
|
||||
client = ['java', '-Xmx1g', '-Duser.timezone=UTC', '-cp', str(classes) + os.pathsep + dependencies,
|
||||
|
||||
@@ -334,12 +334,12 @@ def main():
|
||||
subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none', '-nowarn', '-sourcepath',
|
||||
lab.ROOT / 'mods/horizon/src/test/java', '-cp', dependencies, '-d', classes, oracle],
|
||||
cwd=lab.ROOT, check=True, capture_output=True)
|
||||
subprocess.run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
subprocess.run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
check=True, capture_output=True)
|
||||
import json
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
vanilla_server = ['java', '-Xmx2g', '-Duser.timezone=UTC', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', lab.LOCAL / 'horizon-client/26.3', '--dedicated', '--nogui']
|
||||
client = ['java', '-Xmx1g', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.KnockbackClient']
|
||||
|
||||
@@ -118,12 +118,12 @@ def main():
|
||||
subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none', '-nowarn', '-sourcepath',
|
||||
lab.ROOT / 'mods/horizon/src/test/java', '-cp', dependencies, '-d', classes, oracle],
|
||||
cwd=lab.ROOT, check=True, capture_output=True)
|
||||
subprocess.run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
subprocess.run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
check=True, capture_output=True)
|
||||
import json
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
vanilla_server = ['java', '-Xmx2g', '-Duser.timezone=UTC', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', lab.LOCAL / 'horizon-client/26.3', '--dedicated', '--nogui']
|
||||
client = ['java', '-Xmx1g', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.LocatorBarClient']
|
||||
|
||||
@@ -8,6 +8,7 @@ hosts: the guest always uses the server-player path.
|
||||
import json
|
||||
import math
|
||||
import subprocess
|
||||
import threading
|
||||
|
||||
import lab
|
||||
import lan_e2e as lan
|
||||
@@ -43,17 +44,29 @@ def check_walk(host, guest, out, role):
|
||||
until(host, lambda: phase(host), lambda s: 'sculk_sensor_phase=inactive' in s)
|
||||
player.wait(10)
|
||||
assert 'sculk_sensor_phase=inactive' in phase(host), 'setup activated the sensor'
|
||||
player.raw('key', 'w', 'down')
|
||||
# The sensor stays active 30 ticks. Each client samples it every tick from inside one ctl script, so a
|
||||
# runner that answers control requests slowly (frames drawn on the CPU) can't miss that window between
|
||||
# separate requests; the other client samples alongside the walk.
|
||||
probe = f'getblock {sensor[0]} {sensor[1]} {sensor[2]}'
|
||||
other = guest if player is host else host
|
||||
seen = {}
|
||||
|
||||
def watch(viewer, lines):
|
||||
seen[viewer.name] = [r['block'] for r in viewer.script(lines, every=True) if 'block' in r]
|
||||
watcher = threading.Thread(target=watch, args=(other, ['wait 1', probe] * 100))
|
||||
watcher.start()
|
||||
try:
|
||||
player.wait(15)
|
||||
watch(player, ['key w down', *['wait 1', probe] * 15, 'key w up', *['wait 1', probe] * 85])
|
||||
finally:
|
||||
player.raw('key', 'w', 'up')
|
||||
watcher.join()
|
||||
moved = {'client': math.dist(lan.pos_of(player), start),
|
||||
'server': math.dist(lan.server_player(host, player)['position'], start)}
|
||||
assert all(d > 1 for d in moved.values()), moved
|
||||
for viewer in (host, guest):
|
||||
until(viewer, lambda: phase(viewer), lambda s: 'sculk_sensor_phase=active' in s, ticks=85)
|
||||
return {'moved': moved, 'phase': phase(host)}
|
||||
active = {name: next((i for i, s in enumerate(states) if 'sculk_sensor_phase=active' in s), None)
|
||||
for name, states in seen.items()}
|
||||
assert len(active) == 2 and all(i is not None for i in active.values()), f'sensor never active: {seen}'
|
||||
return {'moved': moved, 'first_active_sample': active}
|
||||
finally:
|
||||
player.raw('key', 'w', 'up')
|
||||
host('command', command=f'fill {x - 2} {y} {z - 2} {x + 5} {y + 3} {z + 5} minecraft:air')
|
||||
|
||||
@@ -169,12 +169,12 @@ def main():
|
||||
subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none', '-nowarn', '-sourcepath',
|
||||
lab.ROOT / 'mods/horizon/src/test/java', '-cp', dependencies, '-d', classes, oracle],
|
||||
cwd=lab.ROOT, check=True, capture_output=True)
|
||||
subprocess.run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
subprocess.run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
check=True, capture_output=True)
|
||||
import json
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
vanilla_server = ['java', '-Xmx2g', '-Duser.timezone=UTC', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', lab.LOCAL / 'horizon-client/26.3', '--dedicated', '--nogui']
|
||||
client = ['java', '-Xmx1g', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.LocatorBarClient']
|
||||
|
||||
@@ -134,9 +134,9 @@ def main():
|
||||
subprocess.run(['javac', '--release', str(lock['minecraft']['java_major']), '-proc:none', '-nowarn', '-sourcepath',
|
||||
lab.ROOT / 'mods/horizon/src/test/java', '-cp', dependencies, '-d', classes, oracle],
|
||||
cwd=lab.ROOT, check=True, capture_output=True)
|
||||
subprocess.run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
subprocess.run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
check=True, capture_output=True)
|
||||
binary = lab.cargo_target() / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = lab.cargo_target() / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
vanilla_server = ['java', '-Xmx2g', '-Duser.timezone=UTC', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', lab.LOCAL / 'horizon-client/26.3', '--dedicated', '--nogui']
|
||||
client = ['java', '-Xmx1g', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.ServerPackClient']
|
||||
|
||||
@@ -130,11 +130,11 @@ def main():
|
||||
build.mkdir(parents=True, exist_ok=True)
|
||||
report = build / 'report.json'
|
||||
report.unlink(missing_ok=True)
|
||||
subprocess.run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
subprocess.run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
check=True, capture_output=True)
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
dependencies = os.pathsep.join(map(str, [jars['server'], *libraries]))
|
||||
vanilla_server = ['java', '-Xmx2g', '-Duser.timezone=UTC', '-cp', dependencies, 'net.minecraft.server.Main',
|
||||
'nogui']
|
||||
|
||||
@@ -155,9 +155,9 @@ def main():
|
||||
'-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java')
|
||||
run(['java', '-Xmx2G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]),
|
||||
'dev.horizonlab.parity.VanillaSpawnRulesOracle', inputs, build / 'server.txt'], 'server')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples/client_probe'
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples/client_probe'
|
||||
run([binary, 'spawn_rules_fixture', resources, inputs, build / 'rust.txt'], 'rust')
|
||||
vanilla = (build / 'server.txt').read_text().splitlines()
|
||||
errors = [l for l in vanilla if ' error ' in l]
|
||||
|
||||
@@ -249,9 +249,9 @@ def main():
|
||||
'-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java')
|
||||
run(['java', '-Xmx3G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]),
|
||||
'dev.horizonlab.parity.VanillaNaturalSpawnOracle', inputs, build / 'server.txt'], 'server')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples/client_probe'
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples/client_probe'
|
||||
run([binary, 'natural_spawn_fixture', resources, inputs, build / 'rust.txt'], 'rust')
|
||||
vanilla = (build / 'server.txt').read_text().splitlines()
|
||||
errors = [l for l in vanilla if ' error ' in l]
|
||||
|
||||
@@ -133,9 +133,9 @@ def main():
|
||||
*(PARITY / f'{n}.java' for n in ('ParityFont', 'VanillaSubtitleOracle'))], 'compile-java')
|
||||
run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaSubtitleOracle',
|
||||
inputs, build / 'vanilla.jsonl'], 'vanilla')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe')
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe')
|
||||
run([binary, 'subtitle_fixture',resources, inputs, build / 'rust.jsonl'], 'rust')
|
||||
vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text(encoding='utf-8').splitlines()]
|
||||
rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text(encoding='utf-8').splitlines()]
|
||||
|
||||
@@ -84,9 +84,9 @@ def main():
|
||||
PARITY / 'VanillaTeamRulesOracle.java'], 'compile-java')
|
||||
run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaTeamRulesOracle',
|
||||
inputs, build / 'vanilla.jsonl'], 'vanilla')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe')
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples' / ('client_probe.exe' if os.name=='nt' else 'client_probe')
|
||||
run([binary, 'team_rules_fixture',inputs, build / 'rust.jsonl'], 'rust')
|
||||
vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text().splitlines()]
|
||||
rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text().splitlines()]
|
||||
|
||||
@@ -219,8 +219,8 @@ def main():
|
||||
if args.java_only:
|
||||
print(f'{len(vanilla)} oracle lines')
|
||||
return
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
binary = lab.cargo_target() / 'release/examples/client_probe'
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
binary = lab.cargo_target() / 'fast/examples/client_probe'
|
||||
run([binary, 'trading_fixture', resources, inputs, build / 'server.txt', build / 'rust.txt'], 'rust')
|
||||
rust = (build / 'rust.txt').read_text().splitlines()
|
||||
bad = [(a, b) for a, b in zip(vanilla, rust) if a != b]
|
||||
|
||||
@@ -214,9 +214,9 @@ def main():
|
||||
'-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java')
|
||||
run(['java', '-Xmx3G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]),
|
||||
'dev.horizonlab.parity.VanillaNaturalSpawnOracle', inputs, build / 'server.txt'], 'server')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples/client_probe'
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples/client_probe'
|
||||
run([binary, 'natural_spawn_fixture', resources, inputs, build / 'rust.txt'], 'rust')
|
||||
vanilla = (build / 'server.txt').read_text().splitlines()
|
||||
errors = [l for l in vanilla if ' error ' in l]
|
||||
|
||||
@@ -405,9 +405,9 @@ def main():
|
||||
'-cp', dependencies, '-d', str(classes), str(java_root / 'dev/horizonlab/parity/VanillaDispenserOracle.java')])
|
||||
d.run(['java', '-Xmx3G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaDispenserOracle',
|
||||
str(resources), str(work / 'cases.jsonl'), str(work / 'native.txt')])
|
||||
d.run(['cargo', 'build', '-q', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
d.run(['cargo', 'build', '-q', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
env={**os.environ, 'CARGO_BUILD_JOBS': os.environ.get('CARGO_BUILD_JOBS', '3')})
|
||||
d.run([str(lab.cargo_target() / 'release/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
d.run([str(lab.cargo_target() / 'fast/horizon-client'), '--resources', str(resources)], cwd=work,
|
||||
env=lab.game_env(HORIZON_DISPENSE_FIXTURE=f'{work / "cases.jsonl"},{work / "rust.txt"}'))
|
||||
ignore = tuple(prefix + ' ' for prefix in args.ignore.split(',') if prefix) + ('D ',)
|
||||
native = h.split_cases((work / 'native.txt').read_text(), ignore)
|
||||
|
||||
@@ -205,11 +205,11 @@ def main():
|
||||
build.mkdir(parents=True, exist_ok=True)
|
||||
report = build / 'report.json'
|
||||
report.unlink(missing_ok=True)
|
||||
subprocess.run(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
subprocess.run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], cwd=lab.ROOT,
|
||||
check=True, capture_output=True)
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = Path(metadata['target_directory']) / 'fast' / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
services = Services()
|
||||
discovery = services.url + '/minecraft/client'
|
||||
dependencies = os.pathsep.join(map(str, [jars['server'], *libraries]))
|
||||
|
||||
@@ -190,9 +190,9 @@ def main():
|
||||
'-cp', str(jars['server']) + os.pathsep + deps, '-d', classes, oracle], 'compile-java')
|
||||
run(['java', '-Xmx3G', '-cp', os.pathsep.join([str(classes), str(jars['server']), deps]),
|
||||
'dev.horizonlab.parity.VanillaNaturalSpawnOracle', inputs, build / 'server.txt'], 'server')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--example', 'client_probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata['target_directory']) / 'release/examples/client_probe'
|
||||
binary = Path(metadata['target_directory']) / 'fast/examples/client_probe'
|
||||
run([binary, 'natural_spawn_fixture', resources, inputs, build / 'rust.txt'], 'rust')
|
||||
vanilla = (build / 'server.txt').read_text().splitlines()
|
||||
errors = [l for l in vanilla if ' error ' in l]
|
||||
|
||||
@@ -68,14 +68,23 @@ def main():
|
||||
return json.loads(result.stdout) if result.stdout.strip().startswith('{') else result.stdout
|
||||
|
||||
def carts():
|
||||
found = ctl('status')['carts']
|
||||
return sorted((c['kind'], *(round(v, 1) for v in c['position'])) for c in found)
|
||||
"""The loaded minecarts once their list stops changing: on a loaded runner the mineshaft's chunks and their
|
||||
entities keep arriving after the world counts as loaded, so one reading can be short of a cart."""
|
||||
last = None
|
||||
for _ in range(30):
|
||||
found = sorted((c['kind'], *(round(v, 1) for v in c['position'])) for c in ctl('status')['carts'])
|
||||
if found == last:
|
||||
return found
|
||||
last = found
|
||||
ctl('wait', '40')
|
||||
return last
|
||||
|
||||
ctl('launch', '--resources', str(RESOURCES), '--world', 'reopen', '--seed', '7', '--creative',
|
||||
'--render-distance', '4', *extra)
|
||||
failures = 0
|
||||
try:
|
||||
ctl('wait-ready', '300')
|
||||
ctl('wait-for', 'loaded', '--timeout', '300') # as after each reopen below
|
||||
ctl('command', 'summon minecraft:minecart ~2 ~ ~2')
|
||||
ctl('wait', '20')
|
||||
expected = carts()
|
||||
|
||||
@@ -69,10 +69,10 @@ def seeds(count):
|
||||
return SEEDS + [rng.randrange(-2**63, 2**63) for _ in range(count)]
|
||||
|
||||
|
||||
def target_dir():
|
||||
def target_dir(profile='release'):
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'],
|
||||
cwd=lab.ROOT, text=True))
|
||||
return Path(metadata['target_directory']) / 'release'
|
||||
return Path(metadata['target_directory']) / profile
|
||||
|
||||
|
||||
def origins(build, classes, dependencies, all_seeds):
|
||||
@@ -134,9 +134,9 @@ def main():
|
||||
if args.origins_only:
|
||||
sys.exit(1 if origin_diffs else 0)
|
||||
|
||||
oh.run_logged(['cargo', 'build', '--release', '-p', 'horizon-client', '--bin', 'horizon-client'], build,
|
||||
oh.run_logged(['cargo', 'build', '--profile', 'fast', '-p', 'horizon-client', '--bin', 'horizon-client'], build,
|
||||
'compile-rust', timeout=3600)
|
||||
binary = target_dir() / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
binary = target_dir('fast') / ('horizon-client.exe' if os.name == 'nt' else 'horizon-client')
|
||||
# One worker thread: the chunks decorated in a fixed order (see above).
|
||||
vanilla_server = ['java', '-Xmx2g', '-Dmax.bg.threads=1', '-cp', dependencies, 'net.minecraft.server.Main', 'nogui']
|
||||
horizon_server = [binary, '--resources', RESOURCES, '--dedicated', '--nogui']
|
||||
|
||||
Reference in New Issue
Block a user