fuse tests: catch ENOTSUP on freebsd

seems like fuse does not support xattrs there at all.
This commit is contained in:
Thomas Waldmann 2016-10-24 01:19:36 +02:00
parent ede3b4a354
commit 02ecf04780
1 changed files with 19 additions and 12 deletions

View File

@ -1089,19 +1089,26 @@ class ArchiverTestCase(ArchiverTestCaseBase):
sto = os.stat(out_fn) sto = os.stat(out_fn)
assert stat.S_ISFIFO(sto.st_mode) assert stat.S_ISFIFO(sto.st_mode)
# list/read xattrs # list/read xattrs
in_fn = 'input/fusexattr' try:
out_fn = os.path.join(mountpoint, 'input', 'fusexattr') in_fn = 'input/fusexattr'
if not xattr.XATTR_FAKEROOT and xattr.is_enabled(self.input_path): out_fn = os.path.join(mountpoint, 'input', 'fusexattr')
assert no_selinux(xattr.listxattr(out_fn)) == ['user.foo', ] if not xattr.XATTR_FAKEROOT and xattr.is_enabled(self.input_path):
assert xattr.getxattr(out_fn, 'user.foo') == b'bar' assert no_selinux(xattr.listxattr(out_fn)) == ['user.foo', ]
else: assert xattr.getxattr(out_fn, 'user.foo') == b'bar'
assert xattr.listxattr(out_fn) == []
try:
xattr.getxattr(out_fn, 'user.foo')
except OSError as e:
assert e.errno == llfuse.ENOATTR
else: else:
assert False, "expected OSError(ENOATTR), but no error was raised" assert xattr.listxattr(out_fn) == []
try:
xattr.getxattr(out_fn, 'user.foo')
except OSError as e:
assert e.errno == llfuse.ENOATTR
else:
assert False, "expected OSError(ENOATTR), but no error was raised"
except OSError as err:
if sys.platform.startswith(('freebsd', )) and err.errno == errno.ENOTSUP:
# some systems have no xattr support on FUSE
pass
else:
raise
@unittest.skipUnless(has_llfuse, 'llfuse not installed') @unittest.skipUnless(has_llfuse, 'llfuse not installed')
def test_fuse_allow_damaged_files(self): def test_fuse_allow_damaged_files(self):