Skip to content

Commit

Permalink
test: demonstrate overflow with sendfile (ocaml#10334)
Browse files Browse the repository at this point in the history
See ocaml#10333

Signed-off-by: Etienne Millon <me@emillon.org>
  • Loading branch information
emillon committed Apr 17, 2024
1 parent 0c42611 commit 50d99a6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/blackbox-tests/test-cases/dune
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
(applies_to fdo)
(enabled_if false))

; This test copies a large file, which is too slow to be enabled all the time.
; The source file is actually sparse, but sendfile seems to do a full copy
; nevertheless.
(cram
(applies_to sendfile-large-file)
(enabled_if false))

; This test is flaky

(cram
Expand Down
22 changes: 22 additions & 0 deletions test/blackbox-tests/test-cases/sendfile-large-file.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
We create a large file and check that it is copied completely.

$ cat > dune-project << EOF
> (lang dune 1.0)
> EOF

$ cat > create.ml << EOF
> let () = Unix.truncate "file.dat" 0x1_00_00_00_03
> EOF
$ touch file.dat
$ ocaml unix.cma create.ml
$ rm create.ml

$ dune build file.dat

$ dune_cmd stat size file.dat
4294967299

$ dune_cmd stat size _build/default/file.dat
3

(3 indicates that the file size is taken modulo 2**32)

0 comments on commit 50d99a6

Please sign in to comment.