aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_bindfs.rb
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2012-04-05 12:56:05 +0300
committerMartin Pärtel <martin.partel@gmail.com>2012-04-05 12:56:05 +0300
commit2ee96eccd49c8f7f722b6dc21b60147a6c4997ec (patch)
tree935773238e6a137bfa694bf23e664f9d9f41c8a1 /tests/test_bindfs.rb
parentcfb79b08a1e0b72b8d905b24b565485eef13bd3e (diff)
downloadbindfs-2ee96eccd49c8f7f722b6dc21b60147a6c4997ec.tar.gz
Made -ouse_ino and -oreaddir_ino the default to mirror inodes.
Diffstat (limited to 'tests/test_bindfs.rb')
-rwxr-xr-xtests/test_bindfs.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb
index ef732ff..ff1ee24 100755
--- a/tests/test_bindfs.rb
+++ b/tests/test_bindfs.rb
@@ -41,6 +41,8 @@ $only_these_tests = ARGV unless ARGV.empty?
$nobody_uid = nobody_uid = Etc.getpwnam('nobody').uid
$nogroup_gid = nogroup_gid = Etc.getgrnam('nogroup').gid
+$tests_dir = File.dirname(File.realpath(__FILE__))
+
testenv("") do
assert { File.basename(pwd) == TESTDIR_NAME }
@@ -307,3 +309,24 @@ root_testenv("--map=0/1:@0/@1", :title => "--map and chown/chgrp") do
assert { File.stat('mnt/file1').uid == 1 }
assert { File.stat('mnt/file1').gid == 1 }
end
+
+testenv("", :title => "preserves inode numbers") do
+ touch('src/file')
+ mkdir('src/dir')
+ assert { File.stat('mnt/file').ino == File.stat('src/file').ino }
+ assert { File.stat('mnt/dir').ino == File.stat('src/dir').ino }
+end
+
+testenv("", :title => "has readdir inode numbers") do
+ touch('src/file')
+ mkdir('src/dir')
+
+ inodes = {}
+ for line in `#{$tests_dir}/readdir_inode mnt`.split("\n").reject(&:empty?)
+ inode, name = line.split(" ")
+ inodes[name] = inode.to_i
+ end
+
+ assert { inodes['file'] == File.stat('src/file').ino }
+ assert { inodes['dir'] == File.stat('src/dir').ino }
+end