Merge remote-tracking branch 'origin/fix/st-player-body' into fix/st-hits
This commit is contained in:
@@ -37,7 +37,7 @@ def require_sounds():
|
||||
|
||||
|
||||
def run_harness(name, oracle, example, inputs_text, extra_sources=(), java_args=(), rust_args=(), scope='', timeout=1800):
|
||||
"""Run oracle and example on inputs; returns the number of matched lines."""
|
||||
"""Run oracle and the client probe `example` on inputs; returns the number of matched lines."""
|
||||
require_sounds()
|
||||
lock, jars, _ = base.verify_artifacts()
|
||||
libraries = baking.client_libraries()
|
||||
@@ -46,7 +46,7 @@ def run_harness(name, oracle, example, inputs_text, extra_sources=(), java_args=
|
||||
report = build / 'report.json'
|
||||
report.unlink(missing_ok=True)
|
||||
oracle_path = lab.ROOT / f'mods/horizon/src/test/java/dev/horizonlab/parity/{oracle}.java'
|
||||
example_path = lab.ROOT / f'crates/horizon-client/examples/{example}.rs'
|
||||
example_path = lab.ROOT / f'crates/horizon-client/examples/probe/{example}.rs'
|
||||
sources = [*COMMON_SOURCES, oracle_path, example_path, *[Path(s) for s in extra_sources]]
|
||||
tested = base.source_hashes(sources)
|
||||
inputs = build / 'inputs.txt'
|
||||
@@ -65,10 +65,10 @@ def run_harness(name, oracle, example, inputs_text, extra_sources=(), java_args=
|
||||
dependencies = os.pathsep.join(map(str, [jars['client'], *libraries]))
|
||||
run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-sourcepath', lab.ROOT / 'mods/horizon/src/test/java',
|
||||
'-cp', dependencies, '-d', classes, oracle_path], 'compile-java')
|
||||
run(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', example], 'compile-rust')
|
||||
run(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT))
|
||||
binary = Path(metadata['target_directory']) / 'debug/examples' / (example + ('.exe' if os.name == 'nt' else ''))
|
||||
run([binary, *rust_args, inputs, build / 'rust.txt'], 'rust')
|
||||
binary = Path(metadata['target_directory']) / 'debug/examples' / ('probe.exe' if os.name == 'nt' else 'probe')
|
||||
run([binary, example, *rust_args, inputs, build / 'rust.txt'], 'rust')
|
||||
env = dict(os.environ, ALSOFT_DRIVERS='null')
|
||||
run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, f'dev.horizonlab.parity.{oracle}', *java_args, inputs, build / 'client.txt'],
|
||||
'client', env=env)
|
||||
|
||||
@@ -133,8 +133,8 @@ def execute(name, cases, args, facts, origin_of=None):
|
||||
'-cp', dependencies, '-d', str(classes), str(java_root / 'dev/horizonlab/parity/VanillaBlockUpdateOracle.java')])
|
||||
run(['java', '-Xmx2G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaBlockUpdateOracle',
|
||||
str(resources), str(work / 'cases.jsonl'), str(work / 'native.txt')])
|
||||
run(['cargo', 'run', '-q', '--release', '-p', 'horizon-world', '--example', 'block_update_fixture', '--',
|
||||
str(resources), str(work / 'cases.jsonl'), str(work / 'rust.txt')], cwd=lab.ROOT, env={**os.environ, 'CARGO_BUILD_JOBS': '3'})
|
||||
run(['cargo', 'run', '-q', '--release', '-p', 'horizon-world', '--example', 'probe', '--',
|
||||
'block_update_fixture', str(resources), str(work / 'cases.jsonl'), str(work / 'rust.txt')], cwd=lab.ROOT, env={**os.environ, 'CARGO_BUILD_JOBS': '3'})
|
||||
ignore = tuple(prefix + ' ' for prefix in args.ignore.split(',') if prefix)
|
||||
native = split_cases((work / 'native.txt').read_text(), ignore)
|
||||
rust = split_cases((work / 'rust.txt').read_text(), ignore)
|
||||
|
||||
@@ -50,7 +50,7 @@ def cargo_example(package, example, *args, profile=None):
|
||||
command = ['cargo', 'run', '-q', '-j3']
|
||||
if profile:
|
||||
command += ['--profile', profile]
|
||||
command += ['-p', package, '--example', example, '--', *map(str, args)]
|
||||
command += ['-p', package, '--example', 'probe', '--', example, *map(str, args)]
|
||||
subprocess.run(command, check=True, cwd=lab.ROOT)
|
||||
|
||||
|
||||
|
||||
+158
-5
@@ -68,6 +68,9 @@ address. The script then checks, from both sides, what a guest's game used to ge
|
||||
- feedback: the guest's command feedback names the guest and shows the numbers;
|
||||
- chat: a line the host sends reaches the guest's event log (`wait-for chat`), and on the
|
||||
server thread the host window's too;
|
||||
- styles: a styled tellraw reaches the host and the guest (each its own) with its colour, bold, click and hover
|
||||
events; each player's /give tells them of the Diamonds! advancement before the give's
|
||||
own message, and never echoes their command back to them as `[Name: ...]`;
|
||||
- effects: a beacon's power reaches every player in range, the host and the guest;
|
||||
- distance: (--server-thread) the server follows the host's render distance, past vanilla's 32 too
|
||||
(IntegratedServer.tickServer), and the guest's chunks follow the server's (#804)
|
||||
@@ -142,6 +145,11 @@ address. The script then checks, from both sides, what a guest's game used to ge
|
||||
it (#1222).
|
||||
- frames: the host and the guest each put a diamond in an item frame and turn it, and put a
|
||||
helmet on an armor stand and take it back (#1222).
|
||||
- hands: the host and the guest each, at a cow that cares for none of it: draw a bow and shoot, and
|
||||
let go of a golden apple at once without eating it (the click goes on to the item);
|
||||
milk the cow with a bucket in the off hand and feed it wheat from the off hand; and
|
||||
punch the diamond out of an item frame, which then shows empty on both sides (#1350,
|
||||
#1355, #1362).
|
||||
- mounts: the host and the guest each open a tamed horse's, donkey's and llama's inventory
|
||||
(shift + right click, then the inventory key while riding), put on a saddle, armour
|
||||
or a carpet and fill the chest by shift-clicking.
|
||||
@@ -247,7 +255,7 @@ ROOT = Path(__file__).resolve().parents[1]
|
||||
GUEST_NAME = 'Guest'
|
||||
# The host plays single player on its server thread (--server-thread).
|
||||
SERVER_THREAD = False
|
||||
CHECKS = ['tab', 'self', 'armour', 'nametags', 'walls', 'chest', 'crafting', 'sign', 'damage', 'mobs', 'hazards', 'pvp', 'arrows', 'kills', 'hurt', 'looks', 'leads', 'respawn', 'containers', 'feedback', 'titles', 'chat', 'commands', 'recipes', 'machines', 'brewing', 'loom', 'stonecutter', 'grindstone', 'anvil', 'smithing', 'enchanting', 'beacon', 'crafter', 'lectern', 'cartography', 'trials', 'clicks', 'sleep', 'predict', 'push', 'eat', 'eating', 'xp', 'objects', 'projectiles', 'thrown', 'sparks', 'hud', 'sidebar', 'border', 'particles', 'worn', 'blast', 'barter', 'deflect', 'fireball', 'light', 'time', 'swings', 'cracks', 'plates', 'effects', 'portals', 'distance', 'growth', 'flight', 'ladder', 'boats', 'minecarts', 'frames', 'lightning', 'riding', 'mounts', 'worldspawn', 'beds', 'shield', 'deathmining', 'contacts', 'absorption', 'breath', 'lava', 'levels', 'drops', 'underwater']
|
||||
CHECKS = ['tab', 'self', 'armour', 'nametags', 'walls', 'chest', 'crafting', 'sign', 'damage', 'mobs', 'hazards', 'pvp', 'arrows', 'kills', 'hurt', 'looks', 'leads', 'respawn', 'containers', 'feedback', 'titles', 'chat', 'styles', 'commands', 'recipes', 'machines', 'brewing', 'loom', 'stonecutter', 'grindstone', 'anvil', 'smithing', 'enchanting', 'beacon', 'crafter', 'lectern', 'cartography', 'trials', 'clicks', 'sleep', 'predict', 'push', 'eat', 'eating', 'xp', 'objects', 'projectiles', 'thrown', 'sparks', 'hud', 'sidebar', 'border', 'particles', 'worn', 'blast', 'barter', 'deflect', 'fireball', 'light', 'time', 'swings', 'cracks', 'plates', 'effects', 'portals', 'distance', 'growth', 'flight', 'ladder', 'boats', 'minecarts', 'frames', 'hands', 'lightning', 'riding', 'mounts', 'worldspawn', 'beds', 'shield', 'deathmining', 'contacts', 'absorption', 'breath', 'lava', 'levels', 'drops', 'underwater']
|
||||
|
||||
|
||||
class Game:
|
||||
@@ -1488,8 +1496,8 @@ def check_loom(host, guest, out):
|
||||
|
||||
def own_reply(event):
|
||||
"""A chat event that answers the guest's own command. On the server thread the guest also gets
|
||||
its own command's `[Guest: ...]` operator broadcast, a moment later, which an answer to the next
|
||||
command must not be taken for."""
|
||||
its own command's `[Guest: ...]` operator broadcast before #1373, a moment later, which an answer
|
||||
to the next command must not be taken for."""
|
||||
return event.get('event') == 'chat' and not event.get('text', '').startswith(f'[{GUEST_NAME}: ')
|
||||
|
||||
|
||||
@@ -2054,6 +2062,69 @@ def check_chat(host, guest, out):
|
||||
return seen
|
||||
|
||||
|
||||
def styled_parts(component):
|
||||
"""Every component in a chat line's tree (the line, its `extra` and `with` parts)."""
|
||||
if isinstance(component, dict):
|
||||
yield component
|
||||
for key in ('extra', 'with'):
|
||||
for part in component.get(key) or []:
|
||||
yield from styled_parts(part)
|
||||
elif isinstance(component, list):
|
||||
for part in component:
|
||||
yield from styled_parts(part)
|
||||
|
||||
|
||||
def check_styles(host, guest, out):
|
||||
# ChatComponent keeps what the server sent: the style, the click and the hover event.
|
||||
stamp = f'STYLE {int(time.time())}'
|
||||
line = {'text': stamp, 'color': 'green', 'bold': True,
|
||||
'click_event': {'action': 'suggest_command', 'command': '/say clicked'},
|
||||
'hover_event': {'action': 'show_text', 'value': 'Tip'}}
|
||||
seen = {}
|
||||
for g in (host, guest):
|
||||
# Each to itself: tellraw reaches only the player whose command it is here.
|
||||
since = g.raw('events')['last']
|
||||
g('command', command='tellraw @s ' + json.dumps(line))
|
||||
g.raw('wait-for', 'chat', stamp, '--timeout', 10, '--since', since)
|
||||
part = next((p for c in g.raw('messages', 10)['styled'] for p in styled_parts(c)
|
||||
if stamp in str(p.get('text', ''))), None) or {}
|
||||
seen[g.name] = {k: part.get(k) for k in ('color', 'bold', 'click_event', 'hover_event')}
|
||||
hover = seen[g.name]['hover_event'] or {}
|
||||
seen[g.name]['hover_event'] = [hover.get('action'), 'Tip' in str(hover.get('value'))]
|
||||
# InventoryChangeTrigger fires inside /give, before its message; the operator echo
|
||||
# (broadcastToAdmins) skips the player whose command it was.
|
||||
order = {}
|
||||
for g in (host, guest):
|
||||
for command in ('advancement revoke @s everything', 'clear @s'):
|
||||
g('command', command=command)
|
||||
g.wait(5)
|
||||
since = g.raw('events')['last']
|
||||
g('command', command='give @s minecraft:diamond')
|
||||
g.raw('wait-for', 'chat', 'Diamonds!', '--timeout', 10, '--since', since)
|
||||
g.wait(20)
|
||||
chat = g.raw('messages', 8)['chat']
|
||||
name = GUEST_NAME if g is guest else host.player
|
||||
gave = next((i for i, l in enumerate(chat) if l.startswith('Gave 1 [Diamond]')), None)
|
||||
made = next((i for i, l in enumerate(chat) if '[Diamonds!]' in l), None)
|
||||
echo = [l for l in chat if l.startswith(f'[{name}: ')]
|
||||
# Newest first: the give's message is newer than the advancement's.
|
||||
order[g.name] = {'gave': gave, 'advancement': made, 'echo': echo}
|
||||
guest.raw('key', 't', 'tap')
|
||||
guest.wait(5)
|
||||
guest.shot(out, 'styles')
|
||||
guest.raw('key', 'esc', 'tap')
|
||||
want = {'color': 'green', 'bold': True,
|
||||
'click_event': {'action': 'suggest_command', 'command': '/say clicked'},
|
||||
'hover_event': ['show_text', True]}
|
||||
for name, got in seen.items():
|
||||
assert got == want, f'{name} styled line: {got}'
|
||||
for name, o in order.items():
|
||||
assert o['gave'] is not None and o['advancement'] is not None, f'{name} chat: {o}'
|
||||
assert o['gave'] < o['advancement'], f'{name}: the give came before the advancement: {o}'
|
||||
assert not o['echo'], f'{name} heard its own command: {o}'
|
||||
return {'styles': seen, 'order': order}
|
||||
|
||||
|
||||
def png_rows(path):
|
||||
"""The rows of an 8-bit RGB or RGBA PNG, unfiltered, as bytes of 4 (or 3) per pixel."""
|
||||
data = Path(path).read_bytes()
|
||||
@@ -3707,6 +3778,88 @@ def check_frames(host, guest, out):
|
||||
return result
|
||||
|
||||
|
||||
def check_hands(host, guest, out):
|
||||
"""#1350, #1355, #1362: right clicks a cow passes go on to the item, the off hand gets its
|
||||
turn on the cow, and a frame punched empty is empty for everyone."""
|
||||
result = {}
|
||||
spots = apart(host, guest)
|
||||
for label, player, other in (('host', host, guest), ('guest', guest, host)):
|
||||
x, y, z = spots[label]
|
||||
player('command', command='gamemode survival')
|
||||
player('command', command='clear @s')
|
||||
player('command', command='effect clear @s')
|
||||
# A cow two blocks ahead that stays put, and a framed diamond on a wall behind the player.
|
||||
player('command', command=f'summon minecraft:cow {x + 0.5} {y} {z + 3.5} {{NoAI:1b}}')
|
||||
player('command', command=f'fill {x - 1} {y} {z - 2} {x + 1} {y + 2} {z - 2} minecraft:stone')
|
||||
player('command', command=f'summon minecraft:item_frame {x + 0.5} {y + 1.5} {z - 0.97} '
|
||||
f'{{block_pos:[I;{x},{y + 1},{z - 1}],Facing:3b,Item:{{id:"minecraft:diamond",count:1}}}}')
|
||||
player.wait(20)
|
||||
counts = lambda: player('inventory')['counts']
|
||||
aim_cow = lambda: player.raw('look-at', f'{x + 0.5:.2f}', f'{y + 0.8:.2f}', f'{z + 3.5:.2f}')
|
||||
try:
|
||||
player('command', command='give @s minecraft:bow')
|
||||
player('command', command='give @s minecraft:arrow 6')
|
||||
player.wait(5)
|
||||
player.raw('select', 'minecraft:bow')
|
||||
aim_cow()
|
||||
assert player('looking_at')['kind'] == 'entity', f'the {label} does not aim at the cow'
|
||||
# Half drawn: a full draw is a crit, up to 10 damage (AbstractArrow.onHitEntity), which
|
||||
# kills the 10 health cow one shot in five. Under 20 ticks the arrow does at most 6.
|
||||
player.raw('mouse', 'right', 'down')
|
||||
player.wait(10)
|
||||
drawn = player('state')['using']
|
||||
player.raw('mouse', 'right', 'up')
|
||||
player.wait(20)
|
||||
assert drawn, f'the {label}\'s bow is not drawn at the cow'
|
||||
assert counts().get('minecraft:arrow') == 5, f'the {label} shot no arrow: {counts()}'
|
||||
aim_cow()
|
||||
cow = player('looking_at').get('entity') or {}
|
||||
assert cow.get('health', 0) > 0, f'the {label}\'s arrow killed the cow: {cow}'
|
||||
player('command', command='clear @s')
|
||||
player('command', command='give @s minecraft:golden_apple')
|
||||
player.wait(5)
|
||||
player.raw('select', 'minecraft:golden_apple')
|
||||
aim_cow()
|
||||
player.raw('mouse', 'right', 'down')
|
||||
player.wait(5)
|
||||
player.raw('mouse', 'right', 'up')
|
||||
player.wait(40)
|
||||
assert counts().get('minecraft:golden_apple') == 1, f'the {label} ate the apple let go of: {counts()}'
|
||||
# The main hand empty, a bucket and then wheat in the off hand.
|
||||
player('command', command='clear @s')
|
||||
player('command', command='item replace entity @s weapon.offhand with minecraft:bucket')
|
||||
player.wait(5)
|
||||
aim_cow()
|
||||
player.raw('mouse', 'right', 'click')
|
||||
player.wait(15)
|
||||
offhand = player('inventory')['offhand']
|
||||
assert offhand and offhand['item'] == 'minecraft:milk_bucket', f'the {label}\'s off hand holds {offhand}'
|
||||
player('command', command='item replace entity @s weapon.offhand with minecraft:wheat 3')
|
||||
player.wait(5)
|
||||
aim_cow()
|
||||
player.raw('mouse', 'right', 'click')
|
||||
player.wait(15)
|
||||
offhand = player('inventory')['offhand']
|
||||
assert offhand and offhand['count'] == 2, f'the {label}\'s cow ate no off hand wheat: {offhand}'
|
||||
# The framed diamond, punched out.
|
||||
frame = [o for o in player('status')['objects'] if o['kind'].endswith('item_frame')
|
||||
and o['position'] == [x, y + 1, z - 1]]
|
||||
assert frame and frame[0]['item'] == 'minecraft:diamond', f'the {label} sees the frame as {frame}'
|
||||
player.raw('look-at', f'{x + 0.5:.2f}', f'{y + 1.5:.2f}', f'{z - 0.95:.2f}')
|
||||
player.raw('mouse', 'left', 'click')
|
||||
player.wait(20)
|
||||
for side, game in ((label, player), ('other side', other)):
|
||||
seen = [o for o in game('status')['objects'] if o['kind'].endswith('item_frame')
|
||||
and o['position'] == [x, y + 1, z - 1]]
|
||||
assert seen and seen[0].get('item') is None, f'the {side} sees the punched frame as {seen}'
|
||||
result[label] = {'bow': 'shot', 'apple': 'kept', 'off hand': 'milked, fed', 'frame': 'emptied'}
|
||||
finally:
|
||||
player('command', command=f'kill @e[type=!minecraft:player,x={x - 3},y={y - 1},z={z - 3},dx=6,dy=4,dz=8]')
|
||||
player('command', command=f'fill {x - 1} {y} {z - 2} {x + 1} {y + 2} {z - 2} minecraft:air')
|
||||
player('command', command='clear @s')
|
||||
return result
|
||||
|
||||
|
||||
# Animals a player rides: (kind, summon NBT, what readies it, what is held to ride, the test
|
||||
# while riding). `move` walks forward, `jump` charges the horse's jump bar, `rise` holds jump on
|
||||
# a happy ghast, `sit` only rides (a llama goes where it likes).
|
||||
@@ -4247,7 +4400,7 @@ CHECK_FNS = {'tab': check_tab, 'self': check_self, 'armour': check_armour,
|
||||
'sign': check_sign, 'damage': check_damage, 'mobs': check_mobs,
|
||||
'hazards': check_hazards, 'pvp': check_pvp, 'respawn': check_respawn,
|
||||
'containers': check_containers, 'feedback': check_feedback, 'titles': check_titles,
|
||||
'chat': check_chat, 'machines': check_machines, 'brewing': check_brewing,
|
||||
'chat': check_chat, 'styles': check_styles, 'machines': check_machines, 'brewing': check_brewing,
|
||||
'loom': check_loom, 'stonecutter': check_stonecutter, 'grindstone': check_grindstone,
|
||||
'anvil': check_anvil, 'smithing': check_smithing, 'enchanting': check_enchanting,
|
||||
'beacon': check_beacon, 'crafter': check_crafter, 'lectern': check_lectern,
|
||||
@@ -4262,7 +4415,7 @@ CHECK_FNS = {'tab': check_tab, 'self': check_self, 'armour': check_armour,
|
||||
'flight': check_flight, 'fireball': check_fireball, 'deflect': check_deflect,
|
||||
'barter': check_barter, 'worn': check_worn, 'kills': check_kills,
|
||||
'arrows': check_arrows, 'predict': check_predict, 'ladder': check_ladder,
|
||||
'boats': check_boats, 'minecarts': check_minecarts, 'frames': check_frames,
|
||||
'boats': check_boats, 'minecarts': check_minecarts, 'frames': check_frames, 'hands': check_hands,
|
||||
'lightning': check_lightning, 'riding': check_riding, 'mounts': check_mounts,
|
||||
'worldspawn': check_world_spawn, 'beds': check_beds, 'shield': check_shield, 'deathmining': check_death_mining,
|
||||
'contacts': check_contacts, 'absorption': check_absorption, 'breath': check_breath,
|
||||
|
||||
@@ -31,12 +31,13 @@ def compile_oracle(build, oracle_name, jars, libraries, java_major):
|
||||
|
||||
|
||||
def build_probe(build, example):
|
||||
run_logged(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', example],
|
||||
"""Build the horizon-client probe binary; returns the command that runs probe `example`."""
|
||||
run_logged(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'probe'],
|
||||
build, 'compile-rust-' + example, env=dict(os.environ, CARGO_BUILD_JOBS='3'))
|
||||
import json
|
||||
metadata = json.loads(subprocess.check_output(
|
||||
['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT))
|
||||
return Path(metadata['target_directory']) / 'debug/examples' / example
|
||||
return [Path(metadata['target_directory']) / 'debug/examples/probe', example]
|
||||
|
||||
|
||||
def java_run(build, classes, dependencies, main_class, args, name, jvm=()):
|
||||
@@ -64,13 +65,13 @@ def differential(name, oracle, probe, make_input, scope, sources=(), expected_li
|
||||
all_sources = [Path(__file__).resolve(), lab.ROOT / 'tools/oracle_harness.py', lab.ROOT / 'tools/test_rust_parity.py',
|
||||
lab.ROOT / 'tools/lab.py', oracle_path, lab.ROOT / 'Cargo.toml', lab.ROOT / 'Cargo.lock',
|
||||
lab.ROOT / 'crates/horizon-client/Cargo.toml', lab.ROOT / 'crates/horizon-client/src/lib.rs',
|
||||
lab.ROOT / f'crates/horizon-client/examples/{probe}.rs', *map(Path, sources)]
|
||||
lab.ROOT / f'crates/horizon-client/examples/probe/{probe}.rs', *map(Path, sources)]
|
||||
tested = base.source_hashes(all_sources)
|
||||
input_path, units = make_input(build)
|
||||
input_hash = lab.digest(input_path, 'sha256') if input_path.is_file() else None
|
||||
classes, dependencies, _ = compile_oracle(build, oracle, jars, libraries, lock['minecraft']['java_major'])
|
||||
binary = build_probe(build, probe)
|
||||
run_logged([binary, input_path, build / 'rust.txt'], build, 'rust')
|
||||
command = build_probe(build, probe)
|
||||
run_logged([*command, input_path, build / 'rust.txt'], build, 'rust')
|
||||
java_run(build, classes, dependencies, oracle, [input_path, build / 'client.txt'], 'client')
|
||||
try:
|
||||
matched = base.compare(build / 'client.txt', build / 'rust.txt')
|
||||
|
||||
+50
-3
@@ -65,6 +65,7 @@ SHARED = Path(os.environ.get("PARITY_SHARED") or (LOCAL / "minecraft").resolve()
|
||||
MACHINE_JOBS = int(os.environ.get("PARITY_MACHINE_JOBS") or max(1, (os.cpu_count() or 4) // 2))
|
||||
HOST = socket.gethostname().split(".")[0]
|
||||
DEFAULT_MEMORY = 3 << 30 # assumed peak for a harness that never ran here
|
||||
FAILURE_TAILS, FAILURE_TAIL_LINES = 10, 30 # the summary prints the end of the first failures' logs
|
||||
|
||||
|
||||
def harness_settings(path):
|
||||
@@ -464,6 +465,42 @@ def narrow_rust_sources(sources, scope):
|
||||
return sorted(kept), None
|
||||
|
||||
|
||||
PROBE_SOURCE = re.compile(r"/examples/probe/(?:(support)/)?(\w+)\.rs$")
|
||||
|
||||
|
||||
def probes_run(commands):
|
||||
"""The probes a harness ran through a crate's probe binary: `probe <name> ...`, or
|
||||
`cargo run --example probe -- <name> ...`."""
|
||||
names = set()
|
||||
for arguments in commands:
|
||||
program = Path(arguments[0]).name if arguments else ""
|
||||
if program in ("probe", "probe.exe") and len(arguments) > 1:
|
||||
names.add(arguments[1])
|
||||
elif program == "cargo" and "--" in arguments and "probe" in arguments[:arguments.index("--")] \
|
||||
and len(arguments) > arguments.index("--") + 1:
|
||||
names.add(arguments[arguments.index("--") + 1])
|
||||
return names
|
||||
|
||||
|
||||
def only_probes_run(paths, names):
|
||||
"""A probe binary's dep-info lists every probe in it. Keep those the harness ran, the probes they include! or
|
||||
name (crate::<probe>) and the shared support modules they name (support::<module>), so that editing one probe
|
||||
reruns only its own harnesses. Files in a probe's own subdirectory and dispatch.rs, which runs them, are always
|
||||
kept; main.rs, which only lists them, is left out, so adding a probe reruns nothing."""
|
||||
if not names:
|
||||
return paths
|
||||
names, used = {*names, "dispatch"}, ""
|
||||
while True:
|
||||
ran = [path for path in paths if (match := PROBE_SOURCE.search(path)) and not match.group(1) and match.group(2) in names]
|
||||
used = "".join((ROOT / path).read_text(encoding="utf-8", errors="replace") for path in ran)
|
||||
included = {*re.findall(r'include!\("(\w+)\.rs"\)', used), *re.findall(r"\bcrate::(\w+)", used)} - names
|
||||
if not included:
|
||||
break
|
||||
names |= included
|
||||
return [path for path in paths if not (match := PROBE_SOURCE.search(path))
|
||||
or (f"support::{match.group(2)}" in used if match.group(1) else match.group(2) in names)]
|
||||
|
||||
|
||||
def dependencies(trace, scope=None):
|
||||
"""Repository files a traced harness depended on, relative to ROOT, and the probes it built.
|
||||
|
||||
@@ -495,7 +532,8 @@ def dependencies(trace, scope=None):
|
||||
for artifact in artifacts:
|
||||
if artifact not in unique:
|
||||
unique.append(artifact)
|
||||
kept, note = narrow_rust_sources(sorted(kept), scope) if scope else (sorted(kept), None)
|
||||
kept = only_probes_run(sorted(kept), probes_run(trace["commands"]))
|
||||
kept, note = narrow_rust_sources(kept, scope) if scope else (kept, None)
|
||||
if note:
|
||||
print(f"note: PARITY_RUST_SCOPE not applied: {note}", flush=True)
|
||||
return kept, unique
|
||||
@@ -1324,8 +1362,17 @@ def main():
|
||||
failed = sorted(name for name, record in results.items() if record["status"] != "pass")
|
||||
finished_run(failed)
|
||||
print(f"\n{len(results) - len(failed)} passed, {len(failed)} failed in {elapsed / 60:.1f} min.")
|
||||
for name in failed:
|
||||
print(f" {name}: {STATE_DIR / 'logs' / (name + '.log')}")
|
||||
for index, name in enumerate(failed):
|
||||
log = STATE_DIR / 'logs' / (name + '.log')
|
||||
print(f" {name}: {log}")
|
||||
# The end of a harness's output says why it failed, and CI shows only this output.
|
||||
if index < FAILURE_TAILS:
|
||||
try:
|
||||
lines = log.read_text(encoding='utf-8', errors='replace').splitlines()[-FAILURE_TAIL_LINES:]
|
||||
except OSError:
|
||||
lines = []
|
||||
for line in lines:
|
||||
print(f" {line[:300]}")
|
||||
return 1 if failed else 0
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -229,10 +229,10 @@ def gen_vanilla_order(root, version, store, build):
|
||||
"dev.horizonlab.parity.VanillaCommandParseOracle", "tree", build], build)
|
||||
env = dict(os.environ, CARGO_TARGET_DIR=str(root / ".local" / "port-target"))
|
||||
jobs = os.environ.get("FLEET_LOAD_JOBS")
|
||||
run(["cargo", "build", "-p", "horizon-client", "--example", "command_parse_fixture",
|
||||
run(["cargo", "build", "-p", "horizon-client", "--example", "probe",
|
||||
*(["-j", jobs] if jobs else [])], root, env=env)
|
||||
fixture = root / ".local/port-target/debug/examples/command_parse_fixture"
|
||||
run([fixture, "tree", build / "rust_tree.json"], root)
|
||||
fixture = root / ".local/port-target/debug/examples/probe"
|
||||
run([fixture, "command_parse_fixture", "tree", build / "rust_tree.json"], root)
|
||||
return [python(), "tools/generate_command_order.py", build / "tree.json", build / "rust_tree.json"]
|
||||
|
||||
|
||||
|
||||
+12
-2
@@ -274,6 +274,16 @@ def parity_summary(output):
|
||||
return text
|
||||
|
||||
|
||||
def mod_features(crates):
|
||||
"""Code mods are off by default (docs/mods.md): on wherever horizon-mods is checked, as in CI."""
|
||||
if crates is not None and "horizon-mods" not in crates:
|
||||
return ""
|
||||
features = ["horizon-mods/runtime", "horizon-mods/pack"]
|
||||
if crates is None or "horizon-client" in crates:
|
||||
features.append("horizon-client/mods")
|
||||
return f" --features {','.join(features)}"
|
||||
|
||||
|
||||
def plan(args, base, changed, crates_of, libraries, dependencies):
|
||||
"""The checks for these changed files, in the order they run."""
|
||||
rust = any(workspace_rust(path) for path in changed)
|
||||
@@ -297,10 +307,10 @@ def plan(args, base, changed, crates_of, libraries, dependencies):
|
||||
Step("Python tests", "python3 -m unittest discover -s tests", where="here",
|
||||
skip=None if python else "no Python change", summary=unittest_passed),
|
||||
Step("rustfmt", "cargo fmt --all -- --check", skip=None if rust else no_rust),
|
||||
Step("clippy", f"cargo clippy {clippy_selection} --all-targets --locked -- -D warnings",
|
||||
Step("clippy", f"cargo clippy {clippy_selection}{mod_features(clippy_crates)} --all-targets --locked -- -D warnings",
|
||||
skip=None if rust else no_rust),
|
||||
Step("tests" + (": workspace" if crates is None else f": {', '.join(crates)}" if crates else ""),
|
||||
f"cargo test --locked {selection} --tests",
|
||||
f"cargo test --locked {selection}{mod_features(crates)} --tests",
|
||||
skip=test_skip, summary=tests_passed),
|
||||
Step("doc tests", f"cargo test --locked {doc_selection} --doc",
|
||||
skip=test_skip or (None if doc_crates else "no library touched"), summary=tests_passed),
|
||||
|
||||
@@ -61,7 +61,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaActiveEffectTickOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/active_effect_tick_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/active_effect_tick_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -72,14 +72,14 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaActiveEffectTickOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','active_effect_tick_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('active_effect_tick_fixture.exe' if os.name=='nt' else 'active_effect_tick_fixture')
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build)
|
||||
enriched=build/f'inputs-{side}.txt';enriched_hash=base.source_hashes([enriched])
|
||||
run([binary,build,side],'rust-'+side)
|
||||
run([binary,'active_effect_tick_fixture',build,side],'rust-'+side)
|
||||
reference=build/f'{side}.txt';rust_output=build/f'rust-{side}.txt';matched=base.compare(reference,rust_output)
|
||||
base.ensure_sources_unchanged([enriched],enriched_hash)
|
||||
tested_fixtures.update(enriched_hash);fixture_paths.append(enriched)
|
||||
|
||||
@@ -50,7 +50,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaActiveEffectsOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/active_effects_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/active_effects_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -61,14 +61,14 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaActiveEffectsOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','active_effects_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('active_effects_fixture.exe' if os.name=='nt' else 'active_effects_fixture')
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build)
|
||||
enriched=build/f'inputs-{side}.txt';enriched_hash=base.source_hashes([enriched])
|
||||
run([binary,build,side],'rust-'+side)
|
||||
run([binary,'active_effects_fixture',build,side],'rust-'+side)
|
||||
reference=build/f'{side}.txt';rust_output=build/f'rust-{side}.txt';matched=base.compare(reference,rust_output)
|
||||
base.ensure_sources_unchanged([enriched],enriched_hash)
|
||||
tested_fixtures.update(enriched_hash);fixture_paths.append(enriched)
|
||||
|
||||
@@ -177,7 +177,7 @@ def main():
|
||||
'ambient', 'VanillaAmbientOracle', 'ambient_fixture', ''.join(l + '\n' for l in lines),
|
||||
extra_sources=[h.lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSoundRig.java',
|
||||
h.lab.ROOT / 'crates/horizon-client/src/ambience.rs',
|
||||
h.lab.ROOT / 'crates/horizon-client/examples/audio_common/mod.rs'],
|
||||
h.lab.ROOT / 'crates/horizon-client/examples/probe/audio_common/mod.rs'],
|
||||
java_args=[h.RESOURCES], rust_args=[h.RESOURCES],
|
||||
scope='Real LocalPlayer.updateIsUnderwater, UnderwaterAmbientSoundHandler and BiomeAmbientSoundsHandler (loop cross-fades, additions, '
|
||||
'cave mood sampling, moodiness and the mood sound position) with UnderLiquidAmbientSoundInstance/UnderLiquidSubSound/LoopSoundInstance '
|
||||
|
||||
@@ -45,7 +45,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAnchorOracle.java"
|
||||
sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/anchor_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/anchor_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8")
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
@@ -53,10 +53,10 @@ def main():
|
||||
with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","anchor_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("anchor_fixture.exe" if os.name=="nt" else "anchor_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"anchor_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Real vanilla `Arrow` entities tick in an independently built copy of the
|
||||
scene (`VanillaArrowOracle`, client and server jars); Horizon's
|
||||
`arrows::tick` runs over the scene itself (`examples/arrow_probe.rs`). Every
|
||||
`arrows::tick` runs over the scene itself (`examples/probe/arrow_probe.rs`). Every
|
||||
operation prints the arrow's position, motion, rotation, ground state, life,
|
||||
shake, stuck block, fire ticks, water flags, fluid heights, removal, crit flag,
|
||||
fall distance and old position (what rendering interpolates from) by exact
|
||||
@@ -224,7 +224,7 @@ def main():
|
||||
'VanillaHeightmapOracle', 'VanillaCollisionOracle', 'VanillaBlockStateCodecOracle', 'VanillaSuffocationOracle',
|
||||
'VanillaFaceSupportOracle', 'VanillaEntityAttributeOracle', 'VanillaBlockLandingOracle', 'VanillaMovementRegistryOracle', 'VanillaDamageSourceOracle']]
|
||||
sources = [Path(__file__), lab.ROOT / 'tools/test_native_client.py', lab.ROOT / 'tools/test_rust_parity.py', lab.ROOT / 'tools/lab.py',
|
||||
oracle, *helpers, lab.ROOT / 'Cargo.toml', lab.ROOT / 'Cargo.lock', lab.ROOT / 'crates/horizon-client/examples/arrow_probe.rs']
|
||||
oracle, *helpers, lab.ROOT / 'Cargo.toml', lab.ROOT / 'Cargo.lock', lab.ROOT / 'crates/horizon-client/examples/probe/arrow_probe.rs']
|
||||
for crate in ['horizon-core', 'horizon-world', 'horizon-assets', 'horizon-client']:
|
||||
sources += [lab.ROOT / 'crates' / crate / 'Cargo.toml', *sorted((lab.ROOT / 'crates' / crate / 'src').rglob('*.rs'))]
|
||||
tested = base.source_hashes(sources)
|
||||
@@ -241,15 +241,15 @@ def main():
|
||||
expected = 3 * operations + len(fixtures)
|
||||
(build / 'inputs.txt').write_text(''.join(json.dumps(f, separators=(',', ':')) + '\n' for f in fixtures))
|
||||
input_hash = lab.digest(build / 'inputs.txt', 'sha256')
|
||||
run(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'arrow_probe'], 'compile-rust')
|
||||
run(['cargo', 'build', '--locked', '-p', 'horizon-client', '--example', 'probe'], 'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'], cwd=lab.ROOT))
|
||||
binary = Path(metadata['target_directory']) / 'debug/examples' / ('arrow_probe.exe' if os.name == 'nt' else 'arrow_probe')
|
||||
run([binary, resources, build, '--describe'], 'describe')
|
||||
binary = Path(metadata['target_directory']) / 'debug/examples' / ('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary, 'arrow_probe',resources, build, '--describe'], 'describe')
|
||||
references = []
|
||||
for side, jar in jars.items():
|
||||
run(['java', '-Xmx768M', '-cp', os.pathsep.join([str(classes), str(jar), dependencies]),
|
||||
'dev.horizonlab.parity.VanillaArrowOracle', side, build, resources], side)
|
||||
run([binary, resources, build, side], 'rust-' + side)
|
||||
run([binary, 'arrow_probe',resources, build, side], 'rust-' + side)
|
||||
matched = base.compare(build / (side + '.txt'), build / ('rust-' + side + '.txt'))
|
||||
if matched != expected:
|
||||
raise AssertionError('Incomplete arrow output')
|
||||
|
||||
@@ -48,7 +48,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeHealthOracle.java'
|
||||
helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java'
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/attribute_health_fixture.rs']
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/attribute_health_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -59,10 +59,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaAttributeHealthOracle',mode,path],side+'-'+mode)
|
||||
java('server','export',build);states=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,build/'catalog.json'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','attribute_health_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('attribute_health_fixture.exe' if os.name=='nt' else 'attribute_health_fixture')
|
||||
run([binary,build],'rust');run([binary,build,'live'],'rust-live');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'attribute_health_fixture',build],'rust');run([binary,'attribute_health_fixture',build,'live'],'rust-live');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
live_matched=base.compare(reference,build/'rust-live.txt')
|
||||
|
||||
@@ -69,9 +69,9 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeMapQueriesOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/attribute_map_queries_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/attribute_map_queries_fixture.rs']
|
||||
helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaStoredEffectAttributesOracle.java'
|
||||
sources.extend([helper,lab.ROOT/'crates/horizon-world/examples/stored_effect_attributes_fixture.rs',lab.ROOT/'tools/test_stored_effect_attributes_parity.py',lab.ROOT/'tools/test_stored_effect_notifications_parity.py'])
|
||||
sources.extend([helper,lab.ROOT/'crates/horizon-world/examples/probe/stored_effect_attributes_fixture.rs',lab.ROOT/'tools/test_stored_effect_attributes_parity.py',lab.ROOT/'tools/test_stored_effect_notifications_parity.py'])
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -82,14 +82,14 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaAttributeMapQueriesOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','attribute_map_queries_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('attribute_map_queries_fixture.exe' if os.name=='nt' else 'attribute_map_queries_fixture')
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build)
|
||||
enriched=build/f'inputs-{side}.txt';fixture_paths.append(enriched);tested_fixtures.update(base.source_hashes([enriched]))
|
||||
run([binary,build,side],'rust-'+side)
|
||||
run([binary,'attribute_map_queries_fixture',build,side],'rust-'+side)
|
||||
reference=build/f'{side}.txt';candidate=build/f'rust-{side}.txt';matched=base.compare(reference,candidate)
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched,'rust_output_sha256':lab.digest(candidate,'sha256')})
|
||||
print(f'{side}: {matched:,} attribute map query output lines match Rust',flush=True)
|
||||
|
||||
@@ -78,7 +78,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/attribute_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/attribute_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -89,10 +89,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaAttributeOracle',mode,path],side+'-'+mode)
|
||||
java('server','export',build);states=json.loads((build/'attributes.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,build/'attributes.json'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','attribute_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('attribute_fixture.exe' if os.name=='nt' else 'attribute_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'attribute_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -59,7 +59,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaAttributeUpdatesOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/"tools/test_effect_notifications_parity.py",lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/attribute_updates_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/"tools/test_effect_notifications_parity.py",lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/attribute_updates_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -70,14 +70,14 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaAttributeUpdatesOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','attribute_updates_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('attribute_updates_fixture.exe' if os.name=='nt' else 'attribute_updates_fixture')
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build)
|
||||
enriched=build/f'inputs-{side}.txt';enriched_hash=base.source_hashes([enriched])
|
||||
run([binary,build,side],'rust-'+side)
|
||||
run([binary,'attribute_updates_fixture',build,side],'rust-'+side)
|
||||
reference=build/f'{side}.txt';rust_output=build/f'rust-{side}.txt';matched=base.compare(reference,rust_output)
|
||||
base.ensure_sources_unchanged([enriched],enriched_hash)
|
||||
tested_fixtures.update(enriched_hash);fixture_paths.append(enriched)
|
||||
|
||||
@@ -115,7 +115,7 @@ def main():
|
||||
sources = [Path(__file__).resolve(), lab.ROOT / 'tools/oracle_harness.py', lab.ROOT / 'tools/lab.py',
|
||||
parity / (oracle + '.java'), parity / 'VanillaSceneCollisionOracle.java',
|
||||
parity / 'VanillaRegistryCollisionScanOracle.java', lab.ROOT / 'Cargo.lock',
|
||||
lab.ROOT / 'crates/horizon-client/examples/auto_jump_probe.rs',
|
||||
lab.ROOT / 'crates/horizon-client/examples/probe/auto_jump_probe.rs',
|
||||
lab.ROOT / 'crates/horizon-client/src/auto_jump.rs', lab.ROOT / 'crates/horizon-client/src/motion.rs']
|
||||
tested = base.source_hashes(sources)
|
||||
fixtures = list(cases(random.Random(0x4155544f)))
|
||||
@@ -123,8 +123,8 @@ def main():
|
||||
inputs.write_text(''.join(json.dumps(f, separators=(',', ':')) + '\n' for f in fixtures))
|
||||
input_hash = lab.digest(inputs, 'sha256')
|
||||
classes, dependencies, _ = harness.compile_oracle(build, oracle, jars, libraries, lock['minecraft']['java_major'])
|
||||
binary = harness.build_probe(build, 'auto_jump_probe')
|
||||
harness.run_logged([binary, resources, inputs, build / 'rust.txt', build / 'scene.json'], build, 'rust', timeout=3600)
|
||||
command = harness.build_probe(build, 'auto_jump_probe')
|
||||
harness.run_logged([*command, resources, inputs, build / 'rust.txt', build / 'scene.json'], build, 'rust', timeout=3600)
|
||||
harness.java_run(build, classes, dependencies, oracle, [inputs, build / 'client.txt', resources, build / 'scene.json'], 'client')
|
||||
matched = harness.compare(build / 'client.txt', build / 'rust.txt', 2 * len(fixtures))
|
||||
base.ensure_sources_unchanged(sources, tested)
|
||||
|
||||
@@ -57,7 +57,7 @@ def main():
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBasicFeatureOracle.java"
|
||||
helper=oracle.with_name("VanillaPlacementOracle.java")
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/basic_feature_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/basic_feature_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8")
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
@@ -71,10 +71,10 @@ def main():
|
||||
fixture_paths.append(path)
|
||||
if json.loads((build/"facts-client.json").read_text())!=json.loads((build/"facts-server.json").read_text()):raise ValueError("reference feature block states differ")
|
||||
tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","basic_feature_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("basic_feature_fixture.exe" if os.name=="nt" else "basic_feature_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"basic_feature_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -49,7 +49,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeChunkOracle.java"
|
||||
sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/biome_chunk_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/biome_chunk_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8")
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
@@ -57,10 +57,10 @@ def main():
|
||||
with (build/(name+".log")).open("w",encoding="utf-8") as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","biome_chunk_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("biome_chunk_fixture.exe" if os.name=="nt" else "biome_chunk_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"biome_chunk_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -53,7 +53,7 @@ def main():
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeGenerationOracle.java"
|
||||
exporter=oracle.with_name("VanillaBiomeExport.java")
|
||||
sources=[oracle,exporter,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/biome_generation_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/biome_generation_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -76,10 +76,10 @@ def main():
|
||||
registries=build/'registries.json';registries.write_text(json.dumps(bundle,separators=(',',':')),encoding='utf-8')
|
||||
fixtures=list(corpus(bundle));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,registries,*exports];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","biome_generation_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("biome_generation_fixture.exe" if os.name=="nt" else "biome_generation_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"biome_generation_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -44,7 +44,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomePlacementOracle.java'
|
||||
helper=oracle.with_name("VanillaPlacementOracle.java")
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/biome_placement_fixture.rs']
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/biome_placement_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
@@ -53,10 +53,10 @@ def main():
|
||||
with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','biome_placement_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('biome_placement_fixture.exe' if os.name=='nt' else 'biome_placement_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'biome_placement_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaBiomePlacementOracle',side,build],side)
|
||||
reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
|
||||
@@ -72,7 +72,7 @@ def main():
|
||||
exporter=oracle.with_name("VanillaBiomeExport.java")
|
||||
helpers=[oracle.with_name(name+".java") for name in ["VanillaMaterialConditionOracle","VanillaAnchorOracle","VanillaBiomeTemperatureOracle"]]
|
||||
sources=[oracle,exporter,*helpers,lab.ROOT/"tools/test_biome_temperature_parity.py",lab.ROOT/"tools/test_material_condition_parity.py",Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/biome_source_codec_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/biome_source_codec_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -95,10 +95,10 @@ def main():
|
||||
fixtures=list(corpus(bundle));inputs=build/'inputs.txt';inputs.write_text('\n'.join(fixtures)+'\n',encoding='utf-8')
|
||||
(build/'positions.json').write_text(json.dumps(positions(),separators=(',',':')),encoding='utf-8')
|
||||
fixture_paths=[inputs,*exports,build/'positions.json',*[build/(name+'.json') for name in bundle]];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","biome_source_codec_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("biome_source_codec_fixture.exe" if os.name=="nt" else "biome_source_codec_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"biome_source_codec_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -36,7 +36,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeSourceOracle.java"
|
||||
sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/biome_source_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/biome_source_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8")
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
@@ -44,10 +44,10 @@ def main():
|
||||
with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","biome_source_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("biome_source_fixture.exe" if os.name=="nt" else "biome_source_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"biome_source_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -74,7 +74,7 @@ def main():
|
||||
(build/'biomes.json').write_text(json.dumps(biomes,separators=(',',':')),encoding='utf-8')
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBiomeTemperatureOracle.java"
|
||||
sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/biome_temperature_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/biome_temperature_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=[*corpus(),*codec_corpus(biomes)];inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8")
|
||||
fixture_paths=[inputs,build/"biomes.json"];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
@@ -82,10 +82,10 @@ def main():
|
||||
with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","biome_temperature_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("biome_temperature_fixture.exe" if os.name=="nt" else "biome_temperature_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"biome_temperature_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -57,7 +57,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockCollisionScanOracle.java'
|
||||
helpers=[oracle.with_name('VanillaFaceSupportOracle.java')]
|
||||
sources=[oracle,*helpers,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_collision_scan_fixture.rs']
|
||||
sources=[oracle,*helpers,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/block_collision_scan_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -68,10 +68,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockCollisionScanOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','block_collision_scan_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('block_collision_scan_fixture.exe' if os.name=='nt' else 'block_collision_scan_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'block_collision_scan_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -9,7 +9,7 @@ on a stand-in client level, then per scripted step applies the block event
|
||||
(triggerEvent), runs the entity's own client ticker and the renderer's
|
||||
extractRenderState, printing the fields, the level calls the tick made
|
||||
(neighbour updates, entity pushes/queries, sounds, particles) and the render
|
||||
state. `examples/block_entity_anim_fixture` replays the steps through
|
||||
state. `examples/probe/block_entity_anim_fixture` replays the steps through
|
||||
`horizon_client::block_entity_anim` and derives the render state from the
|
||||
`BlockAnim` Horizon's renderer reads. Lines must match exactly (floats as bits).
|
||||
|
||||
@@ -279,8 +279,8 @@ def main():
|
||||
*(PARITY / f'{n}.java' for n in ('ParityData', 'VanillaBlockEntityAnimOracle'))], 'compile-java')
|
||||
run(['java', '-Xmx2G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaBlockEntityAnimOracle',
|
||||
inputs, build / 'vanilla.txt'], 'vanilla')
|
||||
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'block_entity_anim_fixture', '--',
|
||||
resources, inputs, build / 'rust.txt'], 'rust')
|
||||
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--',
|
||||
'block_entity_anim_fixture', resources, inputs, build / 'rust.txt'], 'rust')
|
||||
|
||||
def split(path):
|
||||
result, current = {}, None
|
||||
|
||||
@@ -5,7 +5,7 @@ The Java oracle (VanillaBlockEntityRenderOracle) builds each case's vanilla
|
||||
block entity, sets its animation fields, runs the real BlockEntityRenderer's
|
||||
extractRenderState and submit, and captures what it submits: model vertices
|
||||
after setupAnim and the pose stack (sprite-local UVs, tint, normal, light),
|
||||
text calls and items. `examples/block_entity_render_fixture` replays the case
|
||||
text calls and items. `examples/probe/block_entity_render_fixture` replays the case
|
||||
through Horizon's BlockEntityRenderer. Quads are matched by texture and
|
||||
position; colours compare vanilla's tint times the entity shader's
|
||||
`minecraft_mix_light` for the vanilla normal with Horizon's baked colour.
|
||||
@@ -303,8 +303,8 @@ def main():
|
||||
vanilla = [json.loads(l) for l in (build / 'vanilla.jsonl').read_text().splitlines()]
|
||||
textures = sorted({s['texture'] for v in vanilla for s in v.get('submits', []) if 'texture' in s})
|
||||
(build / 'textures.txt').write_text(''.join(t + '\n' for t in textures))
|
||||
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'block_entity_render_fixture', '--',
|
||||
resources, inputs, build / 'textures.txt', build / 'rust.jsonl'], 'rust')
|
||||
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--',
|
||||
'block_entity_render_fixture', resources, inputs, build / 'textures.txt', build / 'rust.jsonl'], 'rust')
|
||||
rust = [json.loads(l) for l in (build / 'rust.jsonl').read_text().splitlines()]
|
||||
assert len(vanilla) == len(rust), (len(vanilla), len(rust))
|
||||
groups, errors, skipped, passed = {}, {}, {}, 0
|
||||
|
||||
@@ -67,7 +67,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockEntityStorageOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_entity_storage_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/block_entity_storage_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
commands=list(corpus());inputs=build/'inputs.txt';inputs.write_text('\n'.join(commands)+'\n')
|
||||
tested_fixtures=base.source_hashes([inputs]);classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
@@ -75,10 +75,10 @@ def main():
|
||||
with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT)
|
||||
dependencies=os.pathsep.join(map(str,libraries))
|
||||
run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,oracle],'compile-java')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','block_entity_storage_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('block_entity_storage_fixture.exe' if os.name=='nt' else 'block_entity_storage_fixture')
|
||||
run([binary,inputs,build/'rust.txt'],'rust')
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'block_entity_storage_fixture',inputs,build/'rust.txt'],'rust')
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependencies]),'dev.horizonlab.parity.VanillaBlockEntityStorageOracle',inputs,build/(side+'.txt')],side)
|
||||
|
||||
@@ -6,7 +6,7 @@ one chunk to make its block entity map grow), place, replace and remove block
|
||||
entities, give jukeboxes a record and take it, and unload chunks, with ticks
|
||||
in between. `VanillaBlockEntityTickerOracle` runs them on real `LevelChunk`s
|
||||
of a server level and prints, after each tick, the positions of the live
|
||||
tickers in list order; `examples/block_entity_tickers_fixture` runs the same
|
||||
tickers in list order; `examples/probe/block_entity_tickers_fixture` runs the same
|
||||
on `horizon_client::block_entities::BlockEntities`. The block entities are
|
||||
the kinds the game ticks in that list (hoppers, furnaces, beacons, spawners,
|
||||
trial spawners, vaults, hives, crafters, brewing stands, jukebox), with chests and barrels,
|
||||
@@ -120,7 +120,7 @@ def main():
|
||||
run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies,
|
||||
'dev.horizonlab.parity.VanillaBlockEntityTickerOracle', inputs, build / 'vanilla.txt'], 'vanilla')
|
||||
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example',
|
||||
'block_entity_tickers_fixture', '--', inputs, build / 'rust.txt'], 'rust')
|
||||
'probe', '--', 'block_entity_tickers_fixture', inputs, build / 'rust.txt'], 'rust')
|
||||
matched = base.compare(build / 'vanilla.txt', build / 'rust.txt')
|
||||
ticks = sum(1 for line in lines if line == 'tick')
|
||||
listed = sum(len(line.split()) - 1 for line in (build / 'vanilla.txt').read_text().splitlines())
|
||||
|
||||
@@ -56,7 +56,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts();build=lab.LOCAL/'rust-block-landing-parity';build.mkdir(exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True)
|
||||
root=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity'
|
||||
oracles=[root/(n+'.java') for n in ['VanillaBlockLandingOracle','VanillaMovementRegistryOracle','VanillaHeightmapOracle','VanillaCollisionOracle']]
|
||||
sources=[*oracles,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/block_landing_fixture.rs']
|
||||
sources=[*oracles,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/probe/block_landing_fixture.rs']
|
||||
for crate in ['horizon-core','horizon-world']:sources += [lab.ROOT/'crates'/crate/'Cargo.toml',*sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))]
|
||||
tested=base.source_hashes(sources);classes=build/'classes';classes.mkdir(exist_ok=True);dependencies=os.pathsep.join(map(str,libraries))
|
||||
def run(command,name):
|
||||
@@ -69,9 +69,9 @@ def main():
|
||||
with (build/'inputs.txt').open('w') as output:
|
||||
for f in corpus(states,definitions):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1
|
||||
fixture_paths=[build/n for n in ['inputs.txt','landing-states.json','landing-definitions.json','movement-properties.nbt','block-registry.nbt','cached-collision.nbt']];fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--locked','--release','-p','horizon-world','--example','block_landing_fixture'],'compile-rust')
|
||||
metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('block_landing_fixture.exe' if os.name=='nt' else 'block_landing_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
run(['cargo','build','--locked','--release','-p','horizon-world','--example','probe'],'compile-rust')
|
||||
metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'block_landing_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} registered block landing lines match',flush=True)
|
||||
base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures)
|
||||
|
||||
@@ -13,7 +13,7 @@ def main():
|
||||
resources = lab.RESOURCES
|
||||
build = lab.LOCAL / "block-particles-parity"
|
||||
build.mkdir(exist_ok=True)
|
||||
paths = [lab.ROOT / p for p in ["tools/test_block_particles_parity.py", "tools/test_breaking_model_parity.py", "tools/oracle_harness.py", "tools/lab.py", "crates/horizon-client/src/particles.rs", "crates/horizon-client/src/game.rs", "crates/horizon-client/src/blocks.rs", "crates/horizon-client/src/mesher.rs", "crates/horizon-client/examples/block_particles_fixture.rs", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockParticlesOracle.java", "crates/horizon-core/src/random.rs", "Cargo.lock", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGameplayFactsExporter.java"]]
|
||||
paths = [lab.ROOT / p for p in ["tools/test_block_particles_parity.py", "tools/test_breaking_model_parity.py", "tools/oracle_harness.py", "tools/lab.py", "crates/horizon-client/src/particles.rs", "crates/horizon-client/src/game.rs", "crates/horizon-client/src/blocks.rs", "crates/horizon-client/src/mesher.rs", "crates/horizon-client/examples/probe/block_particles_fixture.rs", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockParticlesOracle.java", "crates/horizon-core/src/random.rs", "Cargo.lock", "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaGameplayFactsExporter.java"]]
|
||||
tested = base.source_hashes(paths)
|
||||
rows = [dict(case=i, seed=(-1 if i % 2 else 1) * i * 987654321, **row) for i, row in enumerate(breaking.cases(resources))]
|
||||
rows[0]["seed"] = -(2**63)
|
||||
@@ -21,8 +21,8 @@ def main():
|
||||
inputs = build / "inputs.jsonl"
|
||||
inputs.write_text("".join(json.dumps(row)+"\n" for row in rows))
|
||||
classes, dependencies, _ = harness.compile_oracle(build, "VanillaBlockParticlesOracle", jars, baking.client_libraries(), lock["minecraft"]["java_major"])
|
||||
binary = harness.build_probe(build, "block_particles_fixture")
|
||||
harness.run_logged([binary, resources, inputs, build / "rust.jsonl"], build, "rust")
|
||||
command = harness.build_probe(build, "block_particles_fixture")
|
||||
harness.run_logged([*command, resources, inputs, build / "rust.jsonl"], build, "rust")
|
||||
harness.java_run(build, classes, dependencies, "VanillaBlockParticlesOracle", [inputs, build / "client.jsonl"], "client")
|
||||
count = hits = burst = 0
|
||||
max_error = 0.0
|
||||
|
||||
@@ -45,7 +45,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPropertiesOracle.java'
|
||||
helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java'
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_properties_fixture.rs']
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/block_properties_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -57,10 +57,10 @@ def main():
|
||||
java('server','export',build)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,build/'block-registry.nbt',build/'cached-collision.nbt',build/'block-properties.nbt'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','block_properties_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('block_properties_fixture.exe' if os.name=='nt' else 'block_properties_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'block_properties_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -42,7 +42,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockPushOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_push_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/block_push_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -53,10 +53,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockPushOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','block_push_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('block_push_fixture.exe' if os.name=='nt' else 'block_push_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'block_push_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -45,7 +45,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockStateCodecOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_state_codec_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/block_state_codec_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -60,10 +60,10 @@ def main():
|
||||
if len(facts['states'])!=35723:raise ValueError('incomplete pinned state registry')
|
||||
fixtures=list(corpus(facts));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,build/'facts-client.json',build/'facts-server.json'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','block_state_codec_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('block_state_codec_fixture.exe' if os.name=='nt' else 'block_state_codec_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'block_state_codec_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -24,7 +24,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSupportOracle.java'
|
||||
helper=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java'
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_support_fixture.rs']
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/block_support_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -35,10 +35,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockSupportOracle',mode,path],side+'-'+mode)
|
||||
java('server','export',build)
|
||||
fixture_paths=[build/'block-registry.nbt',build/'cached-support.nbt'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','block_support_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('block_support_fixture.exe' if os.name=='nt' else 'block_support_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'block_support_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -205,7 +205,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockSurvivalOracle.java'
|
||||
helpers=[oracle.with_name(name+'.java') for name in ['VanillaBlockPropertiesOracle','VanillaBlockSupportOracle','VanillaBlockStateCodecOracle','VanillaCollisionOracle','VanillaHeightmapOracle']]
|
||||
sources=[oracle,*helpers,lab.ROOT/'tools/test_worldgen_parity.py',Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/block_survival_fixture.rs']
|
||||
sources=[oracle,*helpers,lab.ROOT/'tools/test_worldgen_parity.py',Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/block_survival_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
environment={'minecraft':lock['minecraft']['version'],'manifest_sha1':lock['minecraft']['manifest_sha1'],'platform':platform.platform(),'java':subprocess.check_output(['java','--version'],text=True).splitlines()[0],'rustc':subprocess.check_output(['rustc','--version'],text=True).strip(),'dependencies':{str(path):lab.digest(path,'sha256') for path in [*jars.values(),*libraries]}}
|
||||
checkpoint=load_checkpoint(checkpoint_path,tested_sources,environment) if args.resume else None
|
||||
@@ -236,9 +236,9 @@ def main():
|
||||
output.write(json.dumps(fixture,separators=(',',':'))+'\n');fixture_count+=1
|
||||
fixture_paths=[inputs,build/'survival-extra-definitions.json',build/'fluid-tags.json',build/'survival-placement-classes.json',build/'survival-support-tags.json',build/'facts.json',build/'survival-classes.json',build/'survival-rules.json',build/'tags.json',build/'block-registry.nbt',build/'cached-collision.nbt',build/'block-properties.nbt',build/'cached-support.nbt']
|
||||
tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','block_survival_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('block_survival_fixture.exe' if os.name=='nt' else 'block_survival_fixture')
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
base.ensure_sources_unchanged(sources,tested_sources)
|
||||
checkpoint={'schema':1,'environment':environment,'sources_sha256':tested_sources,'fixtures_sha256':{str(lab.ROOT/name):digest for name,digest in tested_fixtures.items()},'artifacts_sha256':{str(path):lab.digest(path,'sha256') for path in [binary,*sorted(classes.rglob('*.class'))]},'binary':str(binary),'counts':{'supported_blocks':len(definitions),'supported_states':sum(state['id'] in definitions for state in facts['states']),'survival_rules':len(set(definitions.values())),'survival_rule_kinds':len({rule.split(':',1)[0] for rule in definitions.values()}),'fluid_tag_files':len(fluid_tags),'fixtures':fixture_count},'outputs':{}}
|
||||
save_checkpoint(checkpoint_path,checkpoint)
|
||||
@@ -251,7 +251,7 @@ def main():
|
||||
checkpoint['outputs'][name]=lab.digest(output,'sha256')
|
||||
save_checkpoint(checkpoint_path,checkpoint)
|
||||
print(f'{name}: completed output checkpointed',flush=True)
|
||||
stage('rust',lambda:run([checkpoint['binary'],build],'rust'))
|
||||
stage('rust',lambda:run([checkpoint['binary'],'block_survival_fixture',build],'rust'))
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
stage(side,lambda:java(side,side,build))
|
||||
|
||||
@@ -49,7 +49,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingItemDamageOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/blocking_item_damage_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/blocking_item_damage_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -60,10 +60,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockingItemDamageOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','blocking_item_damage_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('blocking_item_damage_fixture.exe' if os.name=='nt' else 'blocking_item_damage_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'blocking_item_damage_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -49,7 +49,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockingRulesOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/blocking_rules_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/blocking_rules_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -60,10 +60,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBlockingRulesOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','blocking_rules_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('blocking_rules_fixture.exe' if os.name=='nt' else 'blocking_rules_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'blocking_rules_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -29,13 +29,13 @@ def canonical(quads):
|
||||
def main():
|
||||
lock,jars,_=base.verify_artifacts();libraries=baking.client_libraries()
|
||||
resources=lab.RESOURCES;build=lab.LOCAL/"breaking-model-parity";build.mkdir(exist_ok=True)
|
||||
paths=[lab.ROOT/"tools/test_breaking_model_parity.py",lab.ROOT/"crates/horizon-client/src/breaking.rs",lab.ROOT/"crates/horizon-client/src/game.rs",lab.ROOT/"crates/horizon-client/src/gfx.rs",lab.ROOT/"crates/horizon-client/src/entity.wgsl",lab.ROOT/"crates/horizon-client/src/models/catalog.rs",lab.ROOT/"crates/horizon-client/src/mesher.rs",lab.ROOT/"crates/horizon-client/src/camera.rs",lab.ROOT/"crates/horizon-client/examples/breaking_fixture.rs",lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBreakingModelOracle.java",lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSectionMeshOracle.java",lab.ROOT/"Cargo.lock"]
|
||||
paths=[lab.ROOT/"tools/test_breaking_model_parity.py",lab.ROOT/"crates/horizon-client/src/breaking.rs",lab.ROOT/"crates/horizon-client/src/game.rs",lab.ROOT/"crates/horizon-client/src/gfx.rs",lab.ROOT/"crates/horizon-client/src/entity.wgsl",lab.ROOT/"crates/horizon-client/src/models/catalog.rs",lab.ROOT/"crates/horizon-client/src/mesher.rs",lab.ROOT/"crates/horizon-client/src/camera.rs",lab.ROOT/"crates/horizon-client/examples/probe/breaking_fixture.rs",lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBreakingModelOracle.java",lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSectionMeshOracle.java",lab.ROOT/"Cargo.lock"]
|
||||
tested=base.source_hashes(paths)
|
||||
rows=[dict(case=i,**row) for i,row in enumerate(cases(resources))]
|
||||
inputs=build/"inputs.jsonl";inputs.write_text("".join(json.dumps(row)+"\n" for row in rows))
|
||||
classes,dependencies,_=harness.compile_oracle(build,"VanillaBreakingModelOracle",jars,libraries,lock["minecraft"]["java_major"])
|
||||
binary=harness.build_probe(build,"breaking_fixture")
|
||||
harness.run_logged([binary,resources,inputs,build/"rust.jsonl"],build,"rust")
|
||||
command=harness.build_probe(build,"breaking_fixture")
|
||||
harness.run_logged([*command,resources,inputs,build/"rust.jsonl"],build,"rust")
|
||||
harness.java_run(build,classes,dependencies,"VanillaBreakingModelOracle",[inputs,build/"client.jsonl"],"client")
|
||||
count=vertices=0;max_error=0.0
|
||||
with (build/"client.jsonl").open() as native, (build/"rust.jsonl").open() as rust:
|
||||
|
||||
@@ -52,7 +52,7 @@ def main():
|
||||
helper=oracle.with_name("VanillaHeightmapOracle.java")
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",
|
||||
lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/bulk_section_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/bulk_section_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -70,10 +70,10 @@ def main():
|
||||
(build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8")
|
||||
fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"]
|
||||
tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","bulk_section_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("bulk_section_fixture.exe" if os.name=="nt" else "bulk_section_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"bulk_section_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build)
|
||||
|
||||
@@ -53,7 +53,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBundleWeightOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/bundle_weight_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/bundle_weight_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -64,10 +64,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaBundleWeightOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','bundle_weight_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('bundle_weight_fixture.exe' if os.name=='nt' else 'bundle_weight_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'bundle_weight_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -54,7 +54,7 @@ def main():
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCanyonCarverOracle.java"
|
||||
helper=oracle.with_name("VanillaAnchorOracle.java")
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/canyon_carver_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/canyon_carver_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
resources=worldgen.registry_resources(jars['server'],'carver')
|
||||
if not resources or resources!=worldgen.registry_resources(jars['client'],'carver'):raise ValueError('reference carver resources differ')
|
||||
@@ -65,10 +65,10 @@ def main():
|
||||
with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","canyon_carver_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("canyon_carver_fixture.exe" if os.name=="nt" else "canyon_carver_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"canyon_carver_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -63,7 +63,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingGeometryOracle.java"
|
||||
sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/carving_geometry_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/carving_geometry_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8")
|
||||
reach=list(reach_corpus());reach_path=build/'reach.txt';reach_path.write_text(''.join(json.dumps(q,separators=(',',':'))+'\n' for q in reach),encoding='utf-8')
|
||||
@@ -72,10 +72,10 @@ def main():
|
||||
with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","carving_geometry_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("carving_geometry_fixture.exe" if os.name=="nt" else "carving_geometry_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"carving_geometry_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -57,7 +57,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCarvingMaskOracle.java"
|
||||
sources=[oracle,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/carving_mask_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/carving_mask_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8")
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
@@ -65,10 +65,10 @@ def main():
|
||||
with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle],"compile-java")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","carving_mask_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("carving_mask_fixture.exe" if os.name=="nt" else "carving_mask_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"carving_mask_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -49,7 +49,7 @@ def main():
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCaveCarverOracle.java"
|
||||
helper=oracle.with_name("VanillaAnchorOracle.java")
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/cave_carver_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/cave_carver_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
resources=worldgen.registry_resources(jars['server'],'carver')
|
||||
if not resources or resources!=worldgen.registry_resources(jars['client'],'carver'):raise ValueError('reference carver resources differ')
|
||||
@@ -60,10 +60,10 @@ def main():
|
||||
with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","cave_carver_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("cave_carver_fixture.exe" if os.name=="nt" else "cave_carver_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"cave_carver_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -8,7 +8,7 @@ all, history up and down, Tab and Shift+Tab through suggestions, Escape)
|
||||
and clicks (on the suggestion list, on the input). The Java oracle
|
||||
(VanillaChatScreenOracle) drives a real ChatScreen, whose CommandSuggestions
|
||||
parse with vanilla's client command tree and ask the server's dispatcher
|
||||
for the suggestions a node leaves to it; examples/chat_screen_fixture runs
|
||||
for the suggestions a node leaves to it; examples/probe/chat_screen_fixture runs
|
||||
horizon_client::chat::ChatScreen on Horizon's dispatcher. After the actions
|
||||
the input's value, cursor, selection and scroll and the screen's GUI calls
|
||||
(the input background, the EditBox with its argument colouring, cursor,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Vanilla side: VanillaChunkGenerationOracle drives the actual ChunkGenerator
|
||||
stages (structure starts and references, biomes, terrain with surface and
|
||||
carvers, then biome decoration with every placed feature and structure piece)
|
||||
through real WorldGenRegion instances. Horizon side: the chunk_dump example
|
||||
through real WorldGenRegion instances. Horizon side: the chunk_dump probe
|
||||
runs the same stages in the same order. Every block state, quart biome and
|
||||
block entity (canonical NBT) of each target chunk is compared.
|
||||
|
||||
@@ -71,9 +71,9 @@ class Oracle:
|
||||
|
||||
|
||||
def rust_binary():
|
||||
subprocess.run(['cargo', 'build', '--release', '-q', '-p', 'horizon-world', '--example', 'chunk_dump'], check=True, cwd=lab.ROOT)
|
||||
subprocess.run(['cargo', 'build', '--release', '-q', '-p', 'horizon-world', '--example', 'probe'], check=True, cwd=lab.ROOT)
|
||||
metadata = json.loads(subprocess.check_output(['cargo', 'metadata', '--no-deps', '--format-version', '1'], cwd=lab.ROOT, text=True))
|
||||
return Path(metadata['target_directory']) / 'release/examples/chunk_dump'
|
||||
return Path(metadata['target_directory']) / 'release/examples/probe'
|
||||
|
||||
|
||||
def run_rust(binary, out, seed, dimension, rects, scan=False):
|
||||
@@ -81,7 +81,7 @@ def run_rust(binary, out, seed, dimension, rects, scan=False):
|
||||
if scan:
|
||||
env['HORIZON_SCAN'] = '1'
|
||||
with open(out, 'w') as handle:
|
||||
result = subprocess.run([str(binary), str(RESOURCES), str(seed), dimension, *rects], stdout=handle, stderr=subprocess.PIPE, text=True, env=env, cwd=lab.ROOT)
|
||||
result = subprocess.run([str(binary), 'chunk_dump', str(RESOURCES), str(seed), dimension, *rects], stdout=handle, stderr=subprocess.PIPE, text=True, env=env, cwd=lab.ROOT)
|
||||
if result.returncode:
|
||||
raise SystemExit('chunk_dump failed: ' + result.stderr[-2000:])
|
||||
return result.stderr
|
||||
|
||||
@@ -55,7 +55,7 @@ def main():
|
||||
helper=oracle.with_name("VanillaHeightmapOracle.java")
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",
|
||||
lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/chunk_stage_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/chunk_stage_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -73,10 +73,10 @@ def main():
|
||||
(build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8")
|
||||
fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"]
|
||||
tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","chunk_stage_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("chunk_stage_fixture.exe" if os.name=="nt" else "chunk_stage_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"chunk_stage_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build)
|
||||
|
||||
@@ -34,7 +34,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaChunkStatusOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/chunk_status_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/chunk_status_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
commands=list(corpus());inputs=build/'inputs.txt';inputs.write_text('\n'.join(json.dumps(command) for command in commands)+'\n')
|
||||
tested_fixtures=base.source_hashes([inputs]);classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
@@ -42,10 +42,10 @@ def main():
|
||||
with (build/(name+'.log')).open('w') as log:subprocess.run(list(map(str,command)),cwd=lab.ROOT,check=True,timeout=3600,stdout=log,stderr=subprocess.STDOUT)
|
||||
dependencies=os.pathsep.join(map(str,libraries))
|
||||
run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependencies,'-d',classes,oracle],'compile-java')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','chunk_status_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('chunk_status_fixture.exe' if os.name=='nt' else 'chunk_status_fixture')
|
||||
run([binary,inputs,build/'rust.txt'],'rust')
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'chunk_status_fixture',inputs,build/'rust.txt'],'rust')
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependencies]),'dev.horizonlab.parity.VanillaChunkStatusOracle',inputs,build/(side+'.txt')],side)
|
||||
|
||||
@@ -40,7 +40,7 @@ def corpus(info):
|
||||
def main():
|
||||
lock,jars,libraries=base.verify_artifacts();build=lab.LOCAL/'rust-climbing-parity';build.mkdir(exist_ok=True);report_path=build/'report.json';report_path.unlink(missing_ok=True)
|
||||
root=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity';oracles=[root/(n+'.java') for n in ['VanillaClimbingOracle','VanillaHeightmapOracle']]
|
||||
sources=[*oracles,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/test_worldgen_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/climbing_fixture.rs']
|
||||
sources=[*oracles,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/test_worldgen_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/probe/climbing_fixture.rs']
|
||||
for crate in ['horizon-core','horizon-world']:sources += [lab.ROOT/'crates'/crate/'Cargo.toml',*sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))]
|
||||
tested=base.source_hashes(sources);tags=worldgen.tag_resources(jars['server'])
|
||||
if tags!=worldgen.tag_resources(jars['client']):raise AssertionError('Native tags differ between artifacts')
|
||||
@@ -54,7 +54,7 @@ def main():
|
||||
with (build/'inputs.txt').open('w') as output:
|
||||
for f in corpus(info):output.write(json.dumps(f,separators=(',',':'))+'\n');count+=1
|
||||
fixture_paths=[build/n for n in ['inputs.txt','info.json','block-registry.nbt','tags.json']];fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--locked','--release','-p','horizon-world','--example','climbing_fixture'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('climbing_fixture.exe' if os.name=='nt' else 'climbing_fixture');run([binary,build],'rust');references=[]
|
||||
run(['cargo','build','--locked','--release','-p','horizon-world','--example','probe'],'compile-rust');metadata=json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT));binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe');run([binary,'climbing_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side);matched=base.compare(build/(side+'.txt'),build/'rust.txt');references.append(dict(side=side,jar_sha256=lab.digest(jar,'sha256'),output_sha256=lab.digest(build/(side+'.txt'),'sha256'),matched_output_lines=matched));print(f'{side}: {matched:,} climbing output lines match Rust',flush=True)
|
||||
base.ensure_sources_unchanged(sources,tested);base.ensure_sources_unchanged(fixture_paths,fixtures)
|
||||
|
||||
@@ -48,7 +48,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java'
|
||||
helpers=[oracle.with_name('VanillaFaceSupportOracle.java')]
|
||||
sources=[oracle,*helpers,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/collision_context_fixture.rs']
|
||||
sources=[oracle,*helpers,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/collision_context_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -59,10 +59,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCollisionContextOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','collision_context_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('collision_context_fixture.exe' if os.name=='nt' else 'collision_context_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'collision_context_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -39,7 +39,7 @@ def main():
|
||||
lock, jars, libraries = test_rust_parity.verify_artifacts()
|
||||
base = Path(tempfile.mkdtemp(prefix="run-", dir=directory))
|
||||
oracle = lab.ROOT / "mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java"
|
||||
sources = [oracle, Path(__file__).resolve(), lab.ROOT / "tools/test_rust_parity.py", lab.ROOT / "Cargo.toml", lab.ROOT / "Cargo.lock", lab.ROOT / "crates/horizon-core/Cargo.toml", lab.ROOT / "crates/horizon-world/Cargo.toml", *sorted((lab.ROOT / "crates/horizon-core/src").rglob("*.rs")), *sorted((lab.ROOT / "crates/horizon-world/src").rglob("*.rs")), lab.ROOT / "crates/horizon-world/examples/collision_fixture.rs"]
|
||||
sources = [oracle, Path(__file__).resolve(), lab.ROOT / "tools/test_rust_parity.py", lab.ROOT / "Cargo.toml", lab.ROOT / "Cargo.lock", lab.ROOT / "crates/horizon-core/Cargo.toml", lab.ROOT / "crates/horizon-world/Cargo.toml", *sorted((lab.ROOT / "crates/horizon-core/src").rglob("*.rs")), *sorted((lab.ROOT / "crates/horizon-world/src").rglob("*.rs")), lab.ROOT / "crates/horizon-world/examples/probe/collision_fixture.rs"]
|
||||
tested_sources = test_rust_parity.source_hashes(sources)
|
||||
classes = base / "classes"
|
||||
classes.mkdir()
|
||||
@@ -51,10 +51,10 @@ def main():
|
||||
result.check_returncode()
|
||||
return result.stdout
|
||||
expected = counts(java("server", "generate"))
|
||||
test_rust_parity.run(["cargo", "build", "--release", "-p", "horizon-world", "--example", "collision_fixture"])
|
||||
test_rust_parity.run(["cargo", "build", "--release", "-p", "horizon-world", "--example", "probe"])
|
||||
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" / ("collision_fixture.exe" if os.name == "nt" else "collision_fixture")
|
||||
actual = counts(subprocess.check_output([str(binary), str(base)], cwd=lab.ROOT, text=True))
|
||||
binary = Path(metadata["target_directory"]) / "release/examples" / ("probe.exe" if os.name=="nt" else "probe")
|
||||
actual = counts(subprocess.check_output([str(binary), "collision_fixture", str(base)], cwd=lab.ROOT, text=True))
|
||||
if actual != expected:
|
||||
raise AssertionError(f"Collision coverage differs: vanilla={expected}, Rust={actual}")
|
||||
canonical = {"empty_states":0,"block_states":0,"other_cached_states":0}
|
||||
|
||||
@@ -46,7 +46,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCombatRulesOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/combat_rules_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/combat_rules_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -57,10 +57,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaCombatRulesOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','combat_rules_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('combat_rules_fixture.exe' if os.name=='nt' else 'combat_rules_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'combat_rules_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -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', 'command_parse_fixture'], 'compile-rust')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', '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' / ('command_parse_fixture.exe' if os.name == 'nt' else 'command_parse_fixture')
|
||||
binary = Path(metadata['target_directory']) / 'release/examples' / ('probe.exe' if os.name=='nt' else 'probe')
|
||||
resources = lab.RESOURCES
|
||||
total_failures = 0
|
||||
summary = []
|
||||
@@ -79,7 +79,7 @@ def main():
|
||||
if not (stamp.exists() and stamp.read_text() == digest and (level_dir / 'vanilla.jsonl').exists()):
|
||||
java('run', str(level_dir), str(build / 'corpus.txt'), str(permission))
|
||||
stamp.write_text(digest)
|
||||
run([binary, resources, build / 'registries.json', build / 'corpus.txt', str(permission), level_dir / 'rust.jsonl'], f'rust{permission}')
|
||||
run([binary, 'command_parse_fixture',resources, build / 'registries.json', build / 'corpus.txt', str(permission), level_dir / 'rust.jsonl'], f'rust{permission}')
|
||||
failures = compare(level_dir / 'vanilla.jsonl', level_dir / 'rust.jsonl', args.limit)
|
||||
count = sum(1 for _ in (level_dir / 'vanilla.jsonl').open())
|
||||
print(f'permission {permission}: {count - failures}/{count} commands match', flush=True)
|
||||
|
||||
@@ -60,7 +60,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentDurabilityOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/component_durability_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/component_durability_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -71,10 +71,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaComponentDurabilityOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','component_durability_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('component_durability_fixture.exe' if os.name=='nt' else 'component_durability_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'component_durability_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -46,7 +46,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaComponentPatchOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/component_patch_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/component_patch_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -57,10 +57,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaComponentPatchOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','component_patch_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('component_patch_fixture.exe' if os.name=='nt' else 'component_patch_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'component_patch_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -44,7 +44,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaConsumableEmissionOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/consumable_emission_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/consumable_emission_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -55,10 +55,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaConsumableEmissionOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','consumable_emission_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('consumable_emission_fixture.exe' if os.name=='nt' else 'consumable_emission_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'consumable_emission_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -50,7 +50,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaConsumableOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/consumable_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/consumable_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -61,10 +61,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaConsumableOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','consumable_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('consumable_fixture.exe' if os.name=='nt' else 'consumable_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'consumable_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -44,7 +44,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaConsumeEffectOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/consume_effect_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/consume_effect_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -55,10 +55,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaConsumeEffectOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','consume_effect_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('consume_effect_fixture.exe' if os.name=='nt' else 'consume_effect_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'consume_effect_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -36,7 +36,7 @@ def main():
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionContextOracle.java'
|
||||
helpers=[oracle.with_name(name+'.java') for name in ['VanillaFaceSupportOracle','VanillaCollisionOracle','VanillaContextualCollisionAudit']]
|
||||
runner=lab.ROOT/'tools/test_collision_context_parity.py'
|
||||
sources=[oracle,*helpers,runner,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/collision_context_fixture.rs']
|
||||
sources=[oracle,*helpers,runner,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/collision_context_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -48,10 +48,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars['server']),dependency_path]),'dev.horizonlab.parity.VanillaCollisionOracle','generate',build],'export')
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,build/'block-registry.nbt',build/'cached-collision.nbt'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','collision_context_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('collision_context_fixture.exe' if os.name=='nt' else 'collision_context_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'collision_context_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaContextualCollisionAudit',side,build],side+'-audit')
|
||||
audited=base.compare(build/(side+'-audit.txt'),build/'rust-audit.txt')
|
||||
|
||||
@@ -7,7 +7,7 @@ tab built by vanilla's CreativeModeTabs over the vanilla data pack's
|
||||
registries), then what the vanilla client shows: every tab's display items
|
||||
and, for each search query, CreativeModeInventoryScreen.refreshSearchResults'
|
||||
items, searched through the client's own SessionSearchTrees.
|
||||
examples/creative_search_fixture loads the export into
|
||||
examples/probe/creative_search_fixture loads the export into
|
||||
horizon_client::creative::Creative. The tabs it shows (id, title, icon,
|
||||
position, every stack with its components), the search tab's stacks and the
|
||||
results of every query must agree. The queries are QUERIES below, then every
|
||||
|
||||
@@ -46,7 +46,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageImmunityOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/damage_immunity_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/damage_immunity_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -57,10 +57,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaDamageImmunityOracle',mode,path],side+'-'+mode)
|
||||
java('server','export',build);fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,build/'slots.json'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','damage_immunity_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('damage_immunity_fixture.exe' if os.name=='nt' else 'damage_immunity_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'damage_immunity_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -53,7 +53,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageReductionOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/damage_reduction_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/damage_reduction_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -65,10 +65,10 @@ def main():
|
||||
java('server','export',build)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,build/'slots.json'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','damage_reduction_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('damage_reduction_fixture.exe' if os.name=='nt' else 'damage_reduction_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'damage_reduction_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -45,7 +45,7 @@ def main():
|
||||
resources={'minecraft:'+n[len(prefix):-5]:archive.read(n).decode('utf-8') for n in sorted(archive.namelist()) if n.startswith(prefix) and n.endswith('.json')};lab.write_json(build/file,resources)
|
||||
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDamageSourceOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/damage_source_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/damage_source_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -56,10 +56,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaDamageSourceOracle',mode,path],side+'-'+mode)
|
||||
java('server','export',build);catalog=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(catalog));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,build/'catalog.json',build/'types.json',build/'tags.json'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','damage_source_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('damage_source_fixture.exe' if os.name=='nt' else 'damage_source_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'damage_source_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -9,7 +9,7 @@ generated automatically when missing), two upgrades run on a copy:
|
||||
vanilla VanillaDataFixOracle: FileFixerUpper, then DataFixers on level.dat, every
|
||||
chunk, entity chunk and POI chunk, player, saved data, advancements and
|
||||
statistics file, exactly as 26.3 does when it opens the world
|
||||
horizon the `datafix_world` example of horizon-world, which does the same with
|
||||
horizon the `datafix_world` probe of horizon-world, which does the same with
|
||||
horizon_world::datafix
|
||||
|
||||
Then every file is compared: region files chunk by chunk, NBT files and JSON
|
||||
@@ -72,11 +72,11 @@ def java_classpath():
|
||||
|
||||
|
||||
def build_rust():
|
||||
subprocess.run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'datafix_world'],
|
||||
subprocess.run(['cargo', 'build', '--locked', '--release', '-p', 'horizon-world', '--example', 'probe'],
|
||||
cwd=ROOT, check=True)
|
||||
meta = json.loads(subprocess.check_output(['cargo', 'metadata', '--locked', '--no-deps', '--format-version', '1'],
|
||||
cwd=ROOT))
|
||||
return Path(meta['target_directory']) / 'release' / 'examples' / 'datafix_world'
|
||||
return Path(meta['target_directory']) / 'release' / 'examples' / 'probe'
|
||||
|
||||
|
||||
def run_vanilla(classpath, world, out, target=None):
|
||||
@@ -92,7 +92,8 @@ def run_horizon(binary, world, out, target=None):
|
||||
shutil.rmtree(out, ignore_errors=True)
|
||||
log = out.parent / (out.name + '.log')
|
||||
with log.open('w') as f:
|
||||
subprocess.run([str(binary), str(world), str(out), *([str(target)] if target else [])], check=True, stdout=f, stderr=subprocess.STDOUT)
|
||||
subprocess.run([str(binary), 'datafix_world', str(world), str(out), *([str(target)] if target else [])], check=True,
|
||||
stdout=f, stderr=subprocess.STDOUT)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- comparison
|
||||
@@ -201,7 +202,7 @@ def main():
|
||||
p.add_argument('versions', nargs='*')
|
||||
p.add_argument('--keep', action='store_true')
|
||||
p.add_argument('--vanilla-only', action='store_true', help='only run the oracle')
|
||||
p.add_argument('--binary', help='a prebuilt datafix_world example')
|
||||
p.add_argument('--binary', help='a prebuilt horizon-world probe binary')
|
||||
p.add_argument('--band', type=int, metavar='TARGET', help='check the data fixes up to this DataVersion only (not the '
|
||||
'file fixes), on the sample worlds saved before it, for developing the fixes of a range of versions')
|
||||
args = p.parse_args()
|
||||
|
||||
@@ -66,7 +66,7 @@ def build_dir():
|
||||
|
||||
|
||||
def vanilla_order(binary, cx, cz, view):
|
||||
out = subprocess.run([str(binary), str(cg.RESOURCES), '0', 'overworld'], capture_output=True, text=True, check=True,
|
||||
out = subprocess.run([str(binary), 'chunk_dump', str(cg.RESOURCES), '0', 'overworld'], capture_output=True, text=True, check=True,
|
||||
env=dict(os.environ, HORIZON_LIST_ORDER=f'{cx},{cz},{view}'), cwd=lab.ROOT).stdout
|
||||
return [tuple(map(int, line.split())) for line in out.splitlines()]
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ def main():
|
||||
resources=sort.biome_features(jars['server'])
|
||||
if len(resources)!=67 or resources!=sort.biome_features(jars['client']):raise ValueError('pinned biome feature resources differ')
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDecorationOracle.java';helper=oracle.with_name('VanillaPlacementOracle.java')
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_feature_sort_parity.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/decoration_fixture.rs']
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_feature_sort_parity.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/decoration_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus(resources));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8')
|
||||
resource_path=build/'biome-features.json';resource_path.write_text(json.dumps(resources,separators=(',',':')),encoding='utf-8')
|
||||
@@ -75,10 +75,10 @@ def main():
|
||||
with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle,helper],'compile-java')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','decoration_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('decoration_fixture.exe' if os.name=='nt' else 'decoration_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'decoration_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
run(['java','-Xmx768M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaDecorationOracle',side,build],side)
|
||||
reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
|
||||
@@ -55,7 +55,7 @@ def main():
|
||||
placement_helper=oracle.with_name("VanillaPlacementOracle.java")
|
||||
sources=[oracle,helper,placement_helper,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_feature_region_parity.py",lab.ROOT/"tools/test_decoration_parity.py",lab.ROOT/"tools/test_feature_sort_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",
|
||||
lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/decoration_region_fixture.rs",lab.ROOT/"crates/horizon-world/examples/support/decoration_storage.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/decoration_region_fixture.rs",lab.ROOT/"crates/horizon-world/examples/probe/support/decoration_storage.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -73,10 +73,10 @@ def main():
|
||||
(build/"tags.json").write_text(json.dumps(tags,separators=(",",":")),encoding="utf-8")
|
||||
fixture_paths=[inputs,build/"tags.json",build/"facts-client.json",build/"facts-server.json"]
|
||||
tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","decoration_region_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("decoration_region_fixture.exe" if os.name=="nt" else "decoration_region_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"decoration_region_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build)
|
||||
|
||||
@@ -7,7 +7,9 @@ respawn_radius 0) and stops; a vanilla dedicated server and Horizon's
|
||||
server.properties, server-icon.png and lists. VanillaProtocolClient, a
|
||||
headless client made of vanilla's own codecs (any byte vanilla would not
|
||||
read is an error), pings each server, joins it in offline mode through
|
||||
login, configuration and play, accepts the spawn teleport, receives the
|
||||
login, configuration and play, accepts the spawn teleport (then, standing
|
||||
still until its death, sends its position every 20 ticks as LocalPlayer
|
||||
does: the server checks then which entities it sees), receives the
|
||||
chunks around the spawn (their bytes are compared: the world is loaded from
|
||||
the same files), chats, runs /list and commands that fail (`/random value
|
||||
7..7`, `/random value x`, `/trigger nope`), trades, is made an operator by
|
||||
@@ -244,6 +246,20 @@ def console_lines(lines):
|
||||
return out
|
||||
|
||||
|
||||
# What a failure's diff doesn't say: warnings, errors, panics and why a player left.
|
||||
NOTABLE = re.compile(r'/(WARN|ERROR)\]|Exception|panicked|lost connection')
|
||||
|
||||
|
||||
def notable_lines(path, limit=20):
|
||||
"""A server's notable lines from its `Done (` on (the startup warnings are every run's), or a client's."""
|
||||
try:
|
||||
lines = path.read_text(encoding='utf-8', errors='replace').splitlines()
|
||||
except OSError:
|
||||
return []
|
||||
start = next((i for i, l in enumerate(lines) if 'Done (' in l), 0)
|
||||
return [f'{path.name}: {l[:300]}' for l in lines[start:] if NOTABLE.search(l)][-limit:]
|
||||
|
||||
|
||||
def server_files(directory):
|
||||
out = []
|
||||
for name in ['server.properties', 'eula.txt', 'ops.json', 'whitelist.json', 'banned-players.json', 'banned-ips.json',
|
||||
@@ -420,9 +436,13 @@ def main():
|
||||
(world / 'playerdata').mkdir(exist_ok=True)
|
||||
|
||||
def client(port, out):
|
||||
oh.run_logged(['java', '-Xmx1g', '-Duser.timezone=UTC', '-cp', str(classes) + os.pathsep + dependencies,
|
||||
'dev.horizonlab.parity.VanillaProtocolClient', '127.0.0.1', port, PLAYER, out], build,
|
||||
out.stem, timeout=300)
|
||||
try:
|
||||
oh.run_logged(['java', '-Xmx1g', '-Duser.timezone=UTC', '-cp', str(classes) + os.pathsep + dependencies,
|
||||
'dev.horizonlab.parity.VanillaProtocolClient', '127.0.0.1', port, PLAYER, out], build,
|
||||
out.stem, timeout=300)
|
||||
except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as error:
|
||||
log = (build / f'{out.stem}.log').read_text(encoding='utf-8', errors='replace').splitlines()
|
||||
raise AssertionError(f'{out.stem}: {error}:\n' + '\n'.join(log[-30:])) from None
|
||||
|
||||
results = {}
|
||||
for label, command in [('vanilla', vanilla_server), ('horizon', horizon_server)]:
|
||||
@@ -448,8 +468,10 @@ def main():
|
||||
if a != b:
|
||||
differences.append(f'chunk {key}: vanilla {a} horizon {b}')
|
||||
if differences or errors:
|
||||
notes = [line for name in ('vanilla', 'vanilla-client', 'horizon', 'horizon-client')
|
||||
for line in notable_lines(build / f'{name}.log')]
|
||||
raise AssertionError(f'{len([d for d in differences if d[:1] in "+-" and d[:3] not in ("+++", "---")])} differing lines '
|
||||
f'(see {build}/vanilla.txt and horizon.txt):\n' + '\n'.join(differences[:80]))
|
||||
f'(see {build}/vanilla.txt and horizon.txt):\n' + '\n'.join(differences[:80] + notes))
|
||||
lab.write_json(report, dict(
|
||||
schema=1, minecraft=lock['minecraft']['version'], platform=platform.platform(),
|
||||
java=subprocess.check_output(['java', '--version'], text=True).splitlines()[0],
|
||||
|
||||
@@ -68,7 +68,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDynamicSupportOracle.java'
|
||||
helpers=[oracle.with_name(name+'.java') for name in ['VanillaFaceSupportOracle','VanillaBlockStateCodecOracle','VanillaCollisionOracle']]
|
||||
sources=[oracle,*helpers,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/dynamic_support_fixture.rs']
|
||||
sources=[oracle,*helpers,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/dynamic_support_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -82,10 +82,10 @@ def main():
|
||||
if len(states)!=199:raise ValueError('incomplete uncached support registry')
|
||||
fixtures=list(collision_corpus(facts,states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,build/'facts.json',build/'uncached-states.json',build/'block-registry.nbt',build/'cached-collision.nbt'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','dynamic_support_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('dynamic_support_fixture.exe' if os.name=='nt' else 'dynamic_support_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'dynamic_support_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -45,7 +45,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEdgeBackoffOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/edge_backoff_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/edge_backoff_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -56,10 +56,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEdgeBackoffOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','edge_backoff_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('edge_backoff_fixture.exe' if os.name=='nt' else 'edge_backoff_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'edge_backoff_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -112,7 +112,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEffectAttributeModifiersOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/effect_attribute_modifiers_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/effect_attribute_modifiers_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -123,10 +123,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEffectAttributeModifiersOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','effect_attribute_modifiers_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('effect_attribute_modifiers_fixture.exe' if os.name=='nt' else 'effect_attribute_modifiers_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'effect_attribute_modifiers_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -65,7 +65,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEffectNotificationsOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/effect_notifications_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/effect_notifications_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -76,14 +76,14 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEffectNotificationsOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','effect_notifications_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('effect_notifications_fixture.exe' if os.name=='nt' else 'effect_notifications_fixture')
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build)
|
||||
enriched=build/f'inputs-{side}.txt';enriched_hash=base.source_hashes([enriched])
|
||||
run([binary,build,side],'rust-'+side)
|
||||
run([binary,'effect_notifications_fixture',build,side],'rust-'+side)
|
||||
reference=build/f'{side}.txt';rust_output=build/f'rust-{side}.txt';matched=base.compare(reference,rust_output)
|
||||
base.ensure_sources_unchanged([enriched],enriched_hash)
|
||||
tested_fixtures.update(enriched_hash);fixture_paths.append(enriched)
|
||||
|
||||
@@ -101,7 +101,7 @@ def main():
|
||||
lab.ROOT / 'crates/horizon-core/Cargo.toml', lab.ROOT / 'crates/horizon-world/Cargo.toml',
|
||||
*sorted((lab.ROOT / 'crates/horizon-core/src').rglob('*.rs')),
|
||||
*sorted((lab.ROOT / 'crates/horizon-world/src').rglob('*.rs')),
|
||||
lab.ROOT / 'crates/horizon-world/examples/effect_sync_fixture.rs']
|
||||
lab.ROOT / 'crates/horizon-world/examples/probe/effect_sync_fixture.rs']
|
||||
tested_sources = base.source_hashes(sources)
|
||||
classes = build / 'classes'
|
||||
classes.mkdir(exist_ok=True)
|
||||
@@ -129,16 +129,16 @@ def main():
|
||||
inputs.write_text(''.join(json.dumps(row, separators=(',', ':')) + '\n' for row in fixtures), encoding='utf-8')
|
||||
fixture_paths = [inputs, build / 'catalog.json', build / 'catalog-client.json', build / 'catalog-server.json']
|
||||
tested_fixtures = base.source_hashes(fixture_paths)
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-world', '--example', 'effect_sync_fixture'], 'compile-rust')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-world', '--example', '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' / ('effect_sync_fixture.exe' if os.name == 'nt' else 'effect_sync_fixture')
|
||||
binary = Path(metadata['target_directory']) / 'release/examples' / ('probe.exe' if os.name=='nt' else 'probe')
|
||||
references = []
|
||||
for side, jar in jars.items():
|
||||
java(side, side)
|
||||
enriched = build / f'inputs-{side}.txt'
|
||||
fixture_paths.append(enriched)
|
||||
tested_fixtures.update(base.source_hashes([enriched]))
|
||||
run([binary, build, side], 'rust-' + side)
|
||||
run([binary, 'effect_sync_fixture', build, side], 'rust-' + side)
|
||||
reference = build / f'{side}.txt'
|
||||
candidate = build / f'rust-{side}.txt'
|
||||
matched = base.compare(reference, candidate)
|
||||
|
||||
@@ -42,7 +42,7 @@ def main():
|
||||
catalog = json.loads((resources / 'items.json').read_text())
|
||||
items = sorted(k for k, v in catalog.items() if 'minecraft:enchantable' in v)
|
||||
oracle = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEnchantingOracle.java'
|
||||
sources = [oracle, Path(__file__), lab.ROOT / 'crates/horizon-client/examples/enchanting_fixture.rs',
|
||||
sources = [oracle, Path(__file__), lab.ROOT / 'crates/horizon-client/examples/probe/enchanting_fixture.rs',
|
||||
*sorted((lab.ROOT / 'crates/horizon-client/src').glob('*.rs'))]
|
||||
tested = base.source_hashes(sources)
|
||||
inputs = build / 'inputs.txt'
|
||||
@@ -56,10 +56,10 @@ 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', 'enchanting_fixture'], 'compile-rust')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', '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' / ('enchanting_fixture.exe' if os.name == 'nt' else 'enchanting_fixture')
|
||||
run([binary, resources, inputs, build / 'rust.txt'], 'rust')
|
||||
binary = Path(metadata['target_directory']) / 'release/examples' / ('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary, 'enchanting_fixture',resources, inputs, build / 'rust.txt'], 'rust')
|
||||
references = []
|
||||
for side in ['server']:
|
||||
run(['java', '-Xmx1G', '-cp', os.pathsep.join([str(classes), str(jars[side]), deps]), 'dev.horizonlab.parity.VanillaEnchantingOracle', inputs, build / f'{side}.txt'], side)
|
||||
|
||||
@@ -43,7 +43,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityAttributeOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_attribute_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/entity_attribute_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -54,10 +54,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityAttributeOracle',mode,path],side+'-'+mode)
|
||||
java('server','export',build);states=json.loads((build/'catalog.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,build/'catalog.json'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','entity_attribute_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('entity_attribute_fixture.exe' if os.name=='nt' else 'entity_attribute_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'entity_attribute_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -54,7 +54,7 @@ def main():
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityCollisionOracle.java'
|
||||
helper=oracle.with_name('VanillaFaceSupportOracle.java')
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_collision_fixture.rs']
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/entity_collision_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -65,10 +65,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityCollisionOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','entity_collision_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('entity_collision_fixture.exe' if os.name=='nt' else 'entity_collision_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'entity_collision_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -122,7 +122,7 @@ def main():
|
||||
tables = resources / 'data/minecraft/loot_table/entities'
|
||||
types = sorted('minecraft:' + p.stem for p in tables.glob('*.json') if p.stem not in SKIPPED)
|
||||
oracle = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityDeathLootOracle.java'
|
||||
sources = [oracle, Path(__file__), lab.ROOT / 'crates/horizon-client/examples/entity_death_loot_fixture.rs',
|
||||
sources = [oracle, Path(__file__), lab.ROOT / 'crates/horizon-client/examples/probe/entity_death_loot_fixture.rs',
|
||||
lab.ROOT / 'crates/horizon-client/src/mobs/drops.rs', lab.ROOT / 'crates/horizon-world/src/loot.rs']
|
||||
tested = base.source_hashes(sources)
|
||||
inputs = build / 'inputs.txt'
|
||||
@@ -139,10 +139,10 @@ 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', 'entity_death_loot_fixture'], 'compile-rust')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', '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/entity_death_loot_fixture'
|
||||
run([binary, resources, inputs, build / 'rust.txt'], 'rust')
|
||||
binary = Path(metadata['target_directory']) / 'release/examples/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:
|
||||
raise SystemExit(f'oracle errors ({len(errors)}): {errors[:5]}')
|
||||
|
||||
@@ -68,7 +68,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_fluid_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/entity_fluid_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -79,10 +79,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityFluidOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','entity_fluid_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('entity_fluid_fixture.exe' if os.name=='nt' else 'entity_fluid_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'entity_fluid_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -53,7 +53,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityFluidOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_entity_fluid_parity.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_fluid_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_entity_fluid_parity.py',lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/entity_fluid_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -64,10 +64,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityFluidOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','entity_fluid_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('entity_fluid_fixture.exe' if os.name=='nt' else 'entity_fluid_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'entity_fluid_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
The Java oracle bakes each vanilla model layer, builds the model's own render
|
||||
state class with the generated walk/age/head/attack inputs (plus per-species
|
||||
state fields), runs the real `setupAnim` and writes every part's pose.
|
||||
`examples/entity_anim_fixture` replays the same inputs through Horizon's
|
||||
`examples/probe/entity_anim_fixture` replays the same inputs through Horizon's
|
||||
`mobs::anim::setup` and the loaded model tree; the two must agree on every part
|
||||
pose and on the baked polygon count and vertex sums.
|
||||
|
||||
@@ -364,8 +364,8 @@ def main():
|
||||
run(['javac', '--release', lock['minecraft']['java_major'], '-proc:none', '-cp', dependencies, '-d', classes, oracle], 'compile-java')
|
||||
run(['java', '-Xmx1G', '-cp', str(classes) + os.pathsep + dependencies, 'dev.horizonlab.parity.VanillaEntityAnimOracle',
|
||||
inputs, build / 'vanilla.jsonl', jars['client']], 'vanilla')
|
||||
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'entity_anim_fixture', '--',
|
||||
resources, build / 'vanilla.jsonl', build / 'rust.jsonl'], 'rust')
|
||||
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--',
|
||||
'entity_anim_fixture', resources, build / 'vanilla.jsonl', 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()]
|
||||
assert len(vanilla) == len(rust), (len(vanilla), len(rust))
|
||||
|
||||
@@ -45,7 +45,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityMoveOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_move_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/entity_move_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -56,10 +56,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityMoveOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','entity_move_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('entity_move_fixture.exe' if os.name=='nt' else 'entity_move_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'entity_move_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -50,7 +50,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaEntityObstructionOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/entity_obstruction_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/entity_obstruction_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -61,10 +61,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaEntityObstructionOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','entity_obstruction_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('entity_obstruction_fixture.exe' if os.name=='nt' else 'entity_obstruction_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'entity_obstruction_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -74,13 +74,13 @@ def main():
|
||||
'tools/test_entity_particles_parity.py', 'tools/oracle_harness.py', 'tools/test_rust_parity.py', 'tools/lab.py',
|
||||
f'mods/horizon/src/test/java/dev/horizonlab/parity/{oracle}.java', 'Cargo.toml', 'Cargo.lock',
|
||||
'crates/horizon-client/Cargo.toml', 'crates/horizon-client/src/particles.rs',
|
||||
f'crates/horizon-client/examples/{probe}.rs', 'crates/horizon-core/src/random.rs']]
|
||||
f'crates/horizon-client/examples/probe/{probe}.rs', 'crates/horizon-core/src/random.rs']]
|
||||
tested = base.source_hashes(sources)
|
||||
cases_path, units = make_cases(build)
|
||||
classes, dependencies, _ = harness.compile_oracle(build, oracle, jars, baking.client_libraries(),
|
||||
lock['minecraft']['java_major'])
|
||||
binary = harness.build_probe(build, probe)
|
||||
harness.run_logged([binary, cases_path, build / 'rust.txt'], build, 'rust')
|
||||
command = harness.build_probe(build, probe)
|
||||
harness.run_logged([*command, cases_path, build / 'rust.txt'], build, 'rust')
|
||||
harness.java_run(build, classes, dependencies, oracle, [cases_path, build / 'client.txt'], 'client')
|
||||
vanilla = (build / 'client.txt').read_text().splitlines()
|
||||
rust = (build / 'rust.txt').read_text().splitlines()
|
||||
|
||||
@@ -5,7 +5,7 @@ The Java oracle builds vanilla's `EnvironmentAttributeSystem` from the data pack
|
||||
(dimension attributes, one biome's attributes, the dimension timelines and the
|
||||
weather layers) and prints every visual/gameplay attribute for a grid of
|
||||
dimensions, world times, rain/thunder levels and biomes.
|
||||
`examples/environment_fixture` samples the same cases through Horizon's
|
||||
`examples/probe/environment_fixture` samples the same cases through Horizon's
|
||||
`Environment::sample` + `apply_weather`; every attribute Horizon computes must
|
||||
agree with vanilla.
|
||||
|
||||
@@ -66,8 +66,8 @@ def main():
|
||||
'-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.VanillaEnvironmentOracle', inputs, build / 'vanilla.jsonl'], 'vanilla')
|
||||
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'environment_fixture', '--',
|
||||
resources, inputs, build / 'rust.jsonl'], 'rust')
|
||||
run(['cargo', 'run', '--quiet', '--profile', 'fast', '-p', 'horizon-client', '--example', 'probe', '--',
|
||||
'environment_fixture', resources, 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()]
|
||||
assert len(vanilla) == len(rust), (len(vanilla), len(rust))
|
||||
|
||||
@@ -56,7 +56,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaExtraItemsOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/extra_items_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/extra_items_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -67,10 +67,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaExtraItemsOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','extra_items_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('extra_items_fixture.exe' if os.name=='nt' else 'extra_items_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'extra_items_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -50,7 +50,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceSupportOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/face_support_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/face_support_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -61,10 +61,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFaceSupportOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','face_support_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('face_support_fixture.exe' if os.name=='nt' else 'face_support_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'face_support_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -49,7 +49,7 @@ def main():
|
||||
oracle = lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFaceVisibilityOracle.java'
|
||||
helpers = [oracle.with_name(name) for name in ['VanillaCollisionOracle.java','VanillaHeightmapOracle.java']]
|
||||
sources = [oracle,*helpers,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/test_worldgen_parity.py',lab.ROOT/'tools/lab.py',
|
||||
lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/face_visibility_fixture.rs']
|
||||
lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-world/examples/probe/face_visibility_fixture.rs']
|
||||
for crate in ['horizon-core','horizon-world']:
|
||||
sources += [lab.ROOT/'crates'/crate/'Cargo.toml',*sorted((lab.ROOT/'crates'/crate/'src').rglob('*.rs'))]
|
||||
tested = base.source_hashes(sources)
|
||||
@@ -71,10 +71,10 @@ def main():
|
||||
for a,b in pairs(definitions):output.write(f'{a} {b}\n');pair_count+=1
|
||||
fixture_paths = [build/name for name in ['pairs.txt','block-registry.nbt','occlusion.nbt','definitions.json','tags.json']]
|
||||
fixtures = base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--locked','--release','-p','horizon-world','--example','face_visibility_fixture'],'compile-rust')
|
||||
run(['cargo','build','--locked','--release','-p','horizon-world','--example','probe'],'compile-rust')
|
||||
metadata = json.loads(subprocess.check_output(['cargo','metadata','--locked','--no-deps','--format-version','1'],cwd=lab.ROOT))
|
||||
binary = Path(metadata['target_directory'])/'release/examples'/('face_visibility_fixture.exe' if os.name=='nt' else 'face_visibility_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary = Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'face_visibility_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side)
|
||||
matched = base.compare(build/(side+'.txt'),build/'rust.txt')
|
||||
|
||||
@@ -46,7 +46,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFallDamageOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/fall_damage_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/fall_damage_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -57,10 +57,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFallDamageOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','fall_damage_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('fall_damage_fixture.exe' if os.name=='nt' else 'fall_damage_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'fall_damage_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -85,7 +85,7 @@ def main():
|
||||
helper=oracle.with_name("VanillaPlacementOracle.java")
|
||||
state_helper=oracle.with_name("VanillaBlockStateCodecOracle.java")
|
||||
sources=[oracle,helper,state_helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/feature_catalog_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/feature_catalog_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8")
|
||||
resources=build/"catalog.json";resources.write_text(json.dumps(catalog(),separators=(",",":")),encoding="utf-8")
|
||||
@@ -100,10 +100,10 @@ def main():
|
||||
fixture_paths.append(path)
|
||||
if json.loads((build/"facts-client.json").read_text())!=json.loads((build/"facts-server.json").read_text()):raise ValueError("reference feature block states differ")
|
||||
tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","feature_catalog_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("feature_catalog_fixture.exe" if os.name=="nt" else "feature_catalog_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"feature_catalog_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -69,7 +69,7 @@ def main():
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureGraphOracle.java"
|
||||
helper=oracle.with_name("VanillaPlacementOracle.java")
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/feature_graph_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/feature_graph_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8")
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
@@ -83,10 +83,10 @@ def main():
|
||||
fixture_paths.append(path)
|
||||
if json.loads((build/"facts-client.json").read_text())!=json.loads((build/"facts-server.json").read_text()):raise ValueError("reference feature block states differ")
|
||||
tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","feature_graph_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("feature_graph_fixture.exe" if os.name=="nt" else "feature_graph_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"feature_graph_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -79,7 +79,7 @@ def main():
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeaturePlacementOracle.java"
|
||||
helper=oracle.with_name("VanillaPlacementOracle.java")
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/feature_placement_fixture.rs",lab.ROOT/"crates/horizon-world/examples/support/placement_queries.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/feature_placement_fixture.rs",lab.ROOT/"crates/horizon-world/examples/probe/support/placement_queries.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus());inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8")
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths);classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
@@ -87,10 +87,10 @@ def main():
|
||||
with (build/(name+".log")).open("w",encoding="utf-8") as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(["javac","--release",lock["minecraft"]["java_major"],"-proc:none","-cp",str(jars["server"])+os.pathsep+dependency_path,"-d",classes,oracle,helper],"compile-java")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","feature_placement_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("feature_placement_fixture.exe" if os.name=="nt" else "feature_placement_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"feature_placement_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -75,7 +75,7 @@ def main():
|
||||
placement_helper=oracle.with_name("VanillaPlacementOracle.java")
|
||||
sources=[oracle,helper,placement_helper,Path(__file__),lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",
|
||||
lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/feature_region_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/feature_region_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -107,10 +107,10 @@ def main():
|
||||
height_inputs=build/'heights.json';height_inputs.write_text(json.dumps(heights,separators=(',',':')))
|
||||
fixture_paths=[height_inputs,zone_inputs,inputs,build/"tags.json",build/"fluid-tags.json",build/"facts-client.json",build/"facts-server.json"]
|
||||
tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","feature_region_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("feature_region_fixture.exe" if os.name=="nt" else "feature_region_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"feature_region_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build)
|
||||
|
||||
@@ -54,7 +54,7 @@ def main():
|
||||
resources=biome_features(jars['server'])
|
||||
if len(resources)!=67 or resources!=biome_features(jars['client']):raise ValueError('pinned biome feature resources differ')
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFeatureSortOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/feature_sort_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/feature_sort_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixtures=list(corpus(resources));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(f,separators=(',',':'))+'\n' for f in fixtures),encoding='utf-8')
|
||||
resource_path=build/'biome-features.json';resource_path.write_text(json.dumps(resources,separators=(',',':')),encoding='utf-8')
|
||||
@@ -64,10 +64,10 @@ def main():
|
||||
with (build/(name+'.log')).open('w',encoding='utf-8') as log:base.run(list(map(str,command)),stdout=log,stderr=subprocess.STDOUT)
|
||||
dependency_path=os.pathsep.join(map(str,libraries))
|
||||
run(['javac','--release',lock['minecraft']['java_major'],'-proc:none','-sourcepath',str(lab.ROOT/'mods/horizon/src/test/java'),'-cp',str(jars['server'])+os.pathsep+dependency_path,'-d',classes,oracle],'compile-java')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','feature_sort_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('feature_sort_fixture.exe' if os.name=='nt' else 'feature_sort_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'feature_sort_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jar),dependency_path]),'dev.horizonlab.parity.VanillaFeatureSortOracle',side,build],side)
|
||||
reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
|
||||
@@ -42,7 +42,7 @@ def main():
|
||||
oracle=lab.ROOT/"mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFillLayerOracle.java"
|
||||
helper=oracle.with_name("VanillaBlockStateCodecOracle.java")
|
||||
sources=[oracle,helper,Path(__file__),lab.ROOT/"tools/test_worldgen_parity.py",lab.ROOT/"tools/test_rust_parity.py",lab.ROOT/"tools/lab.py",lab.ROOT/"Cargo.toml",lab.ROOT/"Cargo.lock",lab.ROOT/"crates/horizon-core/Cargo.toml",lab.ROOT/"crates/horizon-world/Cargo.toml",
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/fill_layer_fixture.rs"]
|
||||
*sorted((lab.ROOT/"crates/horizon-core/src").rglob("*.rs")),*sorted((lab.ROOT/"crates/horizon-world/src").rglob("*.rs")),lab.ROOT/"crates/horizon-world/examples/probe/fill_layer_fixture.rs"]
|
||||
tested_sources=base.source_hashes(sources)
|
||||
fixture_paths=[];classes=build/"classes";classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -60,10 +60,10 @@ def main():
|
||||
fixtures=list(corpus(facts));inputs=build/"inputs.txt";inputs.write_text("".join(json.dumps(f,separators=(",",":"))+"\n" for f in fixtures),encoding="utf-8")
|
||||
fixture_paths.append(inputs)
|
||||
tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","fill_layer_fixture"],"compile-rust")
|
||||
run(["cargo","build","--release","-p","horizon-world","--example","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"/("fill_layer_fixture.exe" if os.name=="nt" else "fill_layer_fixture")
|
||||
run([binary,build],"rust")
|
||||
binary=Path(metadata["target_directory"])/"release/examples"/("probe.exe" if os.name=="nt" else "probe")
|
||||
run([binary,"fill_layer_fixture",build],"rust")
|
||||
references=[]
|
||||
for side,jar in jars.items():
|
||||
reference=build/f"{side}.txt"
|
||||
|
||||
@@ -118,7 +118,7 @@ def main():
|
||||
lock, jars, libraries = base.verify_artifacts()
|
||||
resources = lab.RESOURCES
|
||||
oracle = lab.ROOT / 'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFinalizeSpawnOracle.java'
|
||||
sources = [oracle, Path(__file__), lab.ROOT / 'crates/horizon-client/examples/finalize_spawn_fixture.rs',
|
||||
sources = [oracle, Path(__file__), lab.ROOT / 'crates/horizon-client/examples/probe/finalize_spawn_fixture.rs',
|
||||
lab.ROOT / 'crates/horizon-client/src/mobs/finalize.rs']
|
||||
tested = base.source_hashes([s for s in sources if s.exists()])
|
||||
inputs = build / 'inputs.txt'
|
||||
@@ -148,10 +148,10 @@ def main():
|
||||
print(f'{len(vanilla)} oracle lines')
|
||||
return
|
||||
halloween = vanilla[0].split()[1]
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', 'finalize_spawn_fixture'], 'compile-rust')
|
||||
run(['cargo', 'build', '--release', '-p', 'horizon-client', '--example', '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/finalize_spawn_fixture'
|
||||
run([binary, resources, inputs, build / 'rust.txt', halloween], 'rust')
|
||||
binary = Path(metadata['target_directory']) / 'release/examples/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]
|
||||
if bad or len(vanilla) != len(rust):
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Random rockets (flight durations 0 to 3 and higher, up to six explosions, runs of equal ones) and stars, with dye and
|
||||
custom colours, fade colours, trails and twinkles, some without the component (a rocket's default) and some whose
|
||||
tooltip_display hides it. Vanilla prints what `Fireworks.addToTooltip` and `FireworkExplosion.addToTooltip` add
|
||||
(VanillaFireworkTooltipOracle); Horizon what `item_tooltip::firework_lines` gives (examples/firework_tooltip_fixture).
|
||||
(VanillaFireworkTooltipOracle); Horizon what `item_tooltip::firework_lines` gives (examples/probe/firework_tooltip_fixture).
|
||||
"""
|
||||
import random
|
||||
try:
|
||||
|
||||
@@ -47,7 +47,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidBoxOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/fluid_box_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/fluid_box_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -58,10 +58,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFluidBoxOracle',mode,path],side+'-'+mode)
|
||||
fixtures=list(corpus());inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','fluid_box_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('fluid_box_fixture.exe' if os.name=='nt' else 'fluid_box_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'fluid_box_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
@@ -56,7 +56,7 @@ def main():
|
||||
if args.prepare:lab.prepare()
|
||||
lock,jars,libraries=base.verify_artifacts()
|
||||
oracle=lab.ROOT/'mods/horizon/src/test/java/dev/horizonlab/parity/VanillaFluidFlowOracle.java'
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/fluid_flow_fixture.rs']
|
||||
sources=[oracle,Path(__file__),lab.ROOT/'tools/test_rust_parity.py',lab.ROOT/'tools/lab.py',lab.ROOT/'Cargo.toml',lab.ROOT/'Cargo.lock',lab.ROOT/'crates/horizon-core/Cargo.toml',lab.ROOT/'crates/horizon-world/Cargo.toml',*sorted((lab.ROOT/'crates/horizon-core/src').rglob('*.rs')),*sorted((lab.ROOT/'crates/horizon-world/src').rglob('*.rs')),lab.ROOT/'crates/horizon-world/examples/probe/fluid_flow_fixture.rs']
|
||||
tested_sources=base.source_hashes(sources)
|
||||
classes=build/'classes';classes.mkdir(exist_ok=True)
|
||||
def run(command,name):
|
||||
@@ -67,10 +67,10 @@ def main():
|
||||
run(['java','-Xmx512M','-cp',os.pathsep.join([str(classes),str(jars[side]),dependency_path]),'dev.horizonlab.parity.VanillaFluidFlowOracle',mode,path],side+'-'+mode)
|
||||
java('server','export',build);states=json.loads((build/'fluid-states.json').read_text());fixtures=list(corpus(states));inputs=build/'inputs.txt';inputs.write_text(''.join(json.dumps(value,separators=(',',':'))+'\n' for value in fixtures),encoding='utf-8')
|
||||
fixture_paths=[inputs,build/'fluid-states.json'];tested_fixtures=base.source_hashes(fixture_paths)
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','fluid_flow_fixture'],'compile-rust')
|
||||
run(['cargo','build','--release','-p','horizon-world','--example','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'/('fluid_flow_fixture.exe' if os.name=='nt' else 'fluid_flow_fixture')
|
||||
run([binary,build],'rust');references=[]
|
||||
binary=Path(metadata['target_directory'])/'release/examples'/('probe.exe' if os.name=='nt' else 'probe')
|
||||
run([binary,'fluid_flow_fixture',build],'rust');references=[]
|
||||
for side,jar in jars.items():
|
||||
java(side,side,build);reference=build/f'{side}.txt';matched=base.compare(reference,build/'rust.txt')
|
||||
references.append({'side':side,'jar_sha256':lab.digest(jar,'sha256'),'output_sha256':lab.digest(reference,'sha256'),'matched_output_lines':matched})
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user