mirror of
https://github.com/golang/go.git
synced 2025-11-10 21:51:05 +00:00
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 <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
ee4d32249b
commit
cab1202183
1 changed files with 6 additions and 2 deletions
|
|
@ -57,8 +57,12 @@ func TestFallocate(t *testing.T) {
|
||||||
if got := stat.Size(); got != sz {
|
if got := stat.Size(); got != sz {
|
||||||
t.Errorf("unexpected file size: got %d, want %d", got, sz)
|
t.Errorf("unexpected file size: got %d, want %d", got, sz)
|
||||||
}
|
}
|
||||||
if got, want := stat.Sys().(*syscall.Stat_t).Blocks, (sz+511)/512; got != want {
|
// The number of blocks must be enough for the requested size.
|
||||||
t.Errorf("unexpected disk usage: got %d blocks, want %d", got, want)
|
// We used to require an exact match, but it appears that
|
||||||
|
// some file systems allocate a few extra blocks in some cases.
|
||||||
|
// See issue #41127.
|
||||||
|
if got, want := stat.Sys().(*syscall.Stat_t).Blocks, (sz+511)/512; got < want {
|
||||||
|
t.Errorf("unexpected disk usage: got %d blocks, want at least %d", got, want)
|
||||||
}
|
}
|
||||||
out.munmap()
|
out.munmap()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue