summaryrefslogtreecommitdiff
path: root/test/test_stat.rs
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2021-05-30 12:27:39 -0600
committerAlan Somers <asomers@gmail.com>2021-05-30 20:12:41 -0600
commit7b7d9540056f6378820caf955a0335268184d6b7 (patch)
treef27fa7b8dbb4d089c0f7bda9569bfab8ead1b4dc /test/test_stat.rs
parenta55dd4537286c8fbd96e3e21e18c56a38f8124b9 (diff)
downloadnix-7b7d9540056f6378820caf955a0335268184d6b7.zip
misc Clippy cleanup
* 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.
Diffstat (limited to 'test/test_stat.rs')
-rw-r--r--test/test_stat.rs14
1 files changed, 0 insertions, 14 deletions
diff --git a/test/test_stat.rs b/test/test_stat.rs
index 98112d61..27fcee59 100644
--- a/test/test_stat.rs
+++ b/test/test_stat.rs
@@ -44,18 +44,6 @@ use nix::unistd::chdir;
#[cfg(not(any(target_os = "netbsd", target_os = "redox")))]
use nix::Result;
-use tempfile;
-
-#[allow(unused_comparisons)]
-// uid and gid are signed on Windows, but not on other platforms. This function
-// allows warning free compiles on all platforms, and can be removed when
-// expression-level #[allow] is available.
-#[cfg(not(any(target_os = "netbsd", target_os = "redox")))]
-fn valid_uid_gid(stat: FileStat) -> bool {
- // uid could be 0 for the `root` user. This quite possible when
- // the tests are being run on a rooted Android device.
- stat.st_uid >= 0 && stat.st_gid >= 0
-}
#[cfg(not(any(target_os = "netbsd", target_os = "redox")))]
fn assert_stat_results(stat_result: Result<FileStat>) {
@@ -64,7 +52,6 @@ fn assert_stat_results(stat_result: Result<FileStat>) {
assert!(stats.st_ino > 0); // inode is positive integer, exact number machine dependent
assert!(stats.st_mode > 0); // must be positive integer
assert_eq!(stats.st_nlink, 1); // there links created, must be 1
- assert!(valid_uid_gid(stats)); // must be positive integers
assert_eq!(stats.st_size, 0); // size is 0 because we did not write anything to the file
assert!(stats.st_blksize > 0); // must be positive integer, exact number machine dependent
assert!(stats.st_blocks <= 16); // Up to 16 blocks can be allocated for a blank file
@@ -84,7 +71,6 @@ fn assert_lstat_results(stat_result: Result<FileStat>) {
// On other platforms they are the same (either both are u16 or u32).
assert_eq!((stats.st_mode as usize) & (S_IFMT as usize), S_IFLNK as usize); // should be a link
assert_eq!(stats.st_nlink, 1); // there links created, must be 1
- assert!(valid_uid_gid(stats)); // must be positive integers
assert!(stats.st_size > 0); // size is > 0 because it points to another file
assert!(stats.st_blksize > 0); // must be positive integer, exact number machine dependent