Testing

The behaviour in these pages is pinned down by pspautotests recorded on real PSPs. This page lists them, says how to run them on hardware and on PPSSPP, and how PPSSPP currently does.

The tests

Single console (tests/net/adhoc, the console creates its own group; needs the WLAN switch on, nothing else):

TestCovers
pdpPDP argument checks, return values, timeouts, receiving from yourself, GetPdpStat, socket IDs
ptpPTP argument checks, a connection to yourself, data, close, refusal, GetPtpStat
adhocctlInit, handlers, group names, create/connect/scan/disconnect, events, parameters
matchingmatching Init and Create limits, calls on stopped and started contexts, hello data
pollPollSocket events per socket state, socket alerts, waking blocked calls
alertswhich alert flag stops which PTP call, and waking threads already blocked
gamemodegame mode entry checks, members not turning up, the data calls outside game mode
discoverthe sceNetAdhocDiscover sequence with nobody around
selfwhat one console can't do with itself (broadcasts, two matching contexts)
loopbacksceNetInet on 127.0.0.1 in every ad hoc state
limitssocket and context limits, port 0
apctlinfrastructure and ad hoc at once; needs an access point in profile 1 (not for test.py)

Single console, sceNetInet over loopback (tests/net/inet): errors, options, addr, udp, tcp, bind, blocking, poll, stats (the control block lists, SocketAbort, sendmsg/recvmsg), and offline: the sceNet utilities, apctl with no access point (handlers, scanning, missing profiles) and the resolver with no network. offline's scan finds whatever access points are around, so it only prints whether there were any.

Every test links tests/net/net-imports.S, which declares every known function of the networking libraries, so a new test can call any of them.

Two consoles (tests/net/adhoc/pair, tests/net/inet/pair), each a _host and _client program:

TestCovers
basicscanning and joining, peer list and lookups, PDP sizes and loss, broadcast, PTP transfer, leaving
matchinga full matching session: hello, join, accept, data and acks, cancel, bye
matching2reject with opt, cancel before accept, hello changes, a full host, kicking, P2P, aborting data
vanisha peer leaving the group with connections and a matching session open
lifecyclethe group outliving its creator, rejoining, two groups with the same name
flowPTP buffering with a reader that doesn't read, PDP receive buffer sizes
gamemodegame mode between two consoles: entering, members, replicas updating
inet/pair/lantwo consoles on an access point: apctl info, broadcast discovery, TCP, UDP, DNS

Running them on PSPs

See pspautotests-hardware.md in the PPSSPP repo: single-console tests run with gentest.py; two-console tests with tests/net/adhoc/pair/record.py, which runs both sides at once through two USB bridges. All the results were recorded on PSP-1000s with firmware 6.60 and 6.61, which gave the same output.

Running them on PPSSPP

  • Single-console tests: python3 test.py net/adhoc/pdp (they're in tests_next, since PPSSPP doesn't pass them yet). For the ad hoc ones, PPSSPPHeadless needs --adhoc-server --realtime to get anywhere.
  • Two-console tests: python3 Tools/adhoc_multi.py net/adhoc/pair/basic runs one PPSSPPHeadless per role. In P2P mode (the default), instance N uses 127.0.0.N, which on macOS needs sudo ifconfig lo0 alias 127.0.0.2 up. With --relay, the instances use a local aemu_postoffice server (built from ext/aemu_postoffice/server_cpp) in relay mode instead, and need no aliases.

Where PPSSPP stands

As of October 2026, lines that differ from the PSP's output (or where the run stops early):

TestResult
adhoc/pdpruns to the end; argument checks, broadcasts to itself, partial copies differ
adhoc/ptpruns to the end; argument checks, connect results, stats differ
adhoc/adhocctlstops after the Init checks: Init blocks for the server and returns BUSY
adhoc/matching52 of 100 lines: Create checks, Start's return value, hello data
adhoc/poll14 of 65: most of the per-state events
adhoc/alerts3 of 31: connect and flush alerts, the poll alert's revents
adhoc/gamemodestops in game mode, stuck BUSY
adhoc/discover9 of 29: it's a stub
adhoc/self3 of 27: Start's return value
adhoc/loopback4 of 31: TCP over loopback fails
adhoc/limits8 of 26: limits, port 0, error codes
inet/errors35 of 76: errno values, return values, bind/listen rules
inet/options27 of 89: option sizes and values
inet/addr10 of 33: only dotted quads parsed
inet/udp3 of 61
inet/tcpstops at the first TCP connection over loopback
inet/offlinemost lines: apctl and resolver error codes, limits, ThreadAbort
inet/statsthe control block lists aren't implemented; recvmsg and SocketAbort fail

The two-console tests, run on two PPSSPPs in relay mode, all fail; the differences are listed under Known issues.