diff options
author | Martin Pärtel <martin.partel@gmail.com> | 2016-03-30 21:45:38 +0100 |
---|---|---|
committer | Martin Pärtel <martin.partel@gmail.com> | 2016-03-30 21:45:38 +0100 |
commit | 26a30c6d09e4972355a9d369a2fcf70df4e7a6ce (patch) | |
tree | fbd6ca143d40547ed76288a8f74e373575d43e9d /tests | |
parent | 8e1732726b2b803f1cea87c2ae8f553ab451e8fe (diff) | |
download | bindfs-26a30c6d09e4972355a9d369a2fcf70df4e7a6ce.tar.gz |
Added test case for issue #30 and improved an earlier test case.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/common.rb | 9 | ||||
-rwxr-xr-x | tests/test_bindfs.rb | 20 |
2 files changed, 25 insertions, 4 deletions
diff --git a/tests/common.rb b/tests/common.rb index 5701123..518aab2 100755 --- a/tests/common.rb +++ b/tests/common.rb @@ -66,6 +66,15 @@ def wait_for(options = {}, &condition) true end +def with_umask(umask, &block) + old_umask = File.umask(umask) + begin + block.call + ensure + File.umask(old_umask) + end +end + def valgrind_options opt = ARGV.find {|s| s.start_with?('--valgrind') } if opt == nil diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb index 1711559..9a4d33c 100755 --- a/tests/test_bindfs.rb +++ b/tests/test_bindfs.rb @@ -95,11 +95,23 @@ root_testenv("", :title => "--create-as-user should be default for root") do end testenv("--create-with-perms=og=r:ogd+x") do - touch('src/file') - mkdir('src/dir') + with_umask(0077) do + touch('mnt/file') + mkdir('mnt/dir') + end + + assert { File.stat('mnt/file').mode & 0777 == 0644 } + assert { File.stat('mnt/dir').mode & 0777 == 0755 } +end + +testenv("--create-with-perms=g+rD") do + with_umask(0077) do + touch('mnt/file') + mkdir('mnt/dir') + end - assert { File.stat('mnt/file').mode & 0077 == 0044 } - assert { File.stat('mnt/dir').mode & 0077 == 0055 } + assert { File.stat('src/file').mode & 0777 == 0640 } + assert { File.stat('src/dir').mode & 0777 == 0750 } end testenv("-p 0777 --realistic-permissions", :title => '--realistic-permissions') do |