Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/libs/prx/libSceNet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:$<TARGET_FILE_DIR:libSceNet>")
Expand Down
11 changes: 11 additions & 0 deletions core/libs/tests/GuestSceNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <array>
#include <chrono>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <stdexcept>
Expand Down Expand Up @@ -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<std::uint8_t, 16> unspecified{};
Require(sceNetInetPton(28, "::", unspecified.data()) == 1);
Expand All @@ -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<std::uint8_t, 28> address{28, 28};
Expand Down Expand Up @@ -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;
}
}
Loading