diff options
author | Alan Somers <asomers@gmail.com> | 2019-05-15 14:35:57 -0600 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2019-05-15 21:35:57 +0100 |
commit | 1f842c996e46788115d6b5ca142fad949712c8e9 (patch) | |
tree | 2a070544cd76fad641913c2b9a489712fc99e012 /test/test_examples.py | |
parent | 7a5e1a9a9a61416c759ce02a48e600814fd13711 (diff) | |
download | libfuse-1f842c996e46788115d6b5ca142fad949712c8e9.tar.gz |
passthrough: fix unix-domain sockets on FreeBSD (#413)
FreeBSD doesn't allow creating sockets using mknod(2). Instead, one has to use socket(2)
and bind(2). Add appropriate logic to the examples and add a test case.
Diffstat (limited to 'test/test_examples.py')
-rwxr-xr-x | test/test_examples.py | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/test/test_examples.py b/test/test_examples.py index 3aabd19..d0da69d 100755 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -8,10 +8,12 @@ if __name__ == '__main__': import subprocess import os import sys +import py import pytest import stat import shutil import filecmp +import tempfile import time import errno import sys @@ -56,6 +58,20 @@ def invoke_mount_fuse_drop_privileges(mnt_dir, name, options): return invoke_mount_fuse(mnt_dir, name, options + ('drop_privileges',)) +class raii_tmpdir: + def __init__(self): + self.d = tempfile.mkdtemp() + + def __str__(self): + return str(self.d) + + def mkdir(self, path): + return py.path.local(str(self.d)).mkdir(path) + +@pytest.fixture +def short_tmpdir(): + return raii_tmpdir() + @pytest.mark.parametrize("cmdline_builder", (invoke_directly, invoke_mount_fuse, invoke_mount_fuse_drop_privileges)) @pytest.mark.parametrize("options", powerset(options)) @@ -84,8 +100,7 @@ def test_hello(tmpdir, name, options, cmdline_builder): @pytest.mark.parametrize("writeback", (False, True)) @pytest.mark.parametrize("name", ('passthrough', 'passthrough_fh', 'passthrough_ll')) @pytest.mark.parametrize("debug", (False, True)) -def test_passthrough(tmpdir, name, debug, capfd, writeback): - +def test_passthrough(short_tmpdir, name, debug, capfd, writeback): # Avoid false positives from libfuse debug messages if debug: capfd.register_output(r'^ unique: [0-9]+, error: -[0-9]+ .+$', @@ -95,8 +110,8 @@ def test_passthrough(tmpdir, name, debug, capfd, writeback): capfd.register_output(r"^ \d\d \[[^\]]+ message: 'No error: 0'\]", count=0) - mnt_dir = str(tmpdir.mkdir('mnt')) - src_dir = str(tmpdir.mkdir('src')) + mnt_dir = str(short_tmpdir.mkdir('mnt')) + src_dir = str(short_tmpdir.mkdir('src')) cmdline = base_cmdline + \ [ pjoin(basename, 'example', name), @@ -145,7 +160,7 @@ def test_passthrough(tmpdir, name, debug, capfd, writeback): # When writeback caching is enabled, kernel has to open files for # reading even when userspace opens with O_WDONLY. This fails if the # filesystem process doesn't have special permission. - syscall_test_cmd.append('-52') + syscall_test_cmd.append('-53') subprocess.check_call(syscall_test_cmd) except: cleanup(mount_process, mnt_dir) @@ -154,9 +169,9 @@ def test_passthrough(tmpdir, name, debug, capfd, writeback): umount(mount_process, mnt_dir) @pytest.mark.parametrize("cache", (False, True)) -def test_passthrough_hp(tmpdir, cache): - mnt_dir = str(tmpdir.mkdir('mnt')) - src_dir = str(tmpdir.mkdir('src')) +def test_passthrough_hp(short_tmpdir, cache): + mnt_dir = str(short_tmpdir.mkdir('mnt')) + src_dir = str(short_tmpdir.mkdir('src')) cmdline = base_cmdline + \ [ pjoin(basename, 'example', 'passthrough_hp'), |