From 70e81c4f6a02b412dd18a91a966020843ea85cfe Mon Sep 17 00:00:00 2001 From: Etienne Millon Date: Fri, 29 Mar 2024 14:32:58 +0100 Subject: [PATCH] test: demonstrate overflow with sendfile See #10333 Signed-off-by: Etienne Millon --- test/blackbox-tests/test-cases/dune | 4 ++++ .../test-cases/sendfile-large-file.t | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 test/blackbox-tests/test-cases/sendfile-large-file.t diff --git a/test/blackbox-tests/test-cases/dune b/test/blackbox-tests/test-cases/dune index 5457f0c02ea6..3735550ede22 100644 --- a/test/blackbox-tests/test-cases/dune +++ b/test/blackbox-tests/test-cases/dune @@ -43,6 +43,10 @@ (applies_to fdo) (enabled_if false)) +(cram + (applies_to sendfile-large-file) + (enabled_if false)) + ; This test is flaky (cram diff --git a/test/blackbox-tests/test-cases/sendfile-large-file.t b/test/blackbox-tests/test-cases/sendfile-large-file.t new file mode 100644 index 000000000000..ab6e766d6282 --- /dev/null +++ b/test/blackbox-tests/test-cases/sendfile-large-file.t @@ -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)