Add [initial] functional tests for sendfile(2) as lib/libc/sys/sendfile
These testcases exercise a number of functional requirements for sendfile(2). The testcases use IPv4 and IPv6 domain sockets with TCP, and were confirmed functional on UFS and ZFS. UDP address family sockets cannot be used per the sendfile(2) contract, thus using UDP sockets is outside the scope of testing the syscall in positive cases. As seen in `:s_negative_udp_socket_test`, UDP is used to test the sendfile(2) contract to ensure that EINVAL is returned by sendfile(2). The testcases added explicitly avoid testing out `SF_SYNC` due to the complexity of verifying that support. However, this is a good next logical item to verify. The `hdtr_positive*` testcases work to a certain degree (the header testcases pass), but the trailer testcases do not work (it is an expected failure). In particular, the value received by the mock server doesn't match the expected value, and instead looks something like the following (using python array notation): `trailer[:]message[1:]` instead of: `message[:]trailer[:]` This makes me think there's a buffer overrun issue or problem with the offset somewhere in the sendfile(2) system call, but I need to do some other testing first to verify that the code is indeed sane, and my assumptions/code isn't buggy. The `sbytes_negative` testcases that check `sbytes` being set to an invalid value resulting in `EFAULT` fails today as the other change (which checks `copyout(9)`) has not been committed [1]. Thus, it should remain an expected failure (see bug 232210 for more details on this item). Next steps for testing sendfile(2): 1. Fix the header/trailer testcases so that they pass. 2. Setup if_tap interface and test with it, instead of using "localhost", per @asomers's suggestion. 3. Handle short recv(2)'s in `server_cat(..)`. 4. Add `SF_SYNC` support. 5. Add some more negative tests outside the scope of the functional contract. MFC after: 1 month Reviewed by: asomers Approved by: emaste (mentor) PR: 232210 Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D18625
This commit is contained in:
parent
27ed53c311
commit
b29e142648
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343362
@ -8,6 +8,7 @@ PACKAGE= tests
|
||||
ATF_TESTS_C+= brk_test
|
||||
.endif
|
||||
ATF_TESTS_C+= queue_test
|
||||
ATF_TESTS_C+= sendfile_test
|
||||
|
||||
# TODO: clone, lwp_create, lwp_ctl, posix_fadvise, recvmmsg,
|
||||
# swapcontext
|
||||
|
1146
lib/libc/tests/sys/sendfile_test.c
Normal file
1146
lib/libc/tests/sys/sendfile_test.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user