Skip to content

Commit cab1202

Browse files
cmd/link: accept extra blocks in TestFallocate
For #41127 Change-Id: I794a082299c6dce4202223197ece1864bed36810 Reviewed-on: https://go-review.googlesource.com/c/go/+/282555 Trust: Ian Lance Taylor <[email protected]> Reviewed-by: Austin Clements <[email protected]>
1 parent ee4d322 commit cab1202

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/cmd/link/internal/ld/fallocate_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ func TestFallocate(t *testing.T) {
5757
if got := stat.Size(); got != sz {
5858
t.Errorf("unexpected file size: got %d, want %d", got, sz)
5959
}
60-
if got, want := stat.Sys().(*syscall.Stat_t).Blocks, (sz+511)/512; got != want {
61-
t.Errorf("unexpected disk usage: got %d blocks, want %d", got, want)
60+
// The number of blocks must be enough for the requested size.
61+
// We used to require an exact match, but it appears that
62+
// some file systems allocate a few extra blocks in some cases.
63+
// See issue #41127.
64+
if got, want := stat.Sys().(*syscall.Stat_t).Blocks, (sz+511)/512; got < want {
65+
t.Errorf("unexpected disk usage: got %d blocks, want at least %d", got, want)
6266
}
6367
out.munmap()
6468
}

0 commit comments

Comments
 (0)