Files
saphid--frame-control/tests/fakeframe/rootfs/usr/local/bin/fakeframe-ctl
T
saphidandClaude Opus 5.5 0181071b83 Tests against a fake Frame, and a headset smoke test
tests/fakeframe: a container that stands in for the Frame (Arch Linux, or
Arch Linux ARM on arm64) with sshd, rsync, Valve's steamos-devkit-service
and hooks (vendored unmodified), a fake Steam client for the devkit pipe and
the DevTools port (the app's JavaScript runs in Node against stand-in
SteamClient/appStore objects), stubs for steam, wpctl, flatpak, podman,
Lepton and friends, battery and thermal files under /sys, and fault
switches (fakeframe-ctl): pairing mode, approve/deny/timeout, Steam not
running, headset asleep, sshd off, disk full, runtimes missing. A second
container is the computer running Frame Control.

tests/e2e: 29 tests driving the real ui/server.py, frame_connect.py and
frame_titles.py against it; skipped unless FRAME_E2E=1. scripts/e2e.sh
builds, runs and tears down; CI runs it on ubuntu-24.04-arm.

tests/smoke + scripts/frame-smoke.sh: the core cases against a real Frame,
recorded with its BUILD_ID, cleaning up after itself; --pair to pair a
throwaway key. docs/testing.md describes the layers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 17:40:09 +10:00

32 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python3
"""Flip the fake Frame's fault switches and read its state; `fakeframe-ctl help`.
Talks to the supervisor's control port, so it works the same over SSH
(`ssh frame fakeframe-ctl steam off`) and from the host container with
FAKEFRAME_CTL=http://fakeframe:9999.
"""
import json
import os
import sys
import urllib.error
import urllib.request
url = os.environ.get('FAKEFRAME_CTL', 'http://127.0.0.1:9999').rstrip('/')
req = urllib.request.Request(url + '/ctl', data=json.dumps({'args': sys.argv[1:]}).encode(),
headers={'Content-Type': 'application/json'})
try:
with urllib.request.urlopen(req, timeout=60) as r:
out = json.load(r)
except urllib.error.HTTPError as e:
out = json.load(e)
except OSError as e:
sys.exit(f'fakeframe-ctl: control port not answering ({e})')
if 'usage' in out:
print(out['usage'])
elif 'error' in out:
sys.exit(f"fakeframe-ctl: {out['error']}")
else:
print(json.dumps(out, indent=1))
if sys.argv[1:2] == ['ping'] and not out.get('ok'):
sys.exit(1)