Skip to content

Commit 276c5f3

Browse files
Merge pull request #7473 from Michael-Girma/forward_port/pr-7471
Resolved mode bug and added sleep clause for darwin systems. Fixes #7470
2 parents 7cc9d32 + 6e83103 commit 276c5f3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/borg/testsuite/archiver/diff_cmd.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from ...constants import * # NOQA
88
from .. import are_symlinks_supported, are_hardlinks_supported
9-
from ..platform import is_win32
9+
from ..platform import is_win32, is_darwin
1010
from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES
1111

1212

@@ -247,12 +247,16 @@ def test_time_diffs(self):
247247
if is_win32:
248248
# Sleeping for 15s because Windows doesn't refresh ctime if file is deleted and recreated within 15 seconds.
249249
time.sleep(15)
250+
elif is_darwin:
251+
time.sleep(1) # HFS has a 1s timestamp granularity
250252
self.create_regular_file("test_file", size=15)
251253
self.cmd(f"--repo={self.repository_location}", "create", "archive2", "input")
252254
output = self.cmd(f"--repo={self.repository_location}", "diff", "archive1", "archive2")
253255
self.assert_in("mtime", output)
254256
self.assert_in("ctime", output) # Should show up on windows as well since it is a new file.
255-
os.chmod("input/test_file", 777)
257+
if is_darwin:
258+
time.sleep(1) # HFS has a 1s timestamp granularity
259+
os.chmod("input/test_file", 0o777)
256260
self.cmd(f"--repo={self.repository_location}", "create", "archive3", "input")
257261
output = self.cmd(f"--repo={self.repository_location}", "diff", "archive2", "archive3")
258262
self.assert_not_in("mtime", output)

0 commit comments

Comments
 (0)