Skip to content

Commit

Permalink
test: add repro for ocaml#9538 (subst on 32-bit) (ocaml#9539)
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne Millon <[email protected]>
  • Loading branch information
emillon authored Jan 23, 2024
1 parent 6f680a1 commit 7f770e0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/blackbox-tests/test-cases/subst/32bit.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
When dune subst is called on a file larger than 16MiB, it should not crash.
See #9538.

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

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

This test uses subst, which needs a git repository:

$ git init
Initialized empty Git repository in $TESTCASE_ROOT/.git/
$ git add dune-project
$ git add large.dat
$ git commit -m create | tail -n 3
2 files changed, 4 insertions(+)
create mode 100644 dune-project
create mode 100644 large.dat

$ dune subst 2>&1 | head -n 6
Error: exception Invalid_argument("Bytes.create")
Raised by primitive operation at Stdune__Io.Make.eagerly_input_string in file
"otherlibs/stdune/src/io.ml", line 273, characters 14-30
Called from Stdune__Io.Make.read_all.(fun) in file
"otherlibs/stdune/src/io.ml", line 308, characters 16-40
Called from Stdune__Exn.protectx in file "otherlibs/stdune/src/exn.ml", line
5 changes: 5 additions & 0 deletions test/blackbox-tests/test-cases/subst/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(cram
(applies_to 32bit)
(enabled_if
(not %{arch_sixtyfour}))
(deps %{bin:git}))

0 comments on commit 7f770e0

Please sign in to comment.