From f5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 7 Mar 2024 17:28:52 -0500 Subject: build: Build mlibc + add distclean target Signed-off-by: Ian Moffett --- lib/mlibc/tests/posix/getaddrinfo.c | 52 ------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 lib/mlibc/tests/posix/getaddrinfo.c (limited to 'lib/mlibc/tests/posix/getaddrinfo.c') diff --git a/lib/mlibc/tests/posix/getaddrinfo.c b/lib/mlibc/tests/posix/getaddrinfo.c deleted file mode 100644 index d52c93f..0000000 --- a/lib/mlibc/tests/posix/getaddrinfo.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -#include -#include -#include - -int main() { - struct addrinfo *res = NULL; - struct addrinfo hints = {0}; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - - int ret = getaddrinfo(NULL, "443", &hints, &res); - assert(ret == 0); - - struct sockaddr_in *addr = (struct sockaddr_in*)(res[0].ai_addr); - assert(addr->sin_port == htons(443)); - assert(res[0].ai_socktype == SOCK_STREAM); - assert(res[0].ai_protocol == IPPROTO_TCP); - - freeaddrinfo(res); - res = NULL; - - /* check we can resolve any domain */ - ret = getaddrinfo("example.net", NULL, &hints, &res); - assert(ret == 0); - - freeaddrinfo(res); - res = NULL; - - hints.ai_flags = AI_NUMERICHOST; - ret = getaddrinfo("10.10.10.10", NULL, &hints, &res); - assert(ret == 0); - - addr = (struct sockaddr_in*)res[0].ai_addr; - assert((addr->sin_addr.s_addr & 0xFF) == 10); - assert(((addr->sin_addr.s_addr >> 8) & 0xFF) == 10); - assert(((addr->sin_addr.s_addr >> 16) & 0xFF) == 10); - assert(((addr->sin_addr.s_addr >> 24) & 0xFF) == 10); - - freeaddrinfo(res); - res = NULL; - - ret = getaddrinfo("example.net", NULL, &hints, &res); - assert(ret == EAI_NONAME); - - freeaddrinfo(res); - - return 0; -} -- cgit v1.2.3