MCPcopy
hub / github.com/borgbackup/borg / test_birthtime

Function test_birthtime

src/borg/testsuite/archiver/extract_cmd_test.py:167–182  ·  view source on GitHub ↗
(archivers, request)

Source from the content-addressed store, hash-verified

165@pytest.mark.skipif(not is_utime_fully_supported(), reason="cannot setup and execute test without utime")
166@pytest.mark.skipif(not is_birthtime_fully_supported(), reason="cannot setup and execute test without birthtime")
167def test_birthtime(archivers, request):
168 archiver = request.getfixturevalue(archivers)
169 create_test_files(archiver.input_path)
170 birthtime, mtime, atime = 946598400, 946684800, 946771200
171 os.utime("input/file1", (atime, birthtime))
172 os.utime("input/file1", (atime, mtime))
173 cmd(archiver, "repo-create", RK_ENCRYPTION)
174 cmd(archiver, "create", "test", "input")
175 with changedir("output"):
176 cmd(archiver, "extract", "test")
177 sti = os.stat("input/file1")
178 sto = os.stat("output/input/file1")
179 assert same_ts_ns(sti.st_birthtime * 1e9, sto.st_birthtime * 1e9)
180 assert same_ts_ns(sto.st_birthtime * 1e9, birthtime * 1e9)
181 assert same_ts_ns(sti.st_mtime_ns, sto.st_mtime_ns)
182 assert same_ts_ns(sto.st_mtime_ns, mtime * 10**9)
183
184
185def test_sparse_file(archivers, request):

Callers

nothing calls this directly

Calls 4

create_test_filesFunction · 0.85
cmdFunction · 0.85
changedirFunction · 0.85
same_ts_nsFunction · 0.85

Tested by

no test coverage detected