mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 00:00:21 +02:00
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>
48 lines
1.4 KiB
Python
Executable File
48 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Stub for podman, for the fake Lepton instances (lepton.py): ps, stop, exec.
|
|
`podman ps --format "{{.Names}} {{.Labels.adb_port}}"` lists what's running,
|
|
as frame_android.running_instances reads it (docs/apks.md)."""
|
|
import os
|
|
import sys
|
|
import time
|
|
|
|
sys.path.insert(0, '/usr/local/lib/fakeframe')
|
|
import fakeframe_state as fs # noqa: E402
|
|
|
|
|
|
def alive(c):
|
|
try:
|
|
os.kill(c['pid'], 0)
|
|
return True
|
|
except OSError:
|
|
return False
|
|
|
|
|
|
args = sys.argv[1:]
|
|
fs.log('podman', args=args)
|
|
cmd = args[0] if args else ''
|
|
containers = {n: c for n, c in fs.read()['lepton'].items() if alive(c)}
|
|
if cmd == 'ps':
|
|
for name, c in sorted(containers.items()):
|
|
print(f"{name} {c['port']}")
|
|
elif cmd == 'stop':
|
|
name = args[-1]
|
|
c = containers.get(name)
|
|
if not c:
|
|
sys.exit(f'Error: no container with name or ID "{name}" found: no such container')
|
|
os.kill(c['pid'], 15)
|
|
for _ in range(50):
|
|
if not alive(c):
|
|
break
|
|
time.sleep(0.1)
|
|
print(name)
|
|
elif cmd == 'exec':
|
|
name, rest = args[1], ' '.join(args[2:])
|
|
if name not in containers:
|
|
sys.exit(f'Error: no container with name or ID "{name}" found: no such container')
|
|
if 'pidof' in rest:
|
|
print(4242) # the app is "up"; there's no Android to ask
|
|
# logcat and anything else: nothing to report
|
|
else:
|
|
sys.exit(f'podman stub: unsupported {args}')
|