go-tools/cover
Bryan C. Mills 242e5ed731 cover: eliminate an unnecessary fsync in TestParseProfiles
CL 179377 added TestParseProfiles, and used a call to (*os.File).Sync
instead of closing the file to flush its pending writes.
Unfortunately, on some filesystems Sync is fabulously expensive — it
may flush all pending writes everywhere on the filesystem, instead of
just flushing the writes to the one file, and flushes all the way to
disk even though this test really only needs tho writes to be
observable in the same process.

Instead, we can simplify the test significantly by using os.WriteFile
to write and flush the file's contents.

Fixes golang/go#57481.

Change-Id: I7cda28fb6e9c8183dedadf79dbafe7e870ec0c42
Reviewed-on: https://go-review.googlesource.com/c/tools/+/495798
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2023-05-17 15:38:17 +00:00
..
profile.go cover: add function to parse profiles from an io.Reader 2021-10-05 03:23:35 +00:00
profile_test.go cover: eliminate an unnecessary fsync in TestParseProfiles 2023-05-17 15:38:17 +00:00