From 66e43719bdb58a94240a1e291e3d14e0c0b93826 Mon Sep 17 00:00:00 2001 From: Martin Pärtel Date: Fri, 14 Sep 2012 17:34:08 +0300 Subject: Added unit test for setgid behavior. --- tests/test_bindfs.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') 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 -- cgit v1.2.3