mirror of
https://github.com/borgbackup/borg.git
synced 2026-07-15 21:12:50 -04:00
testsuite: relax sparse file SEEK_DATA check
On filesystems with large allocation units like tmpfs with hugepages, SEEK_DATA can report an offset before the actual first non-zero byte. The test already verifies file contents and checks st_blocks to confirm the file is stored sparsely, so only require that the first data region is not past the expected content. Signed-off-by: Zhou Qiankang <wszqkzqk@qq.com>
This commit is contained in:
parent
c944ace472
commit
3969aeac0b
1 changed files with 3 additions and 1 deletions
|
|
@ -198,7 +198,9 @@ def test_sparse_file(archivers, request):
|
|||
try:
|
||||
if fd.seek(0, os.SEEK_HOLE) != 0:
|
||||
sparse = False
|
||||
if fd.seek(0, os.SEEK_DATA) != hole_size:
|
||||
# FS allocation granularity may report DATA before the actual first
|
||||
# non-zero byte, so only check it is not after the expected content.
|
||||
if fd.seek(0, os.SEEK_DATA) > hole_size:
|
||||
sparse = False
|
||||
except OSError:
|
||||
# OS/FS does not really support SEEK_HOLE/SEEK_DATA
|
||||
|
|
|
|||
Loading…
Reference in a new issue