Repository: borgbackup/borg

Issue:
OS X: fuse test failure
```
# osxfuse 3.3.3 and 3.4.1
# borg 1.0-maint commit e5a3229fd24f75d60238cad4ea5f93f469d4da5d
#
(borg-env) This-MacBook-Pro:borg vagrant$ py.test -k fuse
___________________________________________________ ArchiverTestCase.test_fuse ____________________________________________________

self = <borg.testsuite.archiver.ArchiverTestCase testMethod=test_fuse>

    @unittest.skipUnless(has_llfuse, 'llfuse not installed')
    def test_fuse(self):
        self.cmd('init', self.repository_location)
        self.create_test_files()
        self.cmd('create', self.repository_location + '::archive', 'input')
        self.cmd('create', self.repository_location + '::archive2', 'input')
        mountpoint = os.path.join(self.tmpdir, 'mountpoint')
        # mount the whole repository, archive contents shall show up in archivename subdirs of mountpoint:
        with self.fuse_mount(self.repository_location, mountpoint):
>           self.assert_dirs_equal(self.input_path, os.path.join(mountpoint, 'archive', 'input'))

borg/testsuite/archiver.py:1008: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
borg/testsuite/__init__.py:56: in assert_dirs_equal
    self._assert_dirs_equal_cmp(diff)
borg/testsuite/__init__.py:59: in _assert_dirs_equal_cmp
    self.assert_equal(diff.left_only, [])
E   AssertionError: Lists differ: ['flagfile'] != []
E   
E   First list contains 1 additional elements.
E   First extra element 0:
E   'flagfile'
E   
E   - ['flagfile']
E   + []
```



Discussion:

Resolving patch:
diff --git a/borg/testsuite/archiver.py b/borg/testsuite/archiver.py
--- a/borg/testsuite/archiver.py
+++ b/borg/testsuite/archiver.py
@@ -998,10 +998,25 @@ def test_help(self):
 
     @unittest.skipUnless(has_llfuse, 'llfuse not installed')
     def test_fuse(self):
+        def has_noatime(some_file):
+            atime_before = os.stat(some_file).st_atime_ns
+            try:
+                os.close(os.open(some_file, flags_noatime))
+            except PermissionError:
+                return False
+            else:
+                atime_after = os.stat(some_file).st_atime_ns
+                noatime_used = flags_noatime != flags_normal
+                return noatime_used and atime_before == atime_after
+
         self.cmd('init', self.repository_location)
         self.create_test_files()
+        have_noatime = has_noatime('input/file1')
         self.cmd('create', self.repository_location + '::archive', 'input')
         self.cmd('create', self.repository_location + '::archive2', 'input')
+        if has_lchflags:
+            # remove the file we did not backup, so input and mount become equal
+            os.remove(os.path.join('input', 'flagfile'))
         mountpoint = os.path.join(self.tmpdir, 'mountpoint')
         # mount the whole repository, archive contents shall show up in archivename subdirs of mountpoint:
         with self.fuse_mount(self.repository_location, mountpoint):
@@ -1020,7 +1035,8 @@ def test_fuse(self):
             assert sti1.st_uid == sto1.st_uid
             assert sti1.st_gid == sto1.st_gid
             assert sti1.st_size == sto1.st_size
-            assert sti1.st_atime == sto1.st_atime
+            if have_noatime:
+                assert sti1.st_atime == sto1.st_atime
             assert sti1.st_ctime == sto1.st_ctime
             assert sti1.st_mtime == sto1.st_mtime
             # note: there is another hardlink to this, see below


Test patch: