diff options
author | Martin Pärtel <martin.partel@gmail.com> | 2016-07-31 18:15:08 +0100 |
---|---|---|
committer | Martin Pärtel <martin.partel@gmail.com> | 2016-07-31 18:15:08 +0100 |
commit | f2803095dab51c1000bae8c4d7e40a4d16f0c382 (patch) | |
tree | a399460905043d8e6def02e248261bcbe4b2a330 /tests/test_bindfs.rb | |
parent | 3fda402c006f63e68e1a72f26f4c3ff3040289af (diff) | |
download | bindfs-f2803095dab51c1000bae8c4d7e40a4d16f0c382.tar.gz |
Added option --enable-ioctl to forward ioctl() calls.
This should address #37.
Diffstat (limited to 'tests/test_bindfs.rb')
-rwxr-xr-x | tests/test_bindfs.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb index b4fd7f5..04c853d 100755 --- a/tests/test_bindfs.rb +++ b/tests/test_bindfs.rb @@ -616,6 +616,27 @@ testenv("", :title => "many files in a directory") do assert { Dir.entries('mnt/dir').sort == expected_entries.sort } end +# Issue #37 +root_testenv("--enable-ioctl", :title => "append-only ioctl") do + touch('mnt/file') + system('chattr +a mnt/file') + raise 'chattr +a failed' unless $?.success? + begin + File.open('mnt/file', 'a') do |f| + f.write('stuff') + end + assert { File.read('mnt/file') == 'stuff' } + assert_exception(EPERM) { File.write('mnt/file', 'newstuff') } + ensure + system('chattr -a mnt/file') + end +end + +root_testenv("", :title => "ioctl not enabled by default") do + touch('mnt/file') + assert { `chattr +a mnt/file 2>&1`; !$?.success? } +end + # FIXME: this stuff around testenv is a hax, and testenv may also exit(), which defeats the 'ensure' below. # the test setup ought to be refactored. It might well use MiniTest or something. if Process.uid == 0 |