-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dune exec -- wrt file path, public_name with or without .exe
Fix for #3322 "dune exec needs to add .exe on Windows". Signed-off-by: Antonin Décimo <[email protected]>
- Loading branch information
Showing
7 changed files
with
132 additions
and
3 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
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,3 @@ | ||
(executable | ||
(name example) | ||
(public_name shaihulud)) |
8 changes: 8 additions & 0 deletions
8
test/blackbox-tests/test-cases/public_name-exe.t/dune-project
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,8 @@ | ||
(lang dune 2.8) | ||
(generate_opam_files true) | ||
(package | ||
(name mypackage) | ||
(synopsis "My first Dune package!") | ||
(description "\| This is my first attempt at creating | ||
"\| a project with Dune. | ||
)) |
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 @@ | ||
let () = print_endline "Hello, World!" |
25 changes: 25 additions & 0 deletions
25
test/blackbox-tests/test-cases/public_name-exe.t/mypackage.opam
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,25 @@ | ||
# This file is generated by dune, edit dune-project instead | ||
opam-version: "2.0" | ||
synopsis: "My first Dune package!" | ||
description: """ | ||
This is my first attempt at creating | ||
a project with Dune. | ||
""" | ||
depends: [ | ||
"dune" {>= "2.8"} | ||
"odoc" {with-doc} | ||
] | ||
build: [ | ||
["dune" "subst"] {dev} | ||
[ | ||
"dune" | ||
"build" | ||
"-p" | ||
name | ||
"-j" | ||
jobs | ||
"@install" | ||
"@runtest" {with-test} | ||
"@doc" {with-doc} | ||
] | ||
] |
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,88 @@ | ||
Test case for https://github.com/ocaml/dune/issues/3322 | ||
"dune exec needs to add .exe on Windows" | ||
|
||
$ os_type=$(ocamlc -config-var os_type) | ||
|
||
Test that on Windows `dune exec -- public_name` and | ||
`dune exec -- public_name.exe` have the same effect. | ||
|
||
With extension | ||
============== | ||
|
||
$ dune clean | ||
$ dune build @install | ||
$ if [ $os_type = Win32 ]; then dune exec -- shaihulud.exe; else echo "Hello, World!"; fi | ||
Hello, World! | ||
|
||
Without extension, prebuild | ||
================= | ||
|
||
$ dune clean | ||
$ dune build @install | ||
$ dune exec -- shaihulud | ||
Hello, World! | ||
|
||
|
||
Test that `dune exec -- public_name` (omitting the .exe) works from a | ||
clean state. | ||
|
||
Without extension, clean state | ||
============================== | ||
|
||
$ dune clean | ||
$ dune exec -- shaihulud | ||
Hello, World! | ||
|
||
|
||
Test that the public name resolves well to the actual executable file | ||
when a dependency changes. On platforms where there are no symlinks, | ||
updating the public_name executable matters. | ||
|
||
With extension, prebuild | ||
============== | ||
|
||
$ dune clean | ||
$ dune build @install | ||
|
||
$ if [ $os_type = Win32 ]; then dune exec -- shaihulud.exe; else echo "Hello, World!"; fi | ||
Hello, World! | ||
$ dune exec -- ./example.exe | ||
Hello, World! | ||
$ sed -i.bak 's/World/Arrakis/' example.ml | ||
$ if [ $os_type = Win32 ]; then dune exec -- shaihulud.exe; else echo "Hello, Arrakis!"; fi | ||
Hello, Arrakis! | ||
$ dune exec -- ./example.exe | ||
Hello, Arrakis! | ||
|
||
Without extension, prebuild | ||
================= | ||
|
||
$ sed -i.bak 's/Arrakis/World/' example.ml | ||
$ dune clean | ||
$ dune build @install | ||
|
||
$ dune exec -- shaihulud | ||
Hello, World! | ||
$ dune exec -- ./example.exe | ||
Hello, World! | ||
$ sed -i.bak 's/World/Arrakis/' example.ml | ||
$ dune exec -- shaihulud | ||
Hello, Arrakis! | ||
$ dune exec -- ./example.exe | ||
Hello, Arrakis! | ||
|
||
Without extention, clean state | ||
============================== | ||
|
||
$ sed -i.bak 's/Arrakis/World/' example.ml | ||
$ dune clean | ||
|
||
$ dune exec -- shaihulud | ||
Hello, World! | ||
$ dune exec -- ./example.exe | ||
Hello, World! | ||
$ sed -i.bak 's/World/Arrakis/' example.ml | ||
$ dune exec -- shaihulud | ||
Hello, Arrakis! | ||
$ dune exec -- ./example.exe | ||
Hello, Arrakis! |