Test server and emulators
Status: machine check script (scripts/doctor.sh), throwaway Docker Jellyfin test server with generated edge-case media and TLS/tunnel helpers (tools/test-server/), and seven API 34 AVDs with TV D-pad and track-series scripts (scripts/). No app or Gradle module lives in this area. As of 2026-11-25 (main).
Start here
Section titled “Start here”- Machine setup and health check: get-started.md lists what to install per OS in order;
scripts/doctor.shchecksbuild,site,server,devices, andgithubwithout modifying anything. - Reference and commands: dev-environment.md is the single reference for the test server (addresses, users, generated media,
httpstunnel,caddy-tls.sh,forward.py) and the emulators (AVDs, serials, older API matrix, troubleshooting, and an isolated rootable Android TV AVD for private-data tests). - Agent procedures and safety rules: read the test-server skill before touching the Docker test server or users, and the test-devices skill before starting, installing on, or sending input to an emulator.
- Extra track and subtitle test data: track-test-series.md and
scripts/make-track-test-series.shgenerate multi-track and styled-ASS/SRT test series. - Test fast without Docker or emulators:
bash scripts/doctor.sh build,python3 tools/test-server/forward.py --help, andpython3 .claude/skills/start-work/scripts/check-docs.py.
What it does
Section titled “What it does”With these tools, contributors and agents can test Ephyra without a Jellyfin server of their own or an Android device:
scripts/doctor.shchecks the machine: Git, JDK 21, Android SDK (local.properties,ANDROID_HOME,ANDROID_SDK_ROOT, platform/build-tools/platform-tools; in a git worktree withoutlocal.propertiesit names the main checkout’s to copy), Python 3, Node/npm, Docker +python3(in WSL on Windows) + server reachability on127.0.0.1:<port>, emulator/acceleration/AVD tools/system images, andghauth status.- The throwaway Jellyfin server is in
tools/test-server/.setup.shpulls a pinned Jellyfin image, uses its bundledffmpeg(pluspgs.pyfor PGS/VobSub image subtitles) to generate edge-case movies, shows, real-title metadata items, a ~650-movieBig Movieslibrary, andHome Videos/Music Videoslibraries, starts the container, and runsconfigure.py(via sharedjf.py) to complete the wizard and create test users (admin,tester,nodownload,second,nopass) with passwords stored increds.env. tools/test-server/also has the network, TLS and fault injection tools.setup.sh httpsattaches acloudflaredquick tunnel for testing mpv over HTTPS (#960);caddy-tls.shputs Caddy with a throwaway CA in front of the server across six ports covering optional/required client certificates and TLS 1.2/1.3 (#960, #993);forward.pyis a per-emulator TCP/HTTP proxy that simulates server loss, bandwidth caps, or held requests (--hold,--release-file,--hold-max,--log);user.pymanages per-tester accounts; andapi.pydoes one read-only API call as a test user (what the server tellstesterornodownload).- The emulator and input scripts are in
scripts/.avds.shmanages seven API 34 AVDs (ce_phone,ce_phone_tmp,ce_tablet_8,ce_tablet_10,ce_fold,ce_tv_1080p,ce_tv_4k) with fixed ports, software rendering by default (for mpv), muted media volume, and debug APK installation.tv-dpad.shinjects hardware-like D-pad presses viauinputso TV Compose text fields and focus behave like a real remote.
The full media table, the AVD table, the commands and the notes on older Android versions are in dev-environment.md.
Where the code is
Section titled “Where the code is”| Path | What |
|---|---|
scripts/doctor.sh |
Read-only environment check (build, site, server, devices, github) |
tools/test-server/setup.sh |
Starts/stops/wipes the Docker Jellyfin server, generates media, manages the https tunnel |
tools/test-server/configure.py, jf.py, pgs.py |
API wizard/library/user setup and report; shared creds.env/API client; PGS subtitle generator |
tools/test-server/user.py |
list, add, rotate, and remove test users (protects built-in setup users) |
tools/test-server/api.py |
One GET as a test user (--as, {userId}, --pick); never prints a password, own DeviceId |
tools/test-server/forward.py |
Per-emulator proxy with rate limiting, --hold / --release-file, --log, and clean half-close |
tools/test-server/caddy-tls.sh |
Caddy reverse proxy with throwaway CA and client-cert test ports |
scripts/avds.sh, scripts/tablet-avds.sh |
Create, start, stop, rotate, screenshot, and install on the 7 AVDs (tablet-avds.sh forwards to avds.sh) |
scripts/tv-dpad.sh |
Registers a uinput remote to send held D-pad events to Android TV emulators |
scripts/make-track-test-series.sh |
Generates multi-track and styled-ASS/SRT test series (track-test-series.md) |
.claude/skills/test-server/SKILL.md, .claude/skills/test-devices/SKILL.md |
Agent workflows and safety rules for the test server and emulators |
docs/get-started.md, docs/dev-environment.md, docs/track-test-series.md |
Tool installation, full test-environment reference, and track-test-series guide |
- No Konsist architecture rule applies: this area is shell and Python tooling and Markdown, with no Kotlin module.
check-docs.pyandcheck-guides-follow.pycheck changes to the files listed undertest-environmentindocs/areas.yaml, so keep this guide and the map in step.- The operational rules, from the test-server and test-devices skills:
- Never print, commit, or paste passwords from
creds.env; useuser.py rotate <name>if exposed. - Never log in to the app as
admin, and give custom API scripts their ownDeviceId. - Use a separate user (
user.py add <name>) when testing concurrently so watched/resume state does not collide; never wipe a shared server or replace an existing AVD (create --force,delete) without asking. - Close temporary public tunnels (
setup.sh https stop) andcaddy-tls.sh stopwhen finished, and stop only the emulators you started. - Always address emulators by
emulator-<port>serial; never touch physical devices unless explicitly asked. - Keep software rendering (no
--gpu) when testing mpv playback.
- Never print, commit, or paste passwords from
How to test it
Section titled “How to test it”Checks that run anywhere (no Docker or emulators needed):
for script in scripts/doctor.sh scripts/avds.sh scripts/tv-dpad.sh \ scripts/make-track-test-series.sh tools/test-server/setup.sh \ tools/test-server/caddy-tls.sh; do bash -n "$script" || exit "$?"donepython3 -m py_compile tools/test-server/configure.py tools/test-server/jf.py \ tools/test-server/pgs.py tools/test-server/user.py tools/test-server/forward.pybash scripts/doctor.sh --helpbash scripts/doctor.sh buildpython3 tools/test-server/forward.py --helppython3 .claude/skills/start-work/scripts/check-docs.pyOn Windows, use python instead of python3 if python3 resolves to the Microsoft Store stub (see get-started.md). tools/test-server/user.py reads creds.env via jf.py on import, so even user.py --help (and user.py list) needs an initialized EPHYRA_TEST_SERVER_DIR (inside WSL on Windows).
What cannot be tested without Docker, Android SDK images, or real hardware:
tools/test-server/setup.sh,caddy-tls.sh,user.pylive API calls, andscripts/doctor.sh serverrequire Docker +python3(inside WSL on Windows) and a running container.scripts/avds.sh,scripts/tv-dpad.sh, andscripts/doctor.sh devicesrequire the Android SDK emulator, acceleration (WHPX/KVM),adb, and the API 34 system images.- Hardware media decoders, HDR/Dolby Vision output, display refresh rates, audio passthrough, and real-device performance require a physical device (dev-environment.md).
Before a PR
Section titled “Before a PR”python3 .claude/skills/start-work/scripts/check-docs.pypython3 .claude/skills/start-work/scripts/check-guides-follow.py- If you edited shell or Python scripts, run
bash -nandpython3 -m py_compile(plusforward.py --help/doctor.shon the groups available on your machine). - When adding a new generated media case to
setup.sh, put it behind its own marker file (like.generated-extra), verify it withffprobeandsetup.sh status, and update the media table in dev-environment.md (or test in an isolated server viaEPHYRA_TEST_SERVER_DIR/EPHYRA_TEST_SERVER_PORT/EPHYRA_TEST_SERVER_NAME). - If you changed any file listed in
docs/areas.yamlfortest-environment, keep this guide (ordocs/areas.yaml) updated or explain why in the PR body withDocs: no change needed — <reason>.
Decisions and history
Section titled “Decisions and history”- #592: initial throwaway Docker Jellyfin test server (
setup.sh,configure.py,user.py,forward.py), AVD tooling (avds.sh,tv-dpad.sh), and thetest-server/test-devicesskills; expanded with track-choice, chapters, image-subtitle (pgs.py), large-library, and video/photo cases (#580, #594, #597, #671, #672). - #302, #951: tablet AVDs folded from
tablet-avds.shintoavds.sh, addingavds.sh up, quiet boot flags (-crash-report-mode never -no-metrics, volume down via keyevents), and the older-API AVD matrix. - #928, #947:
get-started.mdandscripts/doctor.shadded so new machines and agents can check prerequisites in one command. - #941, #991:
forward.pygained--hold,--release-file,--hold-max,--log, clean half-closing (SHUT_WR) so mpv does not hitConnection reset by peer, and WindowsSO_EXCLUSIVEADDRUSEso two forwarders cannot bind the same port. - #960, #962, #993, #995:
setup.sh https(Cloudflare quick tunnel) for testing mpv over HTTPS andcaddy-tls.shfor reverse-proxy TLS / mTLS client-certificate testing. - #1018:
user.py removedeletes a user, its server data, and itscreds.enventry while refusing to delete built-in setup users.
Pitfalls
Section titled “Pitfalls”- On Windows, the server side runs in WSL and the rest on Windows. Docker and the test server scripts (
setup.sh,caddy-tls.sh,user.py) run inside WSL, where~/ephyra-test-serverlives, while Gradle,avds.sh,adb, andpythonrun on Windows. In Git Bash,export MSYS_NO_PATHCONV=1prevents/sdcard/...or/data/...rewriting inadb shellcommands, andpython3may hit the Microsoft Store alias unlesspythonis used or the alias is disabled (get-started.md). - WSL stops when idle, and the emulators reach it over IPv4 only. On Windows, WSL shuts down when idle, taking down containers and any
setup.sh httpstunnel (keep WSL awake withwsl -d <distro> -- sleep 3600during tunnel/custom-container tests). Avoid Docker--network hostin WSL: containers then bind IPv6 only, while emulators reach10.0.2.2over IPv4. If a Windows process holds0.0.0.0:<port>, IPv4 emulator traffic reaches that process instead of WSL (dev-environment.md, test-server skill). - The TV emulator needs its own input and its own way to lose the server. TV text fields ignore
adb shell input keyeventD-pad events and scramble full URLs passed toadb shell input text: usescripts/tv-dpad.shfor D-pad input and send URLs in short chunks. The standard API 34 TV image is a production build and has noadb root; it also uses Ethernet (unaffected by airplane mode oradb emu network speed), so simulate server loss withforward.py. For isolated private-data tests, the Android 9 TV image is userdebug and can root. Its emulator window provides input for interactive setup because that image lacksuinput. Follow the separate-AVD recipe in dev-environment.md. - Start AVDs the way
avds.shdoes. Starting an AVD without-crash-report-mode never -no-metricscan hang beforeadb devicessees it,cmd media_session volumeis a no-op on API 34 images (soavds.shsends 16 volume-down keyevents), and host GPU rendering (--gpu) crashes mpv: keepavds.sh’s default software rendering for player work (dev-environment.md). - Jellyfin keeps resume positions only for items of 5 minutes or more (and resets below 10%).
ffmpegdrops Matroska language tags forund(soUnd Audio Showuses.mp4) and drops HDR10 colour tags passed as output options rather than filter/codec params, andReal Movies/Real Showsneed internet on the first scan to fetch posters (dev-environment.md,setup.sh).
Source: docs/areas/test-environment.md · raw Markdown