test-copy: add a test shuffling bytes between normal files
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 14 Mar 2016 17:18:14 +0000 (13:18 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 15 Mar 2016 18:53:31 +0000 (14:53 -0400)
commitce33fddad0806f859ff7324527ee0525dd10455e
tree8223f829ce74a0e48e0ccb4500d01a02515f7d25
parent70e43ee7be6ee8d1e8aa4b2984a72baa25709c2e
test-copy: add a test shuffling bytes between normal files

I started looking into adding copy_file_range support, and discovered
that we can improve the way we call sendfile:
- sendfile(2) man page is missing an important bit: the number of bytes to
  copy cannot be too big (SSIZE_MAX actually), and the description of EINVAL
  return code does not mention this either,
- our implementation works but calls sendfile over and over with a small
  size, which seems suboptimal.

First add a test which (under strace) can be used to see current behaviour.
src/test/test-copy.c