2020-06-15 14:18:57 +00:00
|
|
|
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
|
|
|
|
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
|
|
|
|
|
|
|
|
PKGS += TEST_LIBC_SOCK
|
|
|
|
|
|
|
|
TEST_LIBC_SOCK_SRCS := $(wildcard test/libc/sock/*.c)
|
|
|
|
TEST_LIBC_SOCK_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_SOCK_SRCS))
|
|
|
|
|
|
|
|
TEST_LIBC_SOCK_OBJS = \
|
|
|
|
$(TEST_LIBC_SOCK_SRCS:%.c=o/$(MODE)/%.o)
|
|
|
|
|
2020-08-25 11:23:25 +00:00
|
|
|
TEST_LIBC_SOCK_COMS = \
|
|
|
|
$(TEST_LIBC_SOCK_SRCS:%.c=o/$(MODE)/%.com)
|
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
TEST_LIBC_SOCK_BINS = \
|
|
|
|
$(TEST_LIBC_SOCK_COMS) \
|
|
|
|
$(TEST_LIBC_SOCK_COMS:%=%.dbg)
|
|
|
|
|
|
|
|
TEST_LIBC_SOCK_TESTS = \
|
|
|
|
$(TEST_LIBC_SOCK_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
|
|
|
|
|
|
|
|
TEST_LIBC_SOCK_CHECKS = \
|
|
|
|
$(TEST_LIBC_SOCK_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
|
|
|
|
|
|
|
|
TEST_LIBC_SOCK_DIRECTDEPS = \
|
|
|
|
LIBC_CALLS \
|
|
|
|
LIBC_FMT \
|
2021-01-16 20:05:41 +00:00
|
|
|
LIBC_INTRIN \
|
2021-02-01 11:33:13 +00:00
|
|
|
LIBC_MEM \
|
2020-06-15 14:18:57 +00:00
|
|
|
LIBC_NEXGEN32E \
|
|
|
|
LIBC_RUNTIME \
|
|
|
|
LIBC_SOCK \
|
2021-01-16 20:05:41 +00:00
|
|
|
LIBC_STDIO \
|
2021-02-02 11:45:31 +00:00
|
|
|
LIBC_STR \
|
2020-06-15 14:18:57 +00:00
|
|
|
LIBC_SYSV \
|
Support non-blocking i/o across platforms
This change introduces new tests for `O_NONBLOCK` and `SOCK_NONBLOCK` to
confirm that non-blocking i/o is now working on all supported platforms,
including Windows. For example, you can now say on Windows, MacOS, etc.:
socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP);
To create a non-blocking IPv4 TCP socket. Or you can enable non-blocking
i/o on an existing socket / pipe / etc. file descriptor by calling fcntl
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
This functionality is polyfilled on older Linux kernels too, e.g. RHEL5.
Now that fcntl() support is much better the FIOCLEX / FIONCLEX polyfills
for ioctl() have been removed since they're ugly non-POSIX diameond APIs
This change fixes a weakness in kprintf() that was causing Windows trace
tools to frequently crash.
2023-07-23 09:56:47 +00:00
|
|
|
LIBC_THREAD \
|
2022-09-08 09:33:01 +00:00
|
|
|
LIBC_LOG \
|
2022-08-12 12:17:06 +00:00
|
|
|
LIBC_SYSV_CALLS \
|
2020-06-15 14:18:57 +00:00
|
|
|
LIBC_TESTLIB \
|
|
|
|
LIBC_X \
|
|
|
|
TOOL_DECODE_LIB
|
|
|
|
|
|
|
|
TEST_LIBC_SOCK_DEPS := \
|
|
|
|
$(call uniq,$(foreach x,$(TEST_LIBC_SOCK_DIRECTDEPS),$($(x))))
|
|
|
|
|
|
|
|
o/$(MODE)/test/libc/sock/sock.pkg: \
|
|
|
|
$(TEST_LIBC_SOCK_OBJS) \
|
|
|
|
$(foreach x,$(TEST_LIBC_SOCK_DIRECTDEPS),$($(x)_A).pkg)
|
|
|
|
|
|
|
|
o/$(MODE)/test/libc/sock/%.com.dbg: \
|
|
|
|
$(TEST_LIBC_SOCK_DEPS) \
|
|
|
|
o/$(MODE)/test/libc/sock/%.o \
|
|
|
|
o/$(MODE)/test/libc/sock/sock.pkg \
|
|
|
|
$(LIBC_TESTMAIN) \
|
|
|
|
$(CRT) \
|
2022-05-25 18:31:08 +00:00
|
|
|
$(APE_NO_MODIFY_SELF)
|
2020-06-15 14:18:57 +00:00
|
|
|
@$(APELINK)
|
|
|
|
|
2022-08-15 05:19:46 +00:00
|
|
|
o/$(MODE)/test/libc/sock/unix_test.com.runs: \
|
2022-08-15 22:18:37 +00:00
|
|
|
private .PLEDGE = stdio rpath wpath cpath fattr proc unix
|
2022-08-15 05:19:46 +00:00
|
|
|
|
Support non-blocking i/o across platforms
This change introduces new tests for `O_NONBLOCK` and `SOCK_NONBLOCK` to
confirm that non-blocking i/o is now working on all supported platforms,
including Windows. For example, you can now say on Windows, MacOS, etc.:
socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP);
To create a non-blocking IPv4 TCP socket. Or you can enable non-blocking
i/o on an existing socket / pipe / etc. file descriptor by calling fcntl
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
This functionality is polyfilled on older Linux kernels too, e.g. RHEL5.
Now that fcntl() support is much better the FIOCLEX / FIONCLEX polyfills
for ioctl() have been removed since they're ugly non-POSIX diameond APIs
This change fixes a weakness in kprintf() that was causing Windows trace
tools to frequently crash.
2023-07-23 09:56:47 +00:00
|
|
|
o/$(MODE)/test/libc/sock/nonblock_test.com.runs \
|
|
|
|
o/$(MODE)/test/libc/sock/socket_test.com.runs \
|
|
|
|
o/$(MODE)/test/libc/sock/shutdown_test.com.runs \
|
2022-08-15 05:19:46 +00:00
|
|
|
o/$(MODE)/test/libc/sock/setsockopt_test.com.runs \
|
|
|
|
o/$(MODE)/test/libc/sock/sendfile_test.com.runs \
|
|
|
|
o/$(MODE)/test/libc/sock/poll_test.com.runs \
|
|
|
|
o/$(MODE)/test/libc/sock/pollfd_test.com.runs: \
|
2022-08-15 22:18:37 +00:00
|
|
|
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
|
2022-08-15 05:19:46 +00:00
|
|
|
|
|
|
|
o/$(MODE)/test/libc/sock/sendrecvmsg_test.com.runs \
|
|
|
|
o/$(MODE)/test/libc/sock/nointernet_test.com.runs: \
|
2022-08-15 22:18:37 +00:00
|
|
|
private .PLEDGE = stdio rpath wpath cpath fattr proc inet recvfd sendfd
|
2022-08-15 05:19:46 +00:00
|
|
|
|
2022-10-12 04:06:27 +00:00
|
|
|
o/$(MODE)/test/libc/sock/socket_test.com.runs: \
|
|
|
|
private .INTERNET = 1 # todo: ipv6 filtering
|
2022-09-08 13:06:22 +00:00
|
|
|
|
2022-10-12 04:06:27 +00:00
|
|
|
o/$(MODE)/test/libc/sock/recvmsg_test.com.runs: \
|
|
|
|
private .INTERNET = 1 # need to bind to 0.0.0.0
|
|
|
|
o/$(MODE)/test/libc/sock/recvmsg_test.com.runs: \
|
|
|
|
private .PLEDGE = stdio rpath wpath cpath fattr proc inet recvfd sendfd
|
|
|
|
|
2020-08-25 11:23:25 +00:00
|
|
|
$(TEST_LIBC_SOCK_OBJS): test/libc/sock/test.mk
|
2020-06-15 14:18:57 +00:00
|
|
|
|
|
|
|
.PHONY: o/$(MODE)/test/libc/sock
|
|
|
|
o/$(MODE)/test/libc/sock: \
|
|
|
|
$(TEST_LIBC_SOCK_BINS) \
|
|
|
|
$(TEST_LIBC_SOCK_CHECKS)
|