"""Upstream fixes replacing our workarounds per build (patches/upstream.py).""" import struct import zipfile from pathlib import Path import pytest from frameport import build from frameport.core.events import Reporter from frameport.core.models import Analysis, Recipe from frameport.patches import base, upstream from frameport.patches.frame.haptic_envelope import envelope_duration_fixed from frameport.patches.frame.ovr_microphone import microphone_checked FIXTURES = Path(__file__).with_name("fixtures") OLD = (FIXTURES / "libfakeruntime_old_arm64.so").read_bytes() # OVRPort runtime 3.4.3-23204ea's code FIXED = (FIXTURES / "libfakeruntime_fixed_arm64.so").read_bytes() # 3.4.3-aa54c3f's class FakeWs: abi = "arm64-v8a" def __init__(self, libs): self.libs = libs def lib(self, name): return f"lib/{self.abi}/{name}" def has(self, path): return path.rsplit("/", 1)[-1] in self.libs def read_lib(self, name): return self.libs[name] class Log(Reporter): def __init__(self): super().__init__() self.lines = [] def log(self, msg, *a, **k): self.lines.append(msg) @pytest.fixture def temp_fix(): added = [] def add(**kw): fix = upstream.register(upstream.UpstreamFix(**{"title": "t", "upstream": "u", **kw})) added.append(fix.id) return fix yield add for fid in added: upstream.REGISTRY.pop(fid, None) def test_move_wide_constants(): # mov x8, #0xcd6500000000 ; movk x8, #0x41cd, lsl #48 (1e9 as a double) words = [0xD2800000 | 2 << 21 | 0xCD65 << 5 | 8, 0xF2800000 | 3 << 21 | 0x41CD << 5 | 8] assert struct.pack("