Skip to content

Commit

Permalink
test: add a repro for ocaml#8284 (ocaml#8292)
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne Millon <me@emillon.org>
  • Loading branch information
emillon committed Jul 31, 2023
1 parent 4a6287d commit 5ae4ae1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/dune
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@
(applies_to github8041)
(enabled_if
(= %{system} linux))
(deps %{bin:strace}))
(deps %{bin:strace} %{bin:head}))
13 changes: 12 additions & 1 deletion test/blackbox-tests/test-cases/github8041.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,26 @@
> (rule (copy data.txt data2.txt))
>
> (install
> (files data.txt data2.txt)
> (files data.txt data2.txt data3.txt)
> (section share))
> EOF

$ echo contents > data.txt
$ head -c 100000 /dev/zero > data3.txt

If sendfile fails, we should fallback to the portable implementation.

$ strace -e inject=sendfile:error=EINVAL -o /dev/null dune build @install

#8210: data2.txt is copied from readonly-file data.txt (#3092), so it needs to
be adequately unlinked before starting the fallback.

#8284: the buffer needs to be flushed, or there will be incomplete data in
larger files.

$ if cmp -s data3.txt _build/default/data3.txt ; then
> echo "File copied correctly"
> else
> echo "File copied incorrectly"
> fi
File copied incorrectly

0 comments on commit 5ae4ae1

Please sign in to comment.