| 
					
				 | 
			
			
				@@ -17,7 +17,7 @@ from hashlib import sha256 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import pytest 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from .. import xattr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-from ..archive import Archive, ChunkBuffer, CHUNK_MAX_EXP 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+from ..archive import Archive, ChunkBuffer, CHUNK_MAX_EXP, flags_noatime, flags_normal 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from ..archiver import Archiver 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from ..cache import Cache 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from ..crypto import bytes_to_long, num_aes_blocks 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -363,8 +363,20 @@ class ArchiverTestCase(ArchiverTestCaseBase): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self.assert_equal(filter(info_output), filter(info_output2)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     def test_atime(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.create_test_files() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         atime, mtime = 123456780, 234567890 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        have_noatime = has_noatime('input/file1') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         os.utime('input/file1', (atime, mtime)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self.cmd('init', self.repository_location) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self.cmd('create', self.repository_location + '::test', 'input') 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -373,7 +385,7 @@ class ArchiverTestCase(ArchiverTestCaseBase): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sti = os.stat('input/file1') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sto = os.stat('output/input/file1') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         assert sti.st_mtime_ns == sto.st_mtime_ns == mtime * 1e9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if hasattr(os, 'O_NOATIME'): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if have_noatime: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             assert sti.st_atime_ns == sto.st_atime_ns == atime * 1e9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             # it touched the input file's atime while backing it up 
			 |