diff options
author | Martin Pärtel <martin.partel@gmail.com> | 2016-05-03 17:33:53 +0300 |
---|---|---|
committer | Martin Pärtel <martin.partel@gmail.com> | 2016-05-03 18:21:30 +0300 |
commit | 443799d22b4a6f3fc872c925a02804fb835fd73a (patch) | |
tree | 74ece66d6a38bf4a7f7ca8da3c9faf042d610fc5 /tests/test_bindfs.rb | |
parent | f4d05de7420476e6f3b20c67977e99fb55348073 (diff) | |
download | bindfs-443799d22b4a6f3fc872c925a02804fb835fd73a.tar.gz |
Basic tests for --uid-offset and --gid-offset.
Diffstat (limited to 'tests/test_bindfs.rb')
-rwxr-xr-x | tests/test_bindfs.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb index 9a4d33c..b4fd7f5 100755 --- a/tests/test_bindfs.rb +++ b/tests/test_bindfs.rb @@ -349,6 +349,39 @@ root_testenv("--map=0/1:@0/@1", :title => "--map and chown/chgrp") do assert { File.stat('mnt/file1').gid == 1 } end +root_testenv("--uid-offset=2") do + touch('src/file') + chown(1, nil, 'src/file') + + assert { File.stat('mnt/file').uid == 3 } +end + +root_testenv("--gid-offset=2") do + touch('src/file') + chown(nil, 1, 'src/file') + + assert { File.stat('mnt/file').gid == 3 } +end + +root_testenv("--uid-offset=2 --gid-offset=20", :title => "file creation with --uid-offset and --gid-offset") do + touch('mnt/file') + + assert { File.stat('mnt/file').uid == 2 } + assert { File.stat('mnt/file').gid == 20 } + assert { File.stat('src/file').uid == 0 } + assert { File.stat('src/file').gid == 0 } +end + +root_testenv("--uid-offset=2 --gid-offset=20", :title => "chown/chgrp with --uid-offset and --gid-offset") do + touch('src/file') + chown(6, 25, 'mnt/file') + + assert { File.stat('mnt/file').uid == 6 } + assert { File.stat('mnt/file').gid == 25 } + assert { File.stat('src/file').uid == 4 } + assert { File.stat('src/file').gid == 5 } +end + testenv("", :title => "preserves inode numbers") do touch('src/file') mkdir('src/dir') |