aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/common.rb2
-rwxr-xr-xtests/test_bindfs.rb22
2 files changed, 23 insertions, 1 deletions
diff --git a/tests/common.rb b/tests/common.rb
index ac1ef43..7174257 100755
--- a/tests/common.rb
+++ b/tests/common.rb
@@ -18,7 +18,7 @@
# along with bindfs. If not, see <http://www.gnu.org/licenses/>.
#
-require 'fileutils.rb'
+require 'fileutils'
include FileUtils
# Set the default umask for all tests
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb
index ff1ee24..1f78250 100755
--- a/tests/test_bindfs.rb
+++ b/tests/test_bindfs.rb
@@ -74,6 +74,28 @@ testenv("-u nobody -m #{Process.uid} -p 0600,u+D") do
assert { File.stat('mnt/file').uid == Process.uid }
end
+root_testenv("", :title => "--create-as-user should be default for root") do
+ chmod(0777, 'src')
+ `su -c 'touch mnt/file' nobody`
+ `su -c 'mkdir mnt/dir' nobody`
+ `su -c 'ln -sf /tmp/foo mnt/lnk' nobody`
+
+ assert { File.stat('mnt/file').uid == nobody_uid }
+ assert { File.stat('mnt/file').gid == nogroup_gid }
+ assert { File.stat('src/file').uid == nobody_uid }
+ assert { File.stat('src/file').gid == nogroup_gid }
+
+ assert { File.stat('mnt/dir').uid == nobody_uid }
+ assert { File.stat('mnt/dir').gid == nogroup_gid }
+ assert { File.stat('src/dir').uid == nobody_uid }
+ assert { File.stat('src/dir').gid == nogroup_gid }
+
+ assert { File.lstat('mnt/lnk').uid == nobody_uid }
+ assert { File.lstat('mnt/lnk').gid == nogroup_gid }
+ assert { File.lstat('src/lnk').uid == nobody_uid }
+ assert { File.lstat('src/lnk').gid == nogroup_gid }
+end
+
testenv("--create-with-perms=og=r:ogd+x") do
touch('src/file')
mkdir('src/dir')