From 92d31be087a654b81a6a74416b8887398882648f Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 26 Oct 2015 23:16:41 +0100 Subject: [PATCH] atime unit test: test adapts to O_NOATIME support on platform --- borg/testsuite/archiver.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/borg/testsuite/archiver.py b/borg/testsuite/archiver.py index 4d5f96146..a8a1c8df5 100644 --- a/borg/testsuite/archiver.py +++ b/borg/testsuite/archiver.py @@ -297,10 +297,11 @@ def test_atime(self): sti = os.stat('input/file1') sto = os.stat('output/input/file1') assert st_mtime_ns(sti) == st_mtime_ns(sto) == mtime * 1e9 - # to support testing on platforms without O_NOATIME open mode, we just - # compare the restored file with the original atime (not with the - # atime it has now). - assert st_atime_ns(sto) == atime * 1e9 + if hasattr(os, 'O_NOATIME'): + assert st_atime_ns(sti) == st_atime_ns(sto) == atime * 1e9 + else: + # it touched the input file's atime while backing it up + assert st_atime_ns(sto) == atime * 1e9 def _extract_repository_id(self, path): return Repository(self.repository_path).id