mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-04 10:39:50 +00:00
more directory timestamp tests
This commit is contained in:
parent
2291ab755d
commit
b472768b57
1 changed files with 41 additions and 1 deletions
|
@ -508,9 +508,11 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|||
assert os.readlink('input/link1') == 'somewhere'
|
||||
|
||||
@pytest.mark.skipif(not is_utime_fully_supported(), reason='cannot properly setup and execute test without utime')
|
||||
def test_directory_timestamps(self):
|
||||
def test_directory_timestamps1(self):
|
||||
self.create_test_files()
|
||||
self.cmd('init', '--encryption=repokey', self.repository_location)
|
||||
|
||||
# default file archiving order (internal recursion)
|
||||
self.cmd('create', self.repository_location + '::test', 'input')
|
||||
with changedir('output'):
|
||||
self.cmd('extract', self.repository_location + '::test')
|
||||
|
@ -521,6 +523,44 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|||
sto = os.stat('output/input/dir2')
|
||||
assert sti.st_mtime_ns == sto.st_mtime_ns
|
||||
|
||||
@pytest.mark.skipif(not is_utime_fully_supported(),
|
||||
reason='cannot properly setup and execute test without utime')
|
||||
def test_directory_timestamps2(self):
|
||||
self.create_test_files()
|
||||
self.cmd('init', '--encryption=repokey', self.repository_location)
|
||||
|
||||
# given order, dir first, file second
|
||||
flist_dir_first = b"input/dir2\ninput/dir2/file2\n"
|
||||
self.cmd('create', '--paths-from-stdin', self.repository_location + '::test',
|
||||
input=flist_dir_first)
|
||||
with changedir('output'):
|
||||
self.cmd('extract', self.repository_location + '::test')
|
||||
# extracting a file inside a directory touches the directory mtime
|
||||
assert os.path.exists('output/input/dir2/file2')
|
||||
# make sure borg fixes the directory mtime after touching it
|
||||
sti = os.stat('input/dir2')
|
||||
sto = os.stat('output/input/dir2')
|
||||
assert sti.st_mtime_ns == sto.st_mtime_ns
|
||||
|
||||
@pytest.mark.skipif(not is_utime_fully_supported(),
|
||||
reason='cannot properly setup and execute test without utime')
|
||||
def test_directory_timestamps3(self):
|
||||
self.create_test_files()
|
||||
self.cmd('init', '--encryption=repokey', self.repository_location)
|
||||
|
||||
# given order, file first, dir second
|
||||
flist_file_first = b"input/dir2/file2\ninput/dir2\n"
|
||||
self.cmd('create', '--paths-from-stdin', self.repository_location + '::test',
|
||||
input=flist_file_first)
|
||||
with changedir('output'):
|
||||
self.cmd('extract', self.repository_location + '::test')
|
||||
# extracting a file inside a directory touches the directory mtime
|
||||
assert os.path.exists('output/input/dir2/file2')
|
||||
# make sure borg fixes the directory mtime after touching it
|
||||
sti = os.stat('input/dir2')
|
||||
sto = os.stat('output/input/dir2')
|
||||
assert sti.st_mtime_ns == sto.st_mtime_ns
|
||||
|
||||
@pytest.mark.skipif(not is_utime_fully_supported(), reason='cannot properly setup and execute test without utime')
|
||||
def test_atime(self):
|
||||
def has_noatime(some_file):
|
||||
|
|
Loading…
Add table
Reference in a new issue