forked from ocaml/dune
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add repro for ocaml#9272 (codesign regression)
Signed-off-by: Etienne Millon <me@emillon.org>
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |