Files
PS5_RetroArch/tests/test_net_shims.py
T
Mihawk 44143aba19 RetroArch with networking: netplay, RetroAchievements and HTTPS
configure now enables networking, netplay LAN discovery, RetroAchievements (rcheevos)
and SSL through RetroArch's own mbedTLS (deps/mbedtls, its bundled CA certificates):
nothing new is linked from outside the tree. tools/build-retroarch.sh passes
-DHAVE_BUILTINMBEDTLS, which libretro-common's TLS socket needs and only upstream's
console makefiles pass by hand.

Name lookups: the SDK links getaddrinfo to a resolver that refuses every lookup (the
real one is in a module titles do not load) and no module exports getnameinfo.
src/net_shims.c replaces libretro-common's getaddrinfo_retro, freeaddrinfo_retro and
getnameinfo_retro (--wrap; wrapping getaddrinfo itself still bound the SDK libc's
refuser) and resolves names with the console's own DNS (libSceNet's
sceNetResolverStartNtoa); getnameinfo is numeric. Every RetroArch caller (netplay, the
lobby, HTTP, NAT traversal) reaches it; only mbedTLS's unused mbedtls_net_connect/bind
keep libc's.

Evidence: evidence/network-build (from build/llvm-pie.elf and build/ra/libretroarch.a:
the configure switches, 28 rcheevos and 60 mbedTLS objects, the 9 resolver callers,
the sceNetResolver imports, no null imports); python3 -m unittest tests.test_net_shims.
Console behaviour (sign-in, netplay) is not yet verified: no launcher was available.
Gates: bash tools/verify.sh -> verify: PASS (format unit build integration evidence)
2026-10-10 01:16:31 -04:00

22 lines
830 B
Python

"""The title's getaddrinfo, freeaddrinfo and getnameinfo (src/net_shims.c), which
RetroArch's networking needs, on the host with a stand-in DNS resolver."""
from pathlib import Path
import subprocess
import tempfile
import unittest
ROOT = Path(__file__).resolve().parent.parent
class NetShims(unittest.TestCase):
def test_name_functions(self):
with tempfile.TemporaryDirectory() as td:
binary = str(Path(td) / 'net-shims-test')
subprocess.run(['cc', '-std=c11', '-O2', '-Wall', '-Wextra', '-Werror', '-D_DEFAULT_SOURCE', '-DNET_SHIMS_PREFIX(name)=shim_##name',
'tests/net_shims_test.c', 'src/net_shims.c', '-o', binary], cwd=ROOT, check=True)
subprocess.run([binary], cwd=ROOT, check=True, timeout=15)
if __name__ == '__main__':
unittest.main()