Validate release RPM installs and GUI startup on target distributions

This commit is contained in:
Codex committed 2026-11-29 20:47:54 +01:00
1 parent 9bbc3950e1
commit 152a4ac5f6
2 files changed
+151

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
"""Check a real installed release RPM and exercise the GUI control channel."""
import json
import os
from pathlib import Path
import socket
import subprocess
import time
results = Path("/results")
requirements = (results / "rpm-requires.txt").read_text()
for capability in (
"libc.so.6()(64bit)",
"libm.so.6(GLIBC_2.35)(64bit)",
"libgcc_s.so.1()(64bit)",
"libxkbcommon.so.0()(64bit)",
"(libvulkan.so.1()(64bit) or libEGL.so.1()(64bit))",
):
if capability not in requirements.splitlines():
raise RuntimeError(f"Missing RPM requirement: {capability}")
version = subprocess.check_output(["vectorcraft-cli", "--version"], text=True)
(results / "cli-version.txt").write_text(version)
# Original fixture authored for this package smoke test; no external artwork.
fixture = results / "original-smoke.svg"
fixture.write_text('<svg xmlns="http://www.w3.org/2000/svg" width="200" height="140">'
'<rect x="20" y="20" width="160" height="100" rx="12" fill="#2463eb"/>'
'<circle cx="100" cy="70" r="30" fill="#ffcc33"/></svg>')
env = dict(os.environ, VECTORCRAFT_NO_PREFS="1", XDG_RUNTIME_DIR="/tmp/vectorcraft-runtime")
Path(env["XDG_RUNTIME_DIR"]).mkdir(mode=0o700, exist_ok=True)
with (results / "gui.log").open("w") as log:
app = subprocess.Popen([
"vectorcraft", "--control", "32180", "--automation-read-root", str(results),
"--automation-write-root", str(results), str(fixture),
], stdout=log, stderr=subprocess.STDOUT, env=env)
try:
deadline = time.monotonic() + 90
while True:
if app.poll() is not None:
raise RuntimeError(f"GUI exited during startup: {app.returncode}")
try:
channel = socket.create_connection(("127.0.0.1", 32180), timeout=5)
break
except OSError:
if time.monotonic() >= deadline:
raise RuntimeError("GUI control channel did not become ready") from None
time.sleep(1)
channel.settimeout(30)
with channel, channel.makefile("rwb") as stream:
for request_id, method, params in (
(1, "ui.inspect", {}),
):
stream.write((json.dumps(dict(id=request_id, method=method, params=params)) + "\n").encode())
stream.flush()
response = json.loads(stream.readline())
(results / f"{method}.json").write_text(json.dumps(response, indent=2))
if response.get("id") != request_id or response.get("ok") is not True:
raise RuntimeError(f"GUI request failed: {method}")
finally:
app.terminate()
try:
app.wait(timeout=10)
except subprocess.TimeoutExpired:
app.kill()
app.wait()