diff options
author | Martin Pärtel <martin.partel@gmail.com> | 2012-01-25 05:48:42 +0200 |
---|---|---|
committer | Martin Pärtel <martin.partel@gmail.com> | 2012-01-25 05:48:42 +0200 |
commit | 8ae697b6d483e5211f86de770c7000b5cedec7e6 (patch) | |
tree | facf67ce8f9c061cb1d7b07ec71c55b51f7dd94c /tests | |
parent | 473faadb80c962ce629f88f640b587ea965e5343 (diff) | |
download | bindfs-8ae697b6d483e5211f86de770c7000b5cedec7e6.tar.gz |
Added option --realistic-permissions.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/common.rb | 16 | ||||
-rwxr-xr-x | tests/test_bindfs.rb | 19 |
2 files changed, 27 insertions, 8 deletions
diff --git a/tests/common.rb b/tests/common.rb index b7ce79f..dc77ddf 100755 --- a/tests/common.rb +++ b/tests/common.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # -# Copyright 2006,2007,2008,2009,2010 Martin Pärtel <martin.partel@gmail.com> +# Copyright 2006,2007,2008,2009,2010,2012 Martin Pärtel <martin.partel@gmail.com> # # This file is part of bindfs. # @@ -31,15 +31,17 @@ TESTDIR_NAME = 'tmp_test_bindfs' $only_these_tests = nil # Prepares a test environment with a mounted directory -def testenv(bindfs_args, &block) +def testenv(bindfs_args, options = {}, &block) + options = { + :title => bindfs_args + }.merge(options) + # todo: less repetitive and more careful error handling and cleanup - testcase_title = bindfs_args + return unless $only_these_tests == nil or $only_these_tests.member? options[:title] - return unless $only_these_tests == nil or $only_these_tests.member? testcase_title - - puts "--- #{testcase_title} ---" + puts "--- #{options[:title]} ---" puts "[ #{bindfs_args} ]" begin @@ -94,7 +96,7 @@ def testenv(bindfs_args, &block) begin yield rescue Exception => ex - $stderr.puts "ERROR: testcase `#{testcase_title}' failed" + $stderr.puts "ERROR: testcase `#{options[:title]}' failed" $stderr.puts ex $stderr.puts ex.backtrace testcase_ok = false diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb index ea2e7e2..f184880 100755 --- a/tests/test_bindfs.rb +++ b/tests/test_bindfs.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # -# Copyright 2006,2007,2008,2009,2010 Martin Pärtel <martin.partel@gmail.com> +# Copyright 2006,2007,2008,2009,2010,2012 Martin Pärtel <martin.partel@gmail.com> # # This file is part of bindfs. # @@ -80,6 +80,23 @@ testenv("--create-with-perms=og=r:ogd+x") do assert { File.stat('mnt/dir').mode & 0077 == 0055 } end +testenv("-p 0777 --realistic-permissions", :title => '--realistic-permissions') do + touch('src/noexecfile') + touch('src/execfile') + chmod(0600, 'src/noexecfile') + chmod(0700, 'src/execfile') + + assert { File.stat('mnt/noexecfile').mode & 0777 == 0666 } + assert { File.stat('mnt/execfile').mode & 0777 == 0777 } +end + +testenv("-p 0777", :title => '--realistic-permissions not the default') do + touch('src/noexecfile') + chmod(0600, 'src/noexecfile') + + assert { File.stat('mnt/noexecfile').mode & 0777 == 0777 } +end + testenv("--ctime-from-mtime") do sf = 'src/file' mf = 'mnt/file' |