Skip to content

Commit

Permalink
test: add repro for #9272 (codesign regression)
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne Millon <me@emillon.org>
  • Loading branch information
emillon committed Mar 13, 2024
1 parent 481fa1b commit 60af097
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/blackbox-tests/test-cases/dune
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,11 @@
(enabled_if
(not %{arch_sixtyfour}))
(deps %{bin:ocaml}))

(cram
(applies_to github9272)
(enabled_if
(and
(= %{system} macosx)
(= %{architecture} arm64)))
(deps %{bin:ocaml}))
42 changes: 42 additions & 0 deletions test/blackbox-tests/test-cases/github9272.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Repro for #9272: when an executable that depends on dune-site is promoted to
the source tree, the executable in the source tree segfaults.

$ cat > dune-project << EOF
> (lang dune 3.0)
> (using dune_site 0.1)
> EOF

$ cat > dune << EOF
> (executable
> (name hello)
> (promote (until-clean))
> (libraries dune-site))
> EOF

$ touch hello.ml

$ dune build

Test particularity: we can not do ./hello.exe directly, because the shell
itself (that runs the cram test) will display the pid of the crashing process.
Instead, we start and wait for it in an OCaml program and only display the
code.

Once the bug is fixed, this can be replaced by just `./hello.exe` and the test
can be enabled for all systems.

$ cat > exec.ml << EOF
> let () =
> let pid =
> Unix.create_process
> "./hello.exe" [|"./hello.exe"|]
> Unix.stdin Unix.stdout Unix.stderr
> in
> match Unix.waitpid [] pid with
> | _, WEXITED n -> Printf.printf "WEXITED %d" n
> | _, WSTOPPED n -> Printf.printf "WSTOPPED %d" n
> | _, WSIGNALED n -> Printf.printf "WSIGNALED %d" n
> EOF

$ ocaml -I +unix unix.cma exec.ml
WSIGNALED -7

0 comments on commit 60af097

Please sign in to comment.