summaryrefslogtreecommitdiff
path: root/tests/plaintextnames
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-05-29 16:56:20 +0200
committerJakob Unterwurzacher2021-05-29 16:56:20 +0200
commit0e37fbe0425126c9dbb9a1816286e947d05a4b8e (patch)
tree941d1d4ec6cb9a9f8cc48428f17fe2b2bb787faa /tests/plaintextnames
parent18befda0e6f1a690fa000951df8f9a4a61daebbb (diff)
tests: TestFileHoleCopy: accept +-4kB
Failure looked like this: --- FAIL: TestFileHoleCopy (3.73s) --- FAIL: TestFileHoleCopy/k81 (0.04s) file_holes_test.go:93: size changed: st0.Blocks=88 st2.Blocks=96 file_holes_test.go:147: aborting further subtests $ findholes TestFileHoleCopy.k81.1 0 data 36864 hole 45056 data 50434 hole 50434 eof $ findholes TestFileHoleCopy.k81.2 0 data 36864 hole 45056 data 50434 hole 50434 eof $ filefrag -v TestFileHoleCopy.k81.1 Filesystem type is: ef53 File size of TestFileHoleCopy.k81.1 is 50434 (13 blocks of 4096 bytes) ext: logical_offset: physical_offset: length: expected: flags: 0: 0.. 2: 23702311.. 23702313: 3: 1: 3.. 8: 20389855.. 20389860: 6: 23702314: 2: 11.. 12: 23702314.. 23702315: 2: 20389863: last,eof TestFileHoleCopy.k81.1: 3 extents found $ filefrag -v TestFileHoleCopy.k81.2 Filesystem type is: ef53 File size of TestFileHoleCopy.k81.2 is 50434 (13 blocks of 4096 bytes) ext: logical_offset: physical_offset: length: expected: flags: 0: 0.. 2: 20389861.. 20389863: 3: 1: 3.. 4: 23702316.. 23702317: 2: 20389864: 2: 5.. 6: 20389864.. 20389865: 2: 23702318: 3: 7.. 8: 23702318.. 23702319: 2: 20389866: 4: 11.. 12: 23702320.. 23702321: 2: last,eof TestFileHoleCopy.k81.2: 4 extents found
Diffstat (limited to 'tests/plaintextnames')
-rw-r--r--tests/plaintextnames/file_holes_test.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/plaintextnames/file_holes_test.go b/tests/plaintextnames/file_holes_test.go
index 9948715..5de0152 100644
--- a/tests/plaintextnames/file_holes_test.go
+++ b/tests/plaintextnames/file_holes_test.go
@@ -88,8 +88,10 @@ func doTestFileHoleCopy(t *testing.T, name string, writeOffsets []int64) {
if err := syscall.Stat(pPath[i], &st); err != nil {
t.Fatal(err)
}
- // Sometimes the size on disk decreases by 4k due to less fragmentation
- if st.Blocks != st0.Blocks && st.Blocks != st0.Blocks-8 {
+ // Size on disk fluctuates by +-4kB due to different number of extents
+ // (looking at "filefrag -v", it seems like ext4 needs 4kB extra once
+ // you have >=4 extents)
+ if st.Blocks != st0.Blocks && st.Blocks != st0.Blocks-8 && st.Blocks != st0.Blocks+8 {
t.Errorf("size changed: st0.Blocks=%d st%d.Blocks=%d", st0.Blocks, i, st.Blocks)
}
}