aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_bindfs.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_bindfs.rb')
-rwxr-xr-xtests/test_bindfs.rb21
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