Files
onionHEN/source/util/tests/test_main.cpp
T
HexwellandClaude Fable 5 2df9e0b2fb fix: share console IP lookup across modules
get_ip_address had three independent implementations (shellui, util, daemon)
because each module also carried its own copy of SceNetCtlInfo and its own
prototype for sceNetCtlGetInfo, with the pointer typed as SceNetCtlInfo* in
two of them and void* in the third.

The shellui and util copies stored the result in an unsigned int and tested
`ret < 0`, which is never true for an unsigned value. Their error branch was
unreachable, so a failed lookup returned success, left not_connected clear,
and copied an uninitialised SceNetCtlInfo to the caller instead of the
IP NOT FOUND placeholder. util's rest-mode network-recovery retry keys off
that return value and therefore never ran.

Declare the netctl ABI once in source/include/ps5/net_ctl.h, add
onion_net_get_ip_address to libonion_platform with an explicit buffer-size
contract, and keep util's not_connected latch in util where it belongs.
Cover the status mapping, the placeholder length and buffer validation with
host tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-26 19:49:50 +08:00

80 lines
3.0 KiB
C++

#include <cstdio>
extern "C" int test_cheat_utils_suite(void);
extern "C" int test_cheat_parsers_suite(void);
extern "C" int test_cheat_flatten_suite(void);
extern "C" int test_payload_suite(void);
extern "C" int test_base64_suite(void);
extern "C" int test_aes_cbc_suite(void);
extern "C" int test_hde64_suite(void);
extern "C" int test_hotpatch_suite(void);
extern "C" int test_x64_relocator_suite(void);
extern "C" int test_http_github_suite(void);
extern "C" int test_reg_entity_suite(void);
extern "C" int test_account_id_b64_suite(void);
extern "C" int test_settings_suite(void);
extern "C" int test_ready_suite(void);
extern "C" int test_platform_fs_suite(void);
extern "C" int test_platform_log_suite(void);
extern "C" int test_platform_net_suite(void);
extern "C" int test_platform_notify_suite(void);
extern "C" int test_msg_protocol_suite(void);
extern "C" int test_app_jailbreak_policy_suite(void);
extern "C" int test_debug_settings_route_policy_suite(void);
extern "C" int test_ipc_harden_suite(void);
extern "C" int test_toolbox_timing_suite(void);
extern "C" int test_toolbox_injection_suite(void);
extern "C" int test_trampoline_arena_suite(void);
extern "C" int test_hook_lifecycle_suite(void);
extern "C" int test_hijack_retry_suite(void);
extern "C" int test_ps5_settings_ui_suite(void);
extern "C" int test_toolbox_route_suite(void);
extern "C" int test_onpress_policy_suite(void);
extern "C" int test_toolbox_helpers_suite(void);
extern "C" int test_toolbox_i18n_suite(void);
int main() {
int failures = 0;
failures += test_cheat_utils_suite();
failures += test_cheat_parsers_suite();
failures += test_cheat_flatten_suite();
failures += test_payload_suite();
failures += test_base64_suite();
failures += test_aes_cbc_suite();
failures += test_hde64_suite();
failures += test_hotpatch_suite();
failures += test_x64_relocator_suite();
failures += test_http_github_suite();
failures += test_reg_entity_suite();
failures += test_account_id_b64_suite();
failures += test_settings_suite();
failures += test_ready_suite();
failures += test_platform_fs_suite();
failures += test_platform_log_suite();
failures += test_platform_net_suite();
failures += test_platform_notify_suite();
failures += test_msg_protocol_suite();
failures += test_app_jailbreak_policy_suite();
failures += test_debug_settings_route_policy_suite();
failures += test_ipc_harden_suite();
failures += test_toolbox_timing_suite();
failures += test_toolbox_injection_suite();
failures += test_trampoline_arena_suite();
failures += test_hook_lifecycle_suite();
failures += test_hijack_retry_suite();
failures += test_ps5_settings_ui_suite();
failures += test_toolbox_route_suite();
failures += test_onpress_policy_suite();
failures += test_toolbox_helpers_suite();
failures += test_toolbox_i18n_suite();
if (failures == 0) {
std::fprintf(stderr, "All util host tests passed.\n");
return 0;
}
std::fprintf(stderr, "%d util host tests failed.\n", failures);
return 1;
}