outFile creates a real OS file for testing. We cannot use stdout/stderr since we need to read the contents afterwards to validate, and we have to write to a file to benchmark the impact of write() syscalls.
(b *testing.B)
| 133 | // We cannot use stdout/stderr since we need to read the contents afterwards to validate, and we have to write to a file |
| 134 | // to benchmark the impact of write() syscalls. |
| 135 | func outFile(b *testing.B) *os.File { |
| 136 | f, err := os.CreateTemp(b.TempDir(), "buffered*") |
| 137 | require.NoErrorf(b, err, "cannot create test file") |
| 138 | |
| 139 | return f |
| 140 | } |
| 141 | |
| 142 | // Copied from go-kit/log |
| 143 | // These tests are designed to be run with the race detector. |
no outgoing calls
no test coverage detected