aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2012-09-14 17:34:08 +0300
committerMartin Pärtel <martin.partel@gmail.com>2012-09-14 17:34:08 +0300
commit66e43719bdb58a94240a1e291e3d14e0c0b93826 (patch)
tree90f733070df916bebb4a6a9e4eb3ff59e2ed4f0b /tests
parent63f687ed8efbbf0cce478e8b397d2b81fe0d90e6 (diff)
downloadbindfs-66e43719bdb58a94240a1e291e3d14e0c0b93826.tar.gz
Added unit test for setgid behavior.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_bindfs.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb
index 670be19..a78345b 100755
--- a/tests/test_bindfs.rb
+++ b/tests/test_bindfs.rb
@@ -350,6 +350,19 @@ testenv("", :title => "has readdir inode numbers") do
assert { inodes['dir'] == File.stat('src/dir').ino }
end
+root_testenv("", :title => "setgid directories") do
+ mkdir('mnt/dir')
+ chmod("g+s", 'mnt/dir')
+ chown(nil, $nogroup_gid, 'mnt/dir')
+
+ touch('mnt/dir/file')
+
+ assert { File.stat('src/dir').mode & 07000 == 02000 }
+ assert { File.stat('src/dir/file').gid == $nogroup_gid }
+ assert { File.stat('mnt/dir').mode & 07000 == 02000 }
+ assert { File.stat('mnt/dir/file').gid == $nogroup_gid }
+end
+
# FIXME: this stuff around testenv is a hax, and testenv may also exit(), which defeats the 'ensure' below.
# the test setup ought to be refactored. It might well use MiniTest or something.
if Process.uid == 0