Breeze builds and runs with no raylib anywhere, on Ziran 7fbc8152 and Kryon b5a61b37, with plot, entity, apps, css and game2d pinned to that Kryon, so the lock has one Kryon and no raylib package. - Linux and Windows run on Kryon's SDL2 and Cairo desktop host; WebP decodes with the linked libwebp (KRYON_WEBP_LINKED). - Android owns its NativeActivity loop on Kryon's android_runtime: Pixmap on the activity's surface, android_touch input and Android's typefaces, paced to the app's frame target. The CMake build drops breeze_raylib, GLES and the raylib link wraps, and links Kryon's fopen wrapper. - The browser reaches Kryon's canvas modules directly. - Audio is Ziran's std audio: its mixer, the SDL, AAudio and OpenSL ES sinks, the WAV, MP3 and Vorbis decoders and the audio package's Opus. The MP3 and Vorbis archives come from Ziran's own codec recipes. The browser keeps Kryon's Web Audio. - Host modules choose the desktop host, Android, the canvas or, for native tests that select none, a headless host with no window, input or audio device. host_keys.zi and text_input_host.zi replace raylib_host.zi and raylib_text_input.zi; the log is one implementation, with logcat on Android and the C runtime's open flags on Windows. - The Makefile, Click packaging, CI and release workflows build no raylib. - Tests: radio, app log, asset files, DPI, legacy sessions, sync recovery and the Android JNI bridge run without raylib stubs; voice playback is a Ziran test of real Ogg Opus narration through Ziran's mixer. Tests that only exercised raylib internals are removed. - AppsControllerSha256 is the controller built from Apps b96d9afe on this graph. Local tests: Linux desktop window, Habits UI and the Ziran and native tests above pass on a private Xvfb; the Android debug APK runs on a Pixel 4a; the Windows package runs under Wine on a private Xvfb. Co-Authored-By: Claude Opus 5.5 <[email protected]>
113 lines
5.5 KiB
Python
113 lines
5.5 KiB
Python
"""Exercise WHM rendering with a synthetic profile and an owned private display."""
|
|
import ast
|
|
import contextlib
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
import time
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
OUTPUT = ROOT / "build/whm-animation-test"
|
|
OUTPUT.mkdir(parents=True, exist_ok=True)
|
|
DISPLAY_KEYS = ("DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS")
|
|
assert all(not os.environ.get(key) for key in DISPLAY_KEYS)
|
|
BINARY = Path(sys.argv[1]).resolve()
|
|
|
|
|
|
def stop(process):
|
|
if process.poll() is None:
|
|
process.terminate()
|
|
try:
|
|
process.wait(timeout=5)
|
|
except subprocess.TimeoutExpired:
|
|
process.kill()
|
|
process.wait(timeout=5)
|
|
|
|
|
|
with tempfile.TemporaryDirectory(prefix="inbe-whm-frames-") as temporary, contextlib.ExitStack() as stack:
|
|
env = {key: value for key, value in os.environ.items() if key not in DISPLAY_KEYS}
|
|
env.update(APP_DATA_ROOT=temporary, APP_NO_TRAY="1", APP_PROFILE="1",
|
|
SDL_AUDIODRIVER="dummy", SDL_VIDEODRIVER="x11", LIBGL_ALWAYS_SOFTWARE="1",
|
|
YUE_DESKTOP_RECOVERY="0", INBE_DEBUG_ROUTE="1")
|
|
log_path = OUTPUT / "frames.log"
|
|
log = stack.enter_context(log_path.open("w"))
|
|
display = subprocess.Popen(["Xvfb", "-noreset", "-displayfd", "1", "-screen", "0", "1080x1000x24",
|
|
"-nolisten", "tcp"], env=env, stdout=subprocess.PIPE, stderr=log)
|
|
stack.callback(stop, display)
|
|
number = display.stdout.readline().decode().strip()
|
|
display.stdout.close()
|
|
assert number.isdecimal(), "Private display did not start"
|
|
env["DISPLAY"] = ":" + number
|
|
app = subprocess.Popen([str(BINARY), "--bundle", str(ROOT / "build/inbe-full.zx")],
|
|
cwd=ROOT, env=env, stdout=log, stderr=log)
|
|
stack.callback(stop, app)
|
|
|
|
def command(*arguments):
|
|
return subprocess.check_output(arguments, env=env, text=True, timeout=5).strip()
|
|
|
|
def wait(read, predicate, label):
|
|
deadline = time.monotonic() + 20
|
|
while time.monotonic() < deadline:
|
|
assert app.poll() is None, log_path.read_text()[-2000:]
|
|
try:
|
|
value = read()
|
|
if predicate(value):
|
|
return value
|
|
except (subprocess.CalledProcessError, ValueError, SyntaxError, IndexError):
|
|
pass
|
|
time.sleep(0.05)
|
|
raise AssertionError(label)
|
|
|
|
window = wait(lambda: command("xdotool", "search", "--onlyvisible", "--pid", str(app.pid))
|
|
.splitlines()[0], bool, "Owned app window")
|
|
command("xdotool", "windowsize", window, "390", "844")
|
|
command("xdotool", "windowfocus", window)
|
|
|
|
def state():
|
|
prop = command("xprop", "-id", window, "_HARMONY_APP_STATE")
|
|
return json.loads(ast.literal_eval(prop.split(" = ", 1)[1]))
|
|
|
|
wait(state, lambda value: value.get("interface") == "harmony.app-state.v1", "App state")
|
|
command("xprop", "-id", window, "-f", "_HARMONY_APP_ACTION", "8s", "-set",
|
|
"_HARMONY_APP_ACTION", json.dumps({"control": "practice.whm.start", "request_id": "whm-frames"}))
|
|
started = wait(state, lambda value: value.get("last_request_id") == "whm-frames" and
|
|
value.get("last_request_ok") and value.get("practice_running"), "WHM start")
|
|
initial_reports = len(re.findall(r"PROFILE: frame", log_path.read_text()))
|
|
deadline = time.monotonic() + 14
|
|
while time.monotonic() < deadline:
|
|
assert app.poll() is None, "Owned test app exited"
|
|
time.sleep(0.1)
|
|
progressed = state()
|
|
assert progressed["practice_running"] and not progressed["paused"]
|
|
assert (progressed["round"], progressed["breath"]) > (started["round"], started["breath"])
|
|
reports = re.findall(r"PROFILE: frame avg=([\d.]+) max=([\d.]+).*?sync avg=([\d.]+) "
|
|
r"max=([\d.]+) fps=([\d.]+)", log_path.read_text())[initial_reports + 1:]
|
|
assert len(reports) >= 4, "Not enough measured animation frames"
|
|
measurements = [{"cpuAverageMs": float(cpu), "cpuMaxMs": float(peak),
|
|
"syncAverageMs": float(sync), "syncMaxMs": float(sync_peak), "fps": float(fps)}
|
|
for cpu, peak, sync, sync_peak, fps in reports]
|
|
assert min(row["fps"] for row in measurements) >= 55, measurements
|
|
assert max(row["cpuAverageMs"] for row in measurements) < 8, measurements
|
|
# Leaving returns to the start screen without reloading the app, which
|
|
# froze phones for seconds.
|
|
command("xprop", "-id", window, "-f", "_HARMONY_APP_ACTION", "8s", "-set",
|
|
"_HARMONY_APP_ACTION", json.dumps({"control": "practice.pause", "request_id": "whm-pause"}))
|
|
wait(state, lambda value: value.get("last_request_id") == "whm-pause" and value.get("paused"),
|
|
"WHM pause")
|
|
# Held across frames, so the press and release land in different frames.
|
|
command("xdotool", "keydown", "BackSpace")
|
|
time.sleep(0.15)
|
|
command("xdotool", "keyup", "BackSpace")
|
|
wait(state, lambda value: not value.get("practice_running") and not value.get("paused"), "WHM exit")
|
|
initialized = log_path.read_text().count("APP PROBE: data initialized")
|
|
assert initialized == 1, f"Leaving WHM initialized the app again ({initialized} times)"
|
|
result = {"passed": True, "privateDisplay": True, "syntheticProfile": True,
|
|
"screenshots": False, "practiceContinued": True, "leftWithoutReload": True,
|
|
"measurements": measurements}
|
|
(OUTPUT / "frames.json").write_text(json.dumps(result, indent=2) + "\n")
|
|
print(json.dumps(result))
|