summaryrefslogtreecommitdiff
path: root/test/test_unistd.rs
AgeCommit message (Collapse)Author
2023-01-08feat: I/O safety `ftruncate`Jonathan
2022-12-08feat: I/O safety for 'sys/termios' & 'pty'Steve Lau
2022-12-04Fix clippy lintsAlex Saveau
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-06Run a round of clippy to fix CIAlex Saveau
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-10-13add eaccess on FreeBSD, DragonFly and Linux (musl and glibc)Steve Lau
2022-08-09format codeSteveLauC
2022-08-09remove deprecated itemsSteveLauC
2022-08-05add faccessatZhang Miaolei
2022-08-04fix clippy assertions_on_result_statesMichael Baikov
https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states
2022-07-10Clippy cleanup in the tests.Alan Somers
* Remove a redundant closure. * Comparison with null * Manual implementation of find * Suppress a false positive
2022-06-24Fix all formating problems to pass CI formating testCostin-Robert Sin
Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
2022-06-07Fix the test_acct testAlan Somers
It has never actually executed its command, so the only reason that it ever worked is that on most systems there are usually processes starting and exiting all the time.
2022-05-14add haiku supportAl Hoang
* enabled as much functionality and defines that match updated libc definitions for haiku
2022-01-10Add getresuid/gid and setresuid/gid on BSDsRyan Zoeller
2021-12-21DragonFly 6.0 added fexecve(2)Ryan Zoeller
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-09-19Clippy cleanupAlan Somers
And this time, start running Clippy in CI
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-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-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-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-01Hopefully improve unistd::alarm::set's doc test's reliabilityAlan Somers
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-21illumos and Solaris supportJason King
Co-authored-by: Dominik Hassler <hadfl@omnios.org> Co-authored-by: Joshua M. Clulow <josh@sysmgr.org>
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-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 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-10-15Update to cfg-if 1.0Matt Brubeck
2020-09-20Mark nix::unistd::fork as unsafe.Vitaly _Vi Shukela
Fix tests. No change in documentation. Resolves #1030.
2020-07-28Allow both &[CString] and &[&CStr] for sequence argsJeong YunWon
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-03implement ttynameJesse Luehrs
2020-07-03Factor out common code from the various skip macrosAlan Somers
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-05-31Convert the crate to edition 2018Alan Somers
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-17Remove warnings when compiling for RedoxXavier L'Heureux