浏览代码

ignore security.selinux xattrs, fixes #1735

they fail the FUSE tests on centos7.
Thomas Waldmann 8 年之前
父节点
当前提交
ade405eae0
共有 2 个文件被更改,包括 13 次插入4 次删除
  1. 11 2
      borg/testsuite/__init__.py
  2. 2 2
      borg/testsuite/archiver.py

+ 11 - 2
borg/testsuite/__init__.py

@@ -35,6 +35,15 @@ if sys.platform.startswith('netbsd'):
 setup_logging()
 setup_logging()
 
 
 
 
+def no_selinux(x):
+    # selinux fails our FUSE tests, thus ignore selinux xattrs
+    SELINUX_KEY = 'security.selinux'
+    if isinstance(x, dict):
+        return {k: v for k, v in x.items() if k != SELINUX_KEY}
+    if isinstance(x, list):
+        return [k for k in x if k != SELINUX_KEY]
+
+
 class BaseTestCase(unittest.TestCase):
 class BaseTestCase(unittest.TestCase):
     """
     """
     """
     """
@@ -87,8 +96,8 @@ class BaseTestCase(unittest.TestCase):
             else:
             else:
                 d1.append(round(s1.st_mtime_ns, st_mtime_ns_round))
                 d1.append(round(s1.st_mtime_ns, st_mtime_ns_round))
                 d2.append(round(s2.st_mtime_ns, st_mtime_ns_round))
                 d2.append(round(s2.st_mtime_ns, st_mtime_ns_round))
-            d1.append(get_all(path1, follow_symlinks=False))
-            d2.append(get_all(path2, follow_symlinks=False))
+            d1.append(no_selinux(get_all(path1, follow_symlinks=False)))
+            d2.append(no_selinux(get_all(path2, follow_symlinks=False)))
             self.assert_equal(d1, d2)
             self.assert_equal(d1, d2)
         for sub_diff in diff.subdirs.values():
         for sub_diff in diff.subdirs.values():
             self._assert_dirs_equal_cmp(sub_diff)
             self._assert_dirs_equal_cmp(sub_diff)

+ 2 - 2
borg/testsuite/archiver.py

@@ -26,7 +26,7 @@ from ..key import RepoKey, KeyfileKey, Passphrase
 from ..keymanager import RepoIdMismatch, NotABorgKeyFile
 from ..keymanager import RepoIdMismatch, NotABorgKeyFile
 from ..remote import RemoteRepository, PathNotAllowed
 from ..remote import RemoteRepository, PathNotAllowed
 from ..repository import Repository
 from ..repository import Repository
-from . import BaseTestCase, changedir, environment_variable
+from . import BaseTestCase, changedir, environment_variable, no_selinux
 
 
 try:
 try:
     import llfuse
     import llfuse
@@ -1067,7 +1067,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
             in_fn = 'input/fusexattr'
             in_fn = 'input/fusexattr'
             out_fn = os.path.join(mountpoint, 'input', 'fusexattr')
             out_fn = os.path.join(mountpoint, 'input', 'fusexattr')
             if not xattr.XATTR_FAKEROOT and xattr.is_enabled(self.input_path):
             if not xattr.XATTR_FAKEROOT and xattr.is_enabled(self.input_path):
-                assert xattr.listxattr(out_fn) == ['user.foo', ]
+                assert no_selinux(xattr.listxattr(out_fn)) == ['user.foo', ]
                 assert xattr.getxattr(out_fn, 'user.foo') == b'bar'
                 assert xattr.getxattr(out_fn, 'user.foo') == b'bar'
             else:
             else:
                 assert xattr.listxattr(out_fn) == []
                 assert xattr.listxattr(out_fn) == []