aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2023-07-15 12:39:37 +0300
committerMartin Pärtel <martin.partel@gmail.com>2023-07-15 12:39:37 +0300
commit9b1057f2e57cf0b304d94fe422e126bbc7f6d24b (patch)
treeefdfcdda5704172cb910517b702043827ddb099e
parent290be5c929f8dd1d65d0a3dbaaab8c1870b54196 (diff)
downloadbindfs-9b1057f2e57cf0b304d94fe422e126bbc7f6d24b.tar.gz
Unit test for socket files.
-rwxr-xr-xtests/test_bindfs.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_bindfs.rb b/tests/test_bindfs.rb
index 3243b7f..ed3da29 100755
--- a/tests/test_bindfs.rb
+++ b/tests/test_bindfs.rb
@@ -922,6 +922,20 @@ testenv("-ouser -onofail,nouser,,,delete-deny -o users -o auto,rename-deny,noaut
assert_exception(EPERM) { chmod(0777, 'mnt/file') }
end
+# Issue #132 / PR #133
+if `which nc 2> /dev/null`.strip != ''
+ testenv("", :title => "socket files") do
+ IO.popen("nc -U mnt/sock -l", "r") do |pipe|
+ sleep 0.1 until File.exists?('mnt/sock')
+ system("echo hello | nc -U -q 0 mnt/sock")
+ result = pipe.read
+ assert { result.strip == "hello" }
+ end
+ end
+else
+ puts "Skipping socket file test because 'nc' is not installed."
+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.
# TODO: support FreeBSD in this test (different group management commands)