summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
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
2021-08-31Allow Android to use timerfdRyan Zoeller
Co-authored-by: zachoverflow <zach@zachjohnson.net>
2021-08-29Rework UnixAddr to fix soundness issuesNoa
2021-08-28Merge #1506bors[bot]
1506: Test Linux aarch64 on real aarch64 hardware. r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2021-08-27Ignore vsock tests on Linux aarch64Alan Somers
Apparently AWS Graviton containers don't support it. socket() retunrs EAFNOSUPPORT in that environment. Also, be more selective about skipping tests under QEMU Instead of skipping them on architectures where we happen to use QEMU, only skip them when QEMU is actually being used.
2021-08-22Print function name and missing capability when skipping testsRyan Zoeller
2021-08-22Fix building the tests for Redox and IllumosAlan Somers
Also, split the overbroad test_mknod_family into two tests
2021-08-21Deprecate SockAddr/InetAddr::to_strNoah
2021-08-17Relax assertions in sockaddr_storage_to_addr to match the documentation.Kyle Huey
Fixes #1479
2021-08-11Merge #1482bors[bot]
1482: Add support for LOCAL_PEER_CRED r=asomers a=asomers On FreeBSD and its derivatives, this socket option gets the credentials of the connected peer. Co-authored-by: Alan Somers <asomers@gmail.com>
2021-08-10Add support for LOCAL_PEER_CREDAlan Somers
On FreeBSD and its derivatives, this socket option gets the credentials of the connected peer.
2021-08-09Add PTRACE_INTERRUPTMika Vatanen
2021-08-01Add getrlimit and setrlimitLMJW
This work is a continutation on previou contribution by @kpcyrd and @j1ah0ng.
2021-07-28sys/stat: add a safe wrapper for mknodat(2)Luca BRUNO
This introduces a new `mknodat` helper. Ref: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html
2021-07-24unistd: Add conversion from User to libc::passwdorvij
Add From<User> for libc::passwd trait implementation to convert a User into a libc::passwd Implementation consumes the User struct, giving ownership over the internal members to the libc::passwd struct Add the User::gecos field to 64-bit Android builds, since it is supported by libc::passwd for those builds
2021-07-24Add pthread_killMartin Kröning
2021-07-08Support SO_RXQ_OVFL socket option (android/fuchsia/linux)Junho Choi
This PR implements support of RXQ_OVFL flag and parsing ControlMessage to get the packet drop counter of UDP socket.
2021-07-08Adding linux specific renameat2()Tom Boland
2021-07-07Collapse Error into ErrnoAlan Somers
Now that Nix's weird error types are eliminated, there's no reason not to simply use Errno as the Error type.
2021-07-07Overhaul Nix's error typesAlan Somers
For many of Nix's consumers it be convenient to easily convert a Nix error into a std::io::Error. That's currently not possible because of the InvalidPath, InvalidUtf8, and UnsupportedOperation types that have no equivalent in std::io::Error. However, very few of Nix's public APIs actually return those unusual errors. So a more useful API would be for Nix's standard error type to implement Into<std::io::Error>. This commit makes Error a simple NewType around Errno. For most functions it's a drop-in replacement. There are only three exceptions: * clearenv now returns a bespoke error type. It was the only Nix function whose error couldn't be cleanly mapped onto an Errno. * sys::signal::signal now returns Error(Errno::ENOTSUP) instead of Error::UnsupportedOperation when the user passes an incompatible argument to `handler`. * When a NixPath exceeds PATH_MAX, it will now return Error(Errno::ENAMETOOLONG) instead of Error::InvalidPath. In the latter two cases there is now some abiguity about whether the error code was generated by Nix or by the OS. But I think the ambiguity is worth it for the sake of being able to implement Into<io::Error>. This commit also introduces Error::Sys() as a migration aid. Previously that as an enum variant. Now it's a function, but it will work in many of the same contexts as the original. Fixes #1155
2021-06-13Add nmount for FreeBSD.Alan Somers
2021-06-12Reenable tests that only failed on Travis, since we no longer use it.Alan Somers
2021-06-12Fix some unused import warnings in the testsAlan Somers
2021-05-31Add getresuid() and getresgid() to unistdJeryl Vaz
2021-05-30misc Clippy cleanupAlan Somers
* Fix race conditions in the tests. Two tests were grabbing a mutex but immediately dropping it. Thank you, Clippy. * Remove vestigial Windows support. Remove some code added to support Windows in 2015. Nix is no longer intended to ever run on Windows. * Various other minor Clippy lints.
2021-05-30Adapt aio to the world of async/await, and fix some potential unsoundness.Alan Somers
* libc::aiocb must not be moved while the kernel has a pointer to it. This change enforces that requirement by using std::pin. * Split LioCbBuilder out of LioCb. struct LioCb relied on the (incorrect) assumption that a Vec's elements have a stable location in memory. That's not true; they can be moved during Vec::push. The solution is to use a Vec in the new Builder struct, but finalize it to a boxed slice (which doesn't support push) before allowing it to be submitted to the kernel. * Eliminate owned buffer types. mio-aio no longer uses owned buffers with nix::aio. There's little need for it in the world of async/await. I'm not aware of any other consumers. This substantially simplifies the code.
2021-05-30Merge #1439bors[bot]
1439: Add sendfile64 r=asomers a=tdryer `sendfile64` is a Linux-specific call with a wider type for the `offset` argument than `sendfile`. This is largely a copy of the existing `sendfile` function and associated test. Co-authored-by: Tom Dryer <tomdryer.com@gmail.com>
2021-05-28Disable sendfile64 on androidTom Dryer
It's not available from libc on that platform.
2021-05-28Add sendfile64Tom Dryer
`sendfile64` is a Linux-specific call with a wider type for the `offset` argument than `sendfile`. This is largely a copy of the existing `sendfile` function and associated test.
2021-05-27Update to semver 1.0.0David Tolnay
2021-05-01Hopefully improve unistd::alarm::set's doc test's reliabilityAlan Somers
2021-04-08Merge #1402bors[bot]
1402: Support TIMESTAMPNS r=asomers a=WiSaGaN This adds support of linux TIMESTAMPNS. The code is mostly copied paste from https://github.com/nix-rust/nix/pull/663 Co-authored-by: Lu, Wangshan <wisagan@gmail.com>
2021-04-08Support TIMESTAMPNS for linuxLu, Wangshan