summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
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.
2020-12-07Fix a use-after-free in execve_test_factoryAlan Somers
Ensure that the exec functions' arguments are valid for 'static. Previously they were short-lived temporaries.
2020-12-06Switch all builds from Travis to CirrusAlan Somers
Travis has been super-slow lately (> 6 hours per build). Cirrus is much faster: about 20 minutes. Cirrus also has slightly better test coverage, mainly because it doesn't use SECCOMP. Also, * Fix the Redox CI build. The old Travis configuration didn't actually build for Redox, so we never noticed that Redox can't be built with a stable compiler. Thanks to @coolreader18 for finding this. * Disable the udp_offload tests on cross-tested platforms. These tests are failing with ENOPROTOOPT in Cirrus-CI. I suspect it's due to a lack of support in QEMU. These tests were skipped on Travis because its kernel was too old. * Fix require_kernel_version on Cirrus-CI. Cirrus reports the Linux kernel version as 4.19.112+, which the semver crate can't handle. * Fix test_setfsuid on Cirrus. When run on Cirrus, it seems like the file in /tmp gets deleted as soon as it's closed. Probably an overzealous temporary file cleaner. Use /var/tmp, because no temporary file cleaner should run in there. * Skip mount tests on Cirrus. They fail for an unknown reason. Issue #1351 * Skip the AF_ALG tests on Cirrus-CI Issue #1352
2020-12-06Handle SIGRT_1 in test_alarmAlan Somers
When run in Cirrus-CI's environment, the tests generate copious SIGRT_1 signals. This commit ensures that test_alarm will ignore them.
2020-12-06Make the poll tests resilient against signalsAlan Somers
When run in Cirrus-CI's environment, the tests generate copious SIGRT_1 signals. This commit ensures that the poll tests will retry on EINTR.
2020-11-29Merge #1345bors[bot]
1345: Disable test-aio-drop in GNU environments r=asomers a=asomers This test occasionally fails in Travis on x86_64-unknown-linux-gnu. The failure takes the form of the test executable receiving a random signal. Sometimes SIGHUP, sometimes SIGKILL, etc. I think this must be a bug in glibc, even though I can't reproduce it in my development environment. But it interferes with CI too much to leave enabled. Co-authored-by: Alan Somers <asomers@gmail.com>
2020-11-28Disable test-aio-drop in GNU environmentsAlan Somers
This test occasionally fails in Travis on x86_64-unknown-linux-gnu. The failure takes the form of the test executable receiving a random signal. Sometimes SIGHUP, sometimes SIGKILL, etc. I think this must be a bug in glibc, even though I can't reproduce it in my development environment. But it interferes with CI too much to leave enabled.
2020-11-27Fix recvmmsg(2) implementationToby DiPasquale
There were two problems discovered with the `recvmmsg(2)` implementation that this changeset attempts to fix: 1. As mentioned in nix-rust/issues/1325, `recvmmsg(2)` can return fewer messages than requested, and 2. Passing the return value of `recvmmsg(2)` as the number of bytes in the messages received is incorrect. This changeset incorporates the proposed fix from nix-rust/issues/1325, as well as passing the correct value (`mmsghdr.msg_len`) for the number of bytes in a given message.
2020-10-17test_af_alg_aead waits indefinitelyRitesh Khadgaray
Starting with 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.
2020-10-16update require_kernel_version to handle "_" in version stringRitesh Khadgaray
test code breaks on fedora 33 ``` $ cargo test failures: ---- sys::test_socket::recvfrom::udp_offload::gro stdout ---- thread 'sys::test_socket::recvfrom::udp_offload::gro' panicked at 'called `Result::unwrap()` on an `Err` value: ParseError("Extra junk after valid version: _64")', test/sys/test_socket.rs:292:13 ``` this is due underscore in release string( arch/x86_64), which is not supported by semver. ``` $ uname -r 5.8.14-300.fc33.x86_64 ``` Replace the underscore with hypen to provide a consistent sematic.
2020-10-15Merge #1313bors[bot]
1313: Update to cfg-if 1.0 r=asomers a=mbrubeck Co-authored-by: Matt Brubeck <mbrubeck@limpet.net>
2020-10-15Update to cfg-if 1.0Matt Brubeck
2020-10-13Add wrapper for mremapJim Newsome
2020-10-10Add support for TCP_KEEPCNT and TCP_KEEPINTVL TCP keepalive options.Yoav Steinberg
2020-10-04Support vsock on Android as well as Linux.Andrew Walbran
Fix deprecation warning from libc update.
2020-10-03Merge #1293bors[bot]
1293: Mark nix::unistd::fork as unsafe. r=asomers a=vi Fix tests. No change in documentation. Resolves #1030. Don't forget to bump major version number to `0.19`. Co-authored-by: Vitaly _Vi Shukela <vi0oss@gmail.com>
2020-09-28Added clock_gettime, clock_getres, clock_settime, clock_getcpuclockidDaniil Bondarev
2020-09-20Mark nix::unistd::fork as unsafe.Vitaly _Vi Shukela
Fix tests. No change in documentation. Resolves #1030.
2020-09-06Merge #1290bors[bot]
1290: use subordinate terminal device for termios calls r=asomers a=jclulow The pseudo-terminal device handling tests in some places make tcgetattr(3C) and tcsetattr(3C) calls using the control/manager file descriptor rather than the subordinate terminal descriptor. This works on some systems, but not all; others such as illumos (and presumably Solaris) are more strict and require the termios requests be made against the terminal descriptor only. Co-authored-by: Joshua M. Clulow <jmc@oxide.computer>
2020-08-11use subordinate terminal device for termios callsJoshua M. Clulow
The pseudo-terminal device handling tests in some places make tcgetattr(3C) and tcsetattr(3C) calls using the control/manager file descriptor rather than the subordinate terminal descriptor. This works on some systems, but not all; others such as illumos (and presumably Solaris) are more strict and require the termios requests be made against the terminal descriptor only.
2020-07-28Allow both &[CString] and &[&CStr] for sequence argsJeong YunWon
2020-07-26Support nullable timeout in ppollMikail Bagishov
2020-07-25Merge #1224bors[bot]
1224: Update the Linux CI environment to Ubuntu Bionic r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com> Co-authored-by: Alan Somers <asomers@axcient.com>
2020-07-07Adding an implementation and some basic tests for timerfd.Vincent Dagonneau
Removed support for timerfd on Android as it seems to have been deprecated? See https://android.googlesource.com/platform/development/+/73a5a3b/ndk/platforms/android-20/include/sys/timerfd.h or https://github.com/rust-lang/libc/issues/1589 Removed the public status of `TimerSpec`, as it should not be exposed to the user. Implemented `FromRawFd` for `TimerFd` as it already implements `AsRawFd`. Addressed comments from the latest code review: - Removed upper bound assertions on timer expirations in tests. - Made the main example runnable and added code to show how to wait for the timer. - Refactored `ClockId` to use `libc_enum`. - Added comments for all public parts of the module. - Wrapped to 80 cols. - Changed the size of the buffer in the tests to the minimum required. * Ran rustfmt. * Added a `From` implementation for `libc::timespec` -> `TimeSpec`. * Reworked the example with the new changes and changed the timer from 5 to 1 second. * Added a constructor for a 0-initialized `TimerSpec`. * Added a new method to get the timer configured expiration (based on timerfd_gettime). * Added an helper method to unset the expiration of the timer. * Added a `wait` method to actually read from the timer. * Renamed `settime` into just `set`. * Refactored the tests and added a new one that tests both the `unset` and the `get` method. Modified CHANGELOG.
2020-07-03implement ttynameJesse Luehrs
2020-07-03Skip the OFD locks tests on OverlayFS and muslAlan Somers
OFD lock functions don't work as expected on overlayfs, which is a type of union file system. And OVERLAYFS_SUPER_MAGIC isn't defined on musl, at least not yet.
2020-07-03Add a missing require_capability! to a testAlan Somers
2020-07-03Factor out common code from the various skip macrosAlan Somers
2020-06-26Add Ipv{4,6}PacketInfo support to ControlMessage for send{m,}msgPerry Lorier
This adds Ipv4PacketInfo and Ipv6PacketInfo to ControlMessage, allowing these to be used with sendmsg/sendmmsg. This change contains the following squashed commits: Add Ipv{4,6}PacketInfo to ControlMessage. Add documentation links to Ipv{4,6}PacketInfo Add changelog entry for Ipv{4,6}PacketInfo Add link to PR in the Changelog. Add extra build environments. Add tests for Ipv{4,6}PacketInfo. Swap #[test] and #[cfg] The CI appears to be running the test, even though it's not cfg'd for that platform. I _think_ this might be due to these being in the wrong order. So lets try swapping them. s/freebsd/netbsd/ for Ipv4PacketInfo netbsd supports in_pktinfo, not freebsd. Fix the cfg for Ipv{4,6}PacketInfo usage. Ah, I see what I did wrong. I had fixed the definitions, but I had the wrong cfg() in the usage. This has the usage match the definitions. Change SOL_IPV6 to IPPROTO_IPV6. FreeBSD doesn't have SOL_IPV6, but does have IPPROTO_IPV6, and the two constants are defined as being equal. So change to use IPPROTO_IPV6. Skip Ipv6PacketInfo test if v6 is not available. If IPv6 is not available, then when we try and bind to ip6-localhost, we'll get a EADDRNOTAVAIL, so skip the test. This should mean that the test will run on any machine that has a v6 loopback address. More architecture cfg() fixes. These all need to be the same, and they were not. Make them them all the same. Attempt III. Fix up mismatched cfg's again. Take IV. Make sure the cfg's that use a enum variant match the enum definition.
2020-06-12Merge #1255bors[bot]
1255: Remove several deprecated constants and functions r=asomers a=asomers * `unistd::daemon` on Apple * `unistd::pipe2` on Apple * `sys::event::FilterFlag::NOTE_EXIT_REPARENTED` on Apple * `sys::event::FilterFlag::NOTE_REAP` on Apple * `sys::ptrace::ptrace` on Android and Linux All have been deprecated for more than two releases and one year. Co-authored-by: Alan Somers <asomers@gmail.com>
2020-06-12Add fchown(2) wrapper.Nate Avers
2020-06-05Respond to review commentsAlan Somers
2020-06-04Remove several deprecated constants and functionsAlan Somers
* `unistd::daemon` on Apple * `unistd::pipe2` on Apple * `sys::event::FilterFlag::NOTE_EXIT_REPARENTED` on Apple * `sys::event::FilterFlag::NOTE_REAP` on Apple * `sys::ptrace::ptrace` on Android and Linux All have been deprecated for more than two releases and one year.
2020-06-04Limit internal termios API to pub(crate)Bryant Mairs
2020-05-31Fix test_ptymaster_drop after PR #1098Alan Somers
This test cannot be compiled under Redox. PR #1098 attempted to disable it for Redox, but actually disabled it everywhere. AFAICT, Cargo has no syntax to conditionally enable a target, except based on features. Instead, use conditional compilation within the test.
2020-05-31Convert the crate to edition 2018Alan Somers
2020-05-26Fix build on OpenBSD caused by erroneous inclusion in allowed OS list for ↵Nick Pelone
sendmmsg() / recvmmsg() in #1208. In #1208, sendmmsg() / recvmmsg() were added, but OpenBSD(who doesn't support these) was included on the list of allowed operating systems for sendmmsg() related things. This broke the build on OpenBSD. For more Rust-world examples, see: https://github.com/rust-lang/libc/commit/6f6297301d49ff67b8ca044d651f36a56950298c
2020-05-17Fix test and remove group & user for redoxXavier L'Heureux
- Make sure all tests pass the CI - Redox does not (yet) have passwd functions, so remove it
2020-05-17Add wait, fdatasync, poll and pause for RedoxXavier L'Heureux
2020-05-17Remove warnings when compiling for RedoxXavier L'Heureux