From 4a2769f26da716d1c43628550c555d2ad827a1d4 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 10:28:41 +0000 Subject: [PATCH] test(net): skip only the IPv6 socket checks on a host without IPv6 On a host without IPv6, socket(AF_INET6) fails with EAFNOSUPPORT, so guest_sce_net aborted at its first IPv6 socket and never ran the TCP, UDP, epoll, sendmsg/recvmsg, resolver and NetCtl checks after it. When sceNetSocket reports guest EAFNOSUPPORT (47) for the IPv6 socket, skip those socket checks, run the rest of the test, and exit with 77, which ctest reports as skipped. Hosts with IPv6 run every check. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Ha6Tsy62AFUyp9a5Mf7vjA --- core/libs/prx/libSceNet/CMakeLists.txt | 2 +- core/libs/tests/GuestSceNet.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/libs/prx/libSceNet/CMakeLists.txt b/core/libs/prx/libSceNet/CMakeLists.txt index 2516da1e1..84e0b910f 100644 --- a/core/libs/prx/libSceNet/CMakeLists.txt +++ b/core/libs/prx/libSceNet/CMakeLists.txt @@ -8,7 +8,7 @@ if(BUILD_TESTING) target_link_libraries(guest_sce_net_tests PRIVATE libSceNet libSceNetCtl libkernel libc) configure_windows_unwind(guest_sce_net_tests) add_test(NAME guest_sce_net COMMAND guest_sce_net_tests) - set_tests_properties(guest_sce_net PROPERTIES TIMEOUT 20) + set_tests_properties(guest_sce_net PROPERTIES TIMEOUT 20 SKIP_RETURN_CODE 77) if(WIN32) set_tests_properties(guest_sce_net PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$") diff --git a/core/libs/tests/GuestSceNet.cpp b/core/libs/tests/GuestSceNet.cpp index 4432ef709..06689771f 100644 --- a/core/libs/tests/GuestSceNet.cpp +++ b/core/libs/tests/GuestSceNet.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -169,6 +170,8 @@ static void CheckAddressText(int family, const char* text) { Require(sceNetInetNtop(family, address.data(), nullptr, output.size()) == nullptr && *sceNetErrnoLoc() == 22); } +static bool ipv6Unavailable = false; + static void CheckUnspecifiedIpv6() { std::array unspecified{}; Require(sceNetInetPton(28, "::", unspecified.data()) == 1); @@ -178,6 +181,10 @@ static void CheckUnspecifiedIpv6() { Require(std::strcmp(text, "::") == 0 && text[3] == 'x'); const int receiver = sceNetSocket("ipv6-any", 28, 2, 17); + if (receiver < 0 && *sceNetErrnoLoc() == 47) { + ipv6Unavailable = true; + return; + } const int sender = sceNetSocket("ipv6-loopback", 28, 2, 17); Require(receiver >= 0 && sender >= 0); std::array address{28, 28}; @@ -371,4 +378,8 @@ int main() { int state = -1; Require(sceNetCtlGetState(&state) == 0); Require(state == 0 || state == 3); + if (ipv6Unavailable) { + std::puts("skipped the IPv6 socket checks, the host has no IPv6"); + return 77; + } }