summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
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
2021-04-04Check all tests in CIAlan Somers
Travis didn't compile check tests on platforms that couldn't run tests in CI, so they bitrotted. Let's see how bad they are. Most annoyingly, 32-bit Android defines mode_t as 16 bits, but stat.st_mode as 32-bits.
2021-03-22Revert "Temporarily disable test_vsock on QEMU arches"Stefano Garzarella
This reverts commit c0783e7f8d55a7725179afc1b3c8eeae932d228c. Now the test should work correctly, so we can re-enable it. Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2021-03-22Fix test_vsock failure on VMADDR_CID_LOCAL testingStefano Garzarella
Starting from Linux 5.6, VMADDR_CID_LOCAL is supported to do local communication (loopback device). Before Linux 5.6 it was called VMADDR_CID_RESERVED and was not supported, so we could expect an EADDRNOTAVAIL, but now this address is supported and handled by the 'vsock_loopback' kernel module loaded automatically if no other vsock transports are loaded. Issue #1310 Issue #1403 Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2021-03-21illumos and Solaris supportJason King
Co-authored-by: Dominik Hassler <hadfl@omnios.org> Co-authored-by: Joshua M. Clulow <josh@sysmgr.org>
2021-03-21Temporarily disable test_vsock on QEMU archesAlan Somers
Issue #1403
2021-02-21Merge #1390bors[bot]
1390: pty: Make forkpty() unsafe r=asomers a=tavianator After the child returns from a fork() of a multi-threaded process, it is undefined behaviour to call non-async-signal-safe functions according to POSIX. Since forkpty() is implemented in terms of fork(), those restrictions should apply to it too. Fixes #1388 Co-authored-by: Tavian Barnes <tavianator@tavianator.com>
2021-02-20pty: Make forkpty() unsafeTavian Barnes
After the child returns from a fork() of a multi-threaded process, it is undefined behaviour to call non-async-signal-safe functions according to POSIX. Since forkpty() is implemented in terms of fork(), those restrictions should apply to it too.
2021-02-20Update rand to 0.8Alan Somers
This eliminates some duplicate dependencies
2021-02-20Fix a non_fmt_panic warning with Rustc 1.52.0Alan Somers
2021-02-15Fix test_ptrace_syscall() on x32наб
Based on https://github.com/nix-rust/nix/issues/1384#issuecomment-774708486
2021-02-15Port mqueue to x32наб
Test fix obtained from https://github.com/nix-rust/nix/issues/1384#issuecomment-774708486
2021-02-15Dir: Implement `IntoIterator` for `Dir`William Manley
This is useful to allow returning an iterator based on a directory iterator without needing a self-referential struct.
2021-01-03Fix fcntl for FreeBSDAlexander Thaller
Need to use the right cfg option for the conditional compilation. target_os is the right option to use when targeting FreeBSD. target_env was used before which seems to be a typo.
2020-12-19unistd: Add getpeereid(3)William Woodruff
Closes #1339.
2020-12-19Add fuchsia supportAmanda Tait
Allow nix to compile on Fuchsia by conditionally avoiding libc functionality that does not exist for Fuchsia.
2020-12-14Ignore failures of test_aio_suspend on macosAlan Somers
On Cirrus-CI, this test frequently fails with EINVAL. The error goes away if I add a line of debugging, so it's probably a timing issue. But I can't debug it myself. Issue #1361
2020-12-10Remove a workaround for an old Musl bugAlan Somers
In older versions of Musl, ttyname_r would wrongly return ENOTTY instead of EBADF. We expected that bug in our test suite. But Rust 1.37.0 updated Musl to 1.1.22, which fixes the problem. This change reverts our workaround. https://www.openwall.com/lists/musl/2018/09/15/2 https://github.com/rust-lang/rust/commit/aaf66987931dfe06a547b9f68cb709e9b6265b5c
2020-12-09Ignore the execve tests on muslAlan Somers
On Cirrus-CI, these tests frequently segfault. It's probably indicative of a real bug, not just a problem in the tests. But for now we need to skip them to get CI working. Issue #555
2020-12-08Fix unreliability in sys::test_aio::test_aio_suspendAlan Somers
On OSX, this test has begun to fail in CI on OSX. Presumably it's because aio_suspend was getting interrupted by a signal.
2020-12-08Fix a race in the test_unistd::test_fchown testAlan Somers
The test was assuming that once dropped, a temporary file's file descriptor would be invalid. But it might not be, because another file might be opened with the same file descriptor. Instead, use an obviously invalid file descriptor.