From 02ecf047801e515c6ba57f8f1560cf6d354aa379 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 24 Oct 2016 01:19:36 +0200 Subject: [PATCH] fuse tests: catch ENOTSUP on freebsd seems like fuse does not support xattrs there at all. --- borg/testsuite/archiver.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/borg/testsuite/archiver.py b/borg/testsuite/archiver.py index 3a1478563..3cd317b72 100644 --- a/borg/testsuite/archiver.py +++ b/borg/testsuite/archiver.py @@ -1089,19 +1089,26 @@ class ArchiverTestCase(ArchiverTestCaseBase): sto = os.stat(out_fn) assert stat.S_ISFIFO(sto.st_mode) # list/read xattrs - in_fn = 'input/fusexattr' - out_fn = os.path.join(mountpoint, 'input', 'fusexattr') - if not xattr.XATTR_FAKEROOT and xattr.is_enabled(self.input_path): - assert no_selinux(xattr.listxattr(out_fn)) == ['user.foo', ] - assert xattr.getxattr(out_fn, 'user.foo') == b'bar' - else: - assert xattr.listxattr(out_fn) == [] - try: - xattr.getxattr(out_fn, 'user.foo') - except OSError as e: - assert e.errno == llfuse.ENOATTR + try: + in_fn = 'input/fusexattr' + out_fn = os.path.join(mountpoint, 'input', 'fusexattr') + if not xattr.XATTR_FAKEROOT and xattr.is_enabled(self.input_path): + assert no_selinux(xattr.listxattr(out_fn)) == ['user.foo', ] + assert xattr.getxattr(out_fn, 'user.foo') == b'bar' 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') def test_fuse_allow_damaged_files(self):