From 9bcae813af89d445a4d269e83c371847075f1008 Mon Sep 17 00:00:00 2001 From: Martin Pärtel Date: Mon, 26 Mar 2012 19:27:18 +0300 Subject: Made --map affect chown/chgrp results. --- tests/common.rb | 4 ++-- tests/test_bindfs.rb | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/common.rb b/tests/common.rb index d030972..ac1ef43 100755 --- a/tests/common.rb +++ b/tests/common.rb @@ -142,9 +142,9 @@ def testenv(bindfs_args, options = {}, &block) end # Like testenv but skips the test if not running as root -def root_testenv(bindfs_args, &block) +def root_testenv(bindfs_args, options = {}, &block) if Process.uid == 0 - testenv(bindfs_args, &block) + testenv(bindfs_args, options, &block) else puts "--- #{bindfs_args} ---" puts "[ #{bindfs_args} ]" diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb index 30899ed..ef732ff 100755 --- a/tests/test_bindfs.rb +++ b/tests/test_bindfs.rb @@ -293,3 +293,17 @@ root_testenv("-u 1 --map=1/2:3/4") do assert { File.stat('mnt/file1').uid == 1 } assert { File.stat('mnt/file2').uid == 1 } end + +root_testenv("--map=0/1:@0/@1", :title => "--map and chown/chgrp") do + touch('src/file1') + chown(2, 2, 'src/file1') + assert { File.stat('mnt/file1').uid == 2 } + assert { File.stat('mnt/file1').gid == 2 } + + chown(1, 1, 'mnt/file1') + + assert { File.stat('src/file1').uid == 0 } + assert { File.stat('src/file1').gid == 0 } + assert { File.stat('mnt/file1').uid == 1 } + assert { File.stat('mnt/file1').gid == 1 } +end -- cgit v1.2.3