diff options
author | Martin Pärtel <martin.partel@gmail.com> | 2024-06-05 09:06:31 +0300 |
---|---|---|
committer | Martin Pärtel <martin.partel@gmail.com> | 2024-06-05 09:06:31 +0300 |
commit | 9bd2e4223b8050da96ee78e717a9ba2473de9a60 (patch) | |
tree | 011167bca387dd74b8f7d57996ae7de9d84fa394 /tests | |
parent | 0a26c1d7d25849bb9161d35fda6734a48bff0dea (diff) | |
download | bindfs-9bd2e4223b8050da96ee78e717a9ba2473de9a60.tar.gz |
Warn that lock forwarding does not forward flock() on FreeBSD.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_bindfs.rb | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb index 22f356f..46c6101 100755 --- a/tests/test_bindfs.rb +++ b/tests/test_bindfs.rb @@ -774,16 +774,18 @@ if $have_fuse_29 || $have_fuse_3 # (this test passes with an empty file as well, but this way is clearer) # flock - File.open('mnt/file') do |f1| - File.open('src/file') do |f2| + if `uname`.strip != 'FreeBSD' # FreeBSD's FUSE doesn't yet support forwarding flock: https://wiki.freebsd.org/action/recall/FUSEFS?action=recall&rev=58 + File.open('mnt/file') do |f1| + File.open('src/file') do |f2| + assert { f1.flock(File::LOCK_EX | File::LOCK_NB) } + assert { !f2.flock(File::LOCK_EX | File::LOCK_NB) } + assert { f1.flock(File::LOCK_UN) } + + assert { f2.flock(File::LOCK_EX | File::LOCK_NB) } + assert { !f1.flock(File::LOCK_EX | File::LOCK_NB) } + end assert { f1.flock(File::LOCK_EX | File::LOCK_NB) } - assert { !f2.flock(File::LOCK_EX | File::LOCK_NB) } - assert { f1.flock(File::LOCK_UN) } - - assert { f2.flock(File::LOCK_EX | File::LOCK_NB) } - assert { !f1.flock(File::LOCK_EX | File::LOCK_NB) } end - assert { f1.flock(File::LOCK_EX | File::LOCK_NB) } end # fcntl locking @@ -795,13 +797,15 @@ if $have_fuse_29 || $have_fuse_3 File.write('src/file', 'some contents for fcntl lockng') # flock - File.open('mnt/file') do |f1| - File.open('src/file') do |f2| - assert { f1.flock(File::LOCK_EX | File::LOCK_NB) } - assert { f2.flock(File::LOCK_EX | File::LOCK_NB) } - end - File.open('mnt/file') do |f2| - assert { !f2.flock(File::LOCK_EX | File::LOCK_NB) } + if `uname`.strip != 'FreeBSD' # FreeBSD's FUSE doesn't yet support forwarding flock: https://wiki.freebsd.org/action/recall/FUSEFS?action=recall&rev=58 + File.open('mnt/file') do |f1| + File.open('src/file') do |f2| + assert { f1.flock(File::LOCK_EX | File::LOCK_NB) } + assert { f2.flock(File::LOCK_EX | File::LOCK_NB) } + end + File.open('mnt/file') do |f2| + assert { !f2.flock(File::LOCK_EX | File::LOCK_NB) } + end end end @@ -818,7 +822,7 @@ end # have_fuse_29 # # This test is also disabled for old (FUSE < 2.9) systems. # TODO: figure out why it doesn't work. -if $have_fuse_29 || $have_fuse_3 +if ($have_fuse_29 || $have_fuse_3) && `uname`.strip != 'FreeBSD' # FreeBSD's FUSE doesn't yet support ioctl: https://wiki.freebsd.org/action/recall/FUSEFS?action=recall&rev=58 root_testenv("--enable-ioctl", :title => "append-only ioctl", :valgrind => false) do touch('mnt/file') system('chattr +a mnt/file') |