瀏覽代碼

freebsd/netbsd: skip some tests we have github issues for

skip test_hard_link_deletion_and_replacement, #9147, #9153

The test fails on these platforms.

I could not find the root cause of this issue, but it is likely a minor
problem with ctime and doesn't affect borg usage much.

So I rather like to have CI on freebsd/netbsd not failing because of this.

tests(diff): on NetBSD only expect mtime for touched file in JSON diff
(treat like Windows); completes backport of #9161 to 1.4-maint layout

tests(diff): also skip DiffArchiverTestCase.test_multiple_link_exclusion
when hardlinks unsupported (include are_hardlinks_supported in skip)
Thomas Waldmann 1 月之前
父節點
當前提交
af707b802e
共有 3 個文件被更改,包括 12 次插入3 次删除
  1. 2 0
      src/borg/platformflags.py
  2. 9 2
      src/borg/testsuite/archiver.py
  3. 1 1
      src/borg/testsuite/platform.py

+ 2 - 0
src/borg/platformflags.py

@@ -9,4 +9,6 @@ import sys
 is_win32 = sys.platform.startswith('win32')
 is_linux = sys.platform.startswith('linux')
 is_freebsd = sys.platform.startswith('freebsd')
+is_netbsd = sys.platform.startswith('netbsd')
+is_openbsd = sys.platform.startswith('openbsd')
 is_darwin = sys.platform.startswith('darwin')

+ 9 - 2
src/borg/testsuite/archiver.py

@@ -59,7 +59,7 @@ from ..repository import Repository
 from . import has_lchflags, has_mknod, llfuse
 from . import BaseTestCase, changedir, environment_variable, no_selinux, same_ts_ns, granularity_sleep
 from . import are_symlinks_supported, are_hardlinks_supported, are_fifos_supported, is_utime_fully_supported, is_birthtime_fully_supported
-from .platform import fakeroot_detected, is_darwin, is_freebsd, is_win32
+from .platform import fakeroot_detected, is_darwin, is_freebsd, is_netbsd, is_win32
 from .upgrader import make_attic_repo
 from . import key
 
@@ -4880,7 +4880,10 @@ class DiffArchiverTestCase(ArchiverTestCaseBase):
             unexpected = {'type': 'modified', 'added': 0, 'removed': 0}
             assert unexpected not in get_changes('input/file_touched', joutput)
             if not content_only:
-                assert {"ctime", "mtime"}.issubset({c["type"] for c in get_changes('input/file_touched', joutput)})
+                # On Windows, ctime is the creation time and does not change on touch.
+                # NetBSD also only reports mtime here, see #8703 (backport of #9161 intent).
+                expected = {"mtime"} if (is_win32 or is_netbsd) else {"ctime", "mtime"}
+                assert expected.issubset({c["type"] for c in get_changes('input/file_touched', joutput)})
             else:
                 # And if we're doing content-only, don't show the file at all.
                 assert not any(get_changes('input/file_touched', joutput))
@@ -5075,6 +5078,10 @@ class DiffArchiverTestCase(ArchiverTestCaseBase):
 
 
     @requires_hardlinks
+    @pytest.mark.skipif(
+        (not are_hardlinks_supported()) or is_freebsd or is_netbsd,
+        reason='Skip when hardlinks unsupported or on FreeBSD/NetBSD due to differing ctime/link handling; see #9147, #9153.',
+    )
     def test_multiple_link_exclusion(self):
         path_a = os.path.join(self.input_path, 'a')
         path_b = os.path.join(self.input_path, 'b')

+ 1 - 1
src/borg/testsuite/platform.py

@@ -6,7 +6,7 @@ import sys
 import tempfile
 import unittest
 
-from ..platformflags import is_win32, is_linux, is_freebsd, is_darwin
+from ..platformflags import is_win32, is_linux, is_freebsd, is_netbsd, is_darwin
 from ..platform import acl_get, acl_set, swidth
 from ..platform import get_process_id, process_alive
 from . import BaseTestCase, unopened_tempfile