type copyFileTestFunc … type copyFileTestHook … func TestCopyFile(t *testing.T) { … } func testCopyFile(t *testing.T, dst, src *File, data []byte, hook *copyFileHook, limit int64, testName string) { … } // mustContainData ensures that the specified file contains exactly the // specified data. func mustContainData(t *testing.T, f *File, data []byte) { … } func mustSeekStart(t *testing.T, f *File) { … } // newCopyFileTest initializes a new test for copying data between files. // It creates source and destination files, and populates the source file // with random data of the specified size, then rewind it, so it can be // consumed by copy_file_range(2) or sendfile(2). func newCopyFileTest(t *testing.T, size int64) (dst, src *File, data []byte) { … } type copyFileHook … func createTempFile(tb testing.TB, name string, size int64) (*File, []byte) { … }