From 50d9158141bede9a0f209ea11ec807880dacfec9 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Fri, 11 Aug 2017 10:53:56 +0200 Subject: Don't attempt to run fusermount3 under BSD. --- test/util.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/util.py b/test/util.py index 31c29a8..1cd09a1 100644 --- a/test/util.py +++ b/test/util.py @@ -5,6 +5,7 @@ import os import stat import time from os.path import join as pjoin +import sys basename = pjoin(os.path.dirname(__file__), '..') @@ -23,21 +24,28 @@ def wait_for_mount(mount_process, mnt_dir, def cleanup(mnt_dir): # Don't bother trying Valgrind if things already went wrong - subprocess.call([pjoin(basename, 'util', 'fusermount3'), - '-z', '-u', mnt_dir], - stdout=subprocess.DEVNULL, + if 'bsd' in sys.platform: + cmd = [ 'umount', '-f', mnt_dir ] + else: + cmd = [pjoin(basename, 'util', 'fusermount3'), + '-z', '-u', mnt_dir] + subprocess.call(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) def umount(mount_process, mnt_dir): - # fusermount3 will be setuid root, so we can only trace it with - # valgrind if we're root - if os.getuid() == 0: - cmdline = base_cmdline + + if 'bsd' in sys.platform: + cmdline = [ 'umount', mnt_dir ] else: - cmdline = [] + # fusermount3 will be setuid root, so we can only trace it with + # valgrind if we're root + if os.getuid() == 0: + cmdline = base_cmdline + else: + cmdline = [] + cmdline = cmdline + [ pjoin(basename, 'util', 'fusermount3'), + '-z', '-u', mnt_dir ] - cmdline = cmdline + [ pjoin(basename, 'util', 'fusermount3'), - '-z', '-u', mnt_dir ] subprocess.check_call(cmdline) assert not os.path.ismount(mnt_dir) @@ -79,6 +87,9 @@ def fuse_test_marker(): skip = lambda x: pytest.mark.skip(reason=x) + if 'bsd' in sys.platform: + return pytest.mark.uses_fuse() + with subprocess.Popen(['which', 'fusermount3'], stdout=subprocess.PIPE, universal_newlines=True) as which: fusermount_path = which.communicate()[0].strip() -- cgit v1.2.3