summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2022-04-24Upgrade sysctl to 0.4Ryan Zoeller
Upgrade sysctl dev-dependency to 0.4 and handle its breaking API changes.
2022-04-08Merge #1643bors[bot]
1643: Replace the IoVec struct with IoSlice and IoSliceMut from the standard library r=asomers a=notgull As per discussion in #1637, the `IoVec<&[u8]>` and `IoVec<&mut [u8]>` types have been replaced with `std::io::IoSlice` and `IoSliceMut`, respectively. Notable changes made in this pull request include: - The complete replacement of `IoVec` with `IoSlice*` types in both public API, private API, and tests. - Replacing `IoVec` with `IoSlice` in docs. - Replacing `&[IoVec<&mut [u8]>]` with `&mut [IoSliceMut]`, note that the slice requires a mutable reference now. This is how it's done in the standard library, and there might be a soundness issue in doing it the other way. Resolves #1637 Co-authored-by: not_a_seagull <notaseagull048@gmail.com>
2022-04-08Replace the IoVec type with IoSlice and IoSliceMutnot_a_seagull
2022-04-07Add IP_DONTFRAG and IPV6_DONTFRAG SockOptsJunho Choi
IP_DONTFRAG: iOS, macOS IPV6_DONTFRAG: android, iOS, linux and macOS Test: `cargo test --test test dontfrag_opts` Some CI tests running ENOPROTOOPT are disabled (qemu-based).
2022-03-23Make `uname` always safeJan Bujak
This fixes several issues with the current `uname` bindings: - Do not ignore `uname` errors; at least on glibc `uname` can fail, so now it returns a `Result` instead of assuming that the call will always succeed. - Do not assume `uname` will initialize every member of `utsname`; not every implementation initializes every field, so internally the struct is now zero-initialized. - Do not blindly assume strings returned by `uname` will always be valid UTF-8; `UtsName`'s accessors will now return `&OsStr`s instead of `&str`s.
2022-03-22Deprecate IpAddr, Ipv4Addr, and Ipv6AddrAlan Somers
Because they're redundant with types in the standard library. Fixes #1681
2022-03-21Replace the Sockaddr enum with a unionAlan Somers
The SockAddr enum is quite large, and the user must allocate space for the whole thing even though he usually knows what type he needs. Furthermore, thanks to the sa_family field, the sockaddr types are basically an enum even in C. So replace the ungainly enum with a SockaddrLike trait implemented by all sockaddr types and a SockaddrStorage union that has safe accessors. Also, deprecate InetAddr, which only existed to support SockAddr. Supplants #1504 Fixes #1544
2022-03-13Change getrlimit and setrlimit to use rlim_t directly.Arnavion
Fixes #1666
2022-03-09wait: implement waitid()Matthias Schiffer
waitid() has a number of additional features that waitpid() is missing: - WNOWAIT is only accepted for waitid() on Linux (and possibly other platforms) - Support for waiting on PID file descriptors on Linux For now support is added for all platforms with waitid() that have proper siginfo_t support in libc. NetBSD support is currently a work in progress [1]. Tests for the signal/exit code are currently skipped on MIPS platforms due to bugs in qemu-user's translation of siginfo_t (fixed in [2] and [3]; the second fix is not in a released qemu version yet). [1] https://github.com/rust-lang/libc/pull/2476 [2] https://lists.nongnu.org/archive/html/qemu-devel/2021-01/msg04810.html [3] https://lists.nongnu.org/archive/html/qemu-devel/2021-10/msg05433.html
2022-02-22also implement Read and Write for &PtyMasterJesse Luehrs
2022-01-24uclibc supportJonah Petri
2022-01-22Better type safety for mqueueAlan Somers
On some platforms, mqd_t is a pointer. That means code like the below can trigger a segfault. Fix it by defining a Newtype around mqd_t that prevents use-after-free and dangling pointer scenarios. ```rust fn invalid_mqd_t() { let mqd: libc::mqd_t = std::ptr::null_mut(); mq_close(mqd).unwrap(); } ``` Also, get test coverage for mqueue in CI on FreeBSD.
2022-01-11Merge #1630bors[bot]
1630: Change port used by test_txtime to avoid conflict r=asomers a=rtzoeller The socket tests request specific ports, and `test_timestamping` and `test_txtime` are currently conflicting in the port they request. This leads to the second of the tests failing with `EADDRINUSE` when run locally. Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
2022-01-10Change port used by test_txtime to avoid conflictRyan Zoeller
2022-01-10Add getresuid/gid and setresuid/gid on BSDsRyan Zoeller
2022-01-03Add sendfile(2) for DragonFlyRyan Zoeller
2022-01-02Correct MAP_FIXED documentation for NetBSDRyan Zoeller
The previous documentation described the default behavior, rather than the behavior when the flag was set. Also fix a test which is failing due to passing this flag erroneously.
2022-01-02Merge #1624bors[bot]
1624: Fix mq tests on NetBSD and DragonFly r=asomers a=rtzoeller NetBSD (and DragonFly, which borrows its implementation) include additional flags beyond O_NONBLOCK in MqAttr, such as the flags passed to mq_open(). Modify the mq tests to validate _at least_ the expected flags are set, but don't require strict equality on these platforms. Verified these tests pass on DragonFly and NetBSD locally. Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
2022-01-02Fix intermittency in test_timer::alarm_firesAlan Somers
The test was disabling the signal handler before disabling the timer. Fix intermittent failures by: * Reversing the cleanup order. * Sleeping for a while before removing the signal handler, since POSIX does not guarantee that timer_delete will clear pending signals. Also, speed up the timer to make the test suite complete faster.
2022-01-01Fix mq tests on NetBSD and DragonFlyRyan Zoeller
NetBSD (and DragonFly, which borrows its implementation) include additional flags beyond O_NONBLOCK in MqAttr, such as the flags passed to mq_open().
2021-12-30Introduce timer_* supportBrian L. Troutwine
This commit adds support for the signal timer mechanism in POSIX, the mirror to timerfd on Linux. Resolves #1424 Signed-off-by: Brian L. Troutwine <brian@troutwine.us>
2021-12-29Add support for the SO_TXTIME sockopt and SCM_TXTIME control messageAlessandro Ghedini
2021-12-27Merge #1596 #1621bors[bot]
1596: Add NetBSD configuration for supported process resources r=asomers a=schctl In addition to existing resources, NetBSD supports `RLIMIT_MEMLOCK`, `RLIMIT_NPROC` and `RLIMIT_RSS`. https://man.netbsd.org/setrlimit.2 `RLIMIT_AS` is also supported, but it looks like it was added [after version 5.0](https://mail-index.netbsd.org/tech-kern/2009/03/28/msg004702.html), so I'm not sure if that should be enabled. 1621: Add posix_fallocate on DragonFly r=asomers a=rtzoeller Enable the existing `posix_fallocate()` tests as they are passing locally. Co-authored-by: Sachin Cherian <sachinctl@protonmail.com> Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
2021-12-27Add posix_fallocate on DragonFlyRyan Zoeller
2021-12-26Fix typosRyan Zoeller
2021-12-24Merge #1547bors[bot]
1547: feat: Add glibc::SOF_TIMESTAMPING_* support r=asomers a=pacak Support for kernel and hardware receive timestamps Co-authored-by: Michael Baikov <manpacket@gmail.com>
2021-12-24Disable mknod and mknodat tests on DragonFlyRyan Zoeller
2021-12-23feat: Add glibc::SOF_TIMESTAMPING_* supportMichael Baikov
2021-12-22Enable sched_get/setaffinity on DragonFly BSDRyan Zoeller
2021-12-22Recent versions of Android support EPOLLEXCLUSIVERyan Zoeller
Enable epoll tests on Android, because they are passing.
2021-12-21DragonFly 6.0 added fexecve(2)Ryan Zoeller
2021-12-14Test preadv and pwritev on more operating systemsAlan Somers
This was an oversight from PR #1511
2021-12-11clippy cleanup with the latest nightlyAlan Somers
2021-11-27Avoid lock poisoning by using parking_lotRyan Zoeller
parking_lot provides synchronization primitives which aren't poisoned on panic. This makes it easier to determine which tests are failing, as a test failure no longer causes all subsequent tests using that mutex to fail.
2021-10-21Fix unsoundness in `FdSet` methodstaylor.fish
Ensure file descriptors are nonnegative and less than `FD_SETSIZE`. (Fixes #1572.)
2021-09-28Fix return value of posix_fadviseHaruki Okada
libc::posix_fadvise returns errnos directly rather than in the errno variable.
2021-09-19Fix #411 - Provide accessors for 'events' in PollFdConrad Meyer
Test: `cargo test --test test test_pollfd_events`
2021-09-19Actually connect the mman tests to the buildAlan Somers
This was an oversight from #1306. Reported-by: @ocadaruma
2021-09-19Clippy cleanupAlan Somers
And this time, start running Clippy in CI
2021-09-19Merge #1496bors[bot]
1496: Rework UnixAddr to fix soundness issues r=asomers a=coolreader18 Fixes #1494 I went with making `sun_path` always nul-terminated since that just seems to make things easier, since (at least according to linux man pages) `sockaddr_un`s returned by the kernel will always be nul-terminated. Co-authored-by: Noa <33094578+coolreader18@users.noreply.github.com>
2021-09-12mman module netbsd additions.David Carlier
2021-09-12Merge #1509 #1515bors[bot]
1509: Allow Android to use timerfd r=asomers a=rtzoeller This is a continuation of #1336 which also enables the timerfd tests. ``` running 3 tests test sys::test_timerfd::test_timerfd_unset ... ok test sys::test_timerfd::test_timerfd_oneshot ... ok test sys::test_timerfd::test_timerfd_interval ... ok ``` 1515: Add IP_TTL/IPV6_UNICAST_HOPS SockOpts r=asomers a=cemeyer Test: `cargo test --test test test_ttl_opts` Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com> Co-authored-by: Conrad Meyer <cem@FreeBSD.org>
2021-09-07Add IP_TTL/IPV6_UNICAST_HOPS SockOptsConrad Meyer
Test: `cargo test --test test test_ttl_opts`
2021-09-07Merge branch 'master' into socket-mssAlan Somers
2021-09-07Merge #1516bors[bot]
1516: Implement AsRawFd for PollFd r=asomers a=cemeyer Implement the trait on PollFd, providing an `as_raw_fd()` accessor to get the RawFd associated with the PollFd. Subsumes #1147, #1286. Closes #1146. Test: `cargo test --test test test_pollfd_fd` Co-authored-by: Conrad Meyer <cem@FreeBSD.org>
2021-09-07Merge #1317bors[bot]
1317: test_af_alg_aead waits indefinitely r=asomers a=ritzk Starting with linux kernel 4.9, the crypto interface changed slightly such that the authentication tag memory is only needed in the output buffer for encryption and in the input buffer for decryption. Thus, we have fewer bytes to read than the buffer size. Do not block on read. alternatively, we can adjust the decrypted buffer size based on kernel version ( ">= 4.9") to not include auth_size . ``` if kernel_version >= "4.9": let mut decrypted = vec![0u8; payload_len + (assoc_size as usize) ]; ``` before ``` test sys::test_socket::test_af_alg_aead ... test sys::test_socket::test_af_alg_aead has been running for over 60 seconds ``` after ``` test sys::test_socket::test_af_alg_aead ... ok ``` Co-authored-by: Ritesh Khadgaray <khadgaray@gmail.com>
2021-09-07Implement AsRawFd for PollFdConrad Meyer
Implement the trait on PollFd, providing an `as_raw_fd()` accessor to get the RawFd associated with the PollFd. Subsumes #1147, #1286. Closes #1146. Test: `cargo test --test test test_pollfd_fd`
2021-09-06Add support for IP_RECVERR and IPV6_RECVERRConrad Meyer
Setting these options enables receiving errors, such as ICMP errors from the network, via `recvmsg()` with `MSG_ERRQUEUE`. Adds new `Ipv{4,6}RecvErr` variants to `ControlMessageOwned`. These control messages are produced when `Ipv4RecvErr` or `Ipv6RecvErr` options are enabled on a raw or datagram socket. New tests for the functionality can be run with `cargo test --test test test_recverr`. This commit builds on an earlier draft of the functionality authored by Matthew McPherrin <git@mcpherrin.ca>.
2021-09-04Merge branch 'master' into socket-msseaon
2021-09-04Support for `TCP_MAXSEG` TCP MSS socket optioneaon