if got := stat.Size(); 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 {
- t.Errorf("unexpected disk usage: got %d blocks, want %d", got, want)
+ // The number of blocks must be enough for the requested size.
+ // 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()
}