summaryrefslogtreecommitdiff
path: root/test/test_stat.rs
AgeCommit message (Collapse)Author
2021-09-19Clippy cleanupAlan Somers
And this time, start running Clippy in CI
2021-08-22Fix building the tests for Redox and IllumosAlan Somers
Also, split the overbroad test_mknod_family into two tests
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-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-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-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.
2020-05-31Convert the crate to edition 2018Alan Somers
2020-05-17Remove warnings when compiling for RedoxXavier L'Heureux
2020-05-17Remove temporarily the failing tests for RedoxXavier L'Heureux
TODO: Fix them in Relibc
2020-05-17Remove more unsupported functions and make it possible to run testsXavier L'Heureux
2019-09-19Where relevant, replace equality checks in assert! with assert_eq!Xavier L'Heureux
`assert_eq!` gives more debug info when the test fails by default than `assert!`. This should help make debugging easier.
2019-06-15sys/stat: implement mkdiratKevin Wern
2019-06-06Fix some bugs with multithreaded tests:Alan Somers
* kmod tests must run exclusively, because they load and unload a module with a constant name. * A few tests were doing some variant of chdir, but weren't taking the CWD_MTX. * The kmod tests read files by path relative to CWD, so they need the CWD_MTX. But they don't need it exclusively, so convert the CWD_MTX into an RwLock. * Tests that do change the cwd need to change it back when they're done.
2019-01-15Fix build and tests issues on OpenBSD 6.4+Andrei-Marius Radu
1) lutimes doesn't exist on OpenBSD so it needs to be under conditional compilation. The only "reference" that I could find related to this is the discussion here: https://github.com/rust-lang/libc/pull/790 . 2) fexecve doesn't exist on OpenBSD so add conditional compilation for it in unistd and in related tests. The only "reference" that I could find is a mention that fexecve is not implemented on OpenBSD in the manual pages for signal(3) and sigaction(2): Official repository (search for "fexecve"): https://cvsweb.openbsd.org/src/lib/libc/sys/sigaction.2?rev=1.75&content-type=text/x-cvsweb-markup Github mirror: https://github.com/openbsd/src/blob/master/lib/libc/sys/sigaction.2#L619 3) AIO doesn't work on OpenBSD so put test_aio_drop under conditional compilation. 4) Add relevant changelog entries. P.S. On OpenBSD remains the issue of test_scm_rights which builds correctly but fails at runtime.
2018-12-16Allow 'cargo test' to complete successfully on NetBSD 8.0.Tom Pusateri
Some tests have been disabled and will need further review.
2018-11-07Add a wrapper for lutimes(2)Julio Merino
PR #944 added wrappers for the more-modern futimens(2) and utimesat(2), but unfortunately these APIs are not available on old-ish systems. In particular, macOS Sierra and below don't implement them, making the new APIs unusable. Whether we should care about such "old" systems is debatable, but the problem is that, at the moment, this is the only macOS version usable on Travis to test kexts and, thus, to test FUSE file systems. This should have been part of PR #946, which added a wrapper for utimes(2) following this same rationale, but missed lutimes(2) because I simply didn't notice it existed.
2018-10-15Eliminate compiler warnings, especially on non-Linux platformsAlan Somers
2018-10-02Add a wrapper for utimes(2)Julio Merino
PR #944 added wrappers for the more-modern futimens(2) and utimesat(2), but unfortunately these APIs are not available on old-ish systems. In particular, macOS Sierra and below don't implement them, making the new APIs unusable. Whether we should care about such "old" systems is debatable, but the problem is that, at the moment, this is the only macOS version usable on Travis to test kexts and, thus, to test FUSE file systems.
2018-09-29Add wrappers for futimens(2) and utimesat(2)Julio Merino
2018-09-01deps: update tempfile to 3Igor Gnatenko
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-03-23Add fchmod, fchmodat functions.Anton Ageev
2017-12-20Remove useless Err(_) match armsBryant Mairs
2017-09-04test/test_stat.rs: use matching tempdir name for test_fstatatJörg Thalheim
2017-09-04test/test_stat.rs: test correct stat functionJörg Thalheim
2017-03-21add support for `fstatat`Jörg Thalheim
2016-01-18update libc to 0.2.2Mattis Marjak
2016-01-13Use tempdir for temporary files in testsKamal Marhubi
2016-01-13Fix compiler warnings in testsKamal Marhubi
2015-09-03test_stat: Remove st_rdev testGeoffrey Thomas
On FreeBSD, st_rdev seems to be set to a unique value (correlated with, but not identical to, st_ino) per file. Neither the FreeBSD nor Linux man page makes any promises on st_rdev for regular files; useful test coverage of st_rdev would check it on a special file. All tests now pass on FreeBSD.
2015-07-27Make it compatible for Android.Tim JIANG
* Fixed an unused_import error in `termios.rs` for Android. * Fixed undefined references to `preadv` and `pwritev` for Android - At least they don't exist from API level 3 to 21. * Fixed the uid > 0 and gid > 0 checks in `stat`'s tests - Running the tests by root is possible, especially when running on a rooted Android device. Those changes made rust-nix buildable (again) on Android. All the tests passed as well.
2015-07-10Fix comparisonCarl Lerche
2015-07-10Fix unit tests as blank files can still have blocksAlex Newman
On an encrypted filesystem everything acts like a symlink $ stat baz File: ‘baz’ Size: 0 Blocks: 16 IO Block: 4096 regular empty file Device: 26h/38d Inode: 6835152 Links: 1 Access: (0664/-rw-rw-r--) Uid: ( 1000/ posix4e) Gid: ( 1000/ posix4e) Access: 2015-07-10 11:11:21.846851777 -0700 Modify: 2015-07-10 11:11:21.846851777 -0700 Change: 2015-07-10 11:11:21.846851777 -0700 Birth: -
2015-05-08Add lstatSkyler Hawthorne
2015-03-25Track Rust masterCarl Lerche
2015-03-24NixResult -> nix::Result; NixError -> nix::ErrorCarl Lerche
2015-03-13added test for fstatMarkus Jais
2015-02-21Cleanup readv & writev + testsCarl Lerche