summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Newman <posix4e@gmail.com>2015-07-10 11:11:31 -0700
committerAlex Newman <posix4e@gmail.com>2015-07-10 11:14:35 -0700
commitca14371749d25f4d4af18ca3e45fa487928ab04d (patch)
tree84f738a0d3e3808f8d08482b62bdf0f3ce50cbca
parentd49aa0737f3ed7734c2f4964cf0683f643144a60 (diff)
downloadnix-ca14371749d25f4d4af18ca3e45fa487928ab04d.zip
Fix unit tests as blank files can still have blocks
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: -
-rw-r--r--test/test_stat.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/test_stat.rs b/test/test_stat.rs
index 44091a7c..18f6fa8f 100644
--- a/test/test_stat.rs
+++ b/test/test_stat.rs
@@ -23,7 +23,7 @@ fn assert_stat_results(stat_result: Result<FileStat>) {
assert!(stats.st_rdev == 0); // no special device
assert!(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 == 0); // no blocks allocated because file size is 0
+ assert!(stats.st_blocks >= 16); // Up to 16 blocks can be allocated for a blank file
}
Err(_) => panic!("stat call failed") // if stats system call fails, something is seriously wrong on that machine
}