Files
spoopyghosty0--frameport/tests/test_parity.py
T
spoopyghosty0 23a47880e0 Lines within 120 columns everywhere (CI lints without exceptions); community and licence files; docs updated
- reflowed long lines (texts unchanged; generated launcher/PowerShell/README texts byte-identical)
- CONTRIBUTING, SECURITY, CODE_OF_CONDUCT, THIRD_PARTY_NOTICES; pyproject metadata (SPDX licence, authors, urls,
  classifiers, keywords)
- maintainer-only notes moved to a git-ignored CLAUDE.local.md; CLAUDE.md facts updated
- README: what kinds of apps run and how; INSTALL: PC VR and Files wording, new labels
2026-10-02 14:18:41 -04:00

51 lines
2.1 KiB
Python

import json
from frameport.analysis import elf
from frameport.analysis.stubgen import build_stub_library
from frameport.parity import classify
from frameport.report import render
def test_stub_libraries_equivalent():
a = build_stub_library(["ovr_A", "ovr_B"])
b = build_stub_library(["ovr_B", "ovr_A"], abi="arm64-v8a") + b"\0" * 16 # different bytes, same exports
assert classify("lib/arm64-v8a/libovrstubs.so", a, b)[0] == "equivalent"
c = build_stub_library(["ovr_A"])
assert classify("lib/arm64-v8a/libovrstubs.so", a, c)[0] == "UNEXPLAINED"
def test_needed_layout_equivalent():
base = build_stub_library(["f"], soname="libgame.so")
one = elf.add_needed(base, "libglshim.so")
two = elf.add_needed(base + b"", "libglshim.so")
assert classify("lib/arm64-v8a/libgame.so", one, two)[0] in ("equivalent",) or one == two
def test_settings_classification():
kind, why = classify("lib/arm64-v8a/libframe_settings.so", b"scale=1.0\nscene_emul=1\n",
b"scene_emul=1\nscale=1.0\n")
assert kind == "equivalent"
def test_report_counts():
text = render()
from frameport.recommend import catalog
works = sum(1 for e in catalog.load().values() if e.status == "works")
assert f"{works} work" in text and "Path of the Warrior" in text
def test_ovrport_125_config_and_compat_are_expected():
from frameport import parity
from frameport.analysis.stubgen import build_stub_library
def cfg(by):
cfg = {"version": 1, "patched": {"by": by, "with": "3.4.3-23204ea", "patches": ["patch_copy_libraries"]}}
return b"\0\0" + json.dumps(cfg, separators=(",", ":")).encode() + b"\0"
kind, why = parity.classify("lib/arm64-v8a/liboverport.config.so", cfg("1.2.5"), cfg("1.2.3"))
assert kind == "expected" and "1.2.5" in why
assert parity.classify("lib/arm64-v8a/liboverport.config.so", cfg("1.2.5").replace(b"3.4.3", b"3.4.4"),
cfg("1.2.3"))[0] == "UNEXPLAINED"
compat = build_stub_library(["ovrMessageType_ToString"], soname="libovrplatformcompat.so")
assert parity._compat_export(compat)