Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add reproduction for regression with exec + watch #10380

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/blackbox-tests/test-cases/exec-watch/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
;; sometimes go undetected. Adding a delay (e.g. `sleep 1`) before modifying the
;; program seems to guarantee a rebuild will be triggered, but that is too
;; unreliable to depend on in a test so these tests are disabled on macos.
;; (<> "macosx" %{ocaml-config:system})
(<> "macosx" %{ocaml-config:system})
;; disabled until it works in CI
false))
))

(cram
(deps wait-for-file.sh))
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ between each change to its code.
1 | let () = print_endline "baz
^
Error: String literal not terminated
Had errors, waiting for filesystem changes...
Had 1 error, waiting for filesystem changes...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to do with this PR, this is just a change that was never promoted

Success, waiting for filesystem changes...
baz
$ PID=$!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(executable
(name main)
(libraries unix))
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let () =
let touch path =
let fd = Unix.openfile path [ Unix.O_CREAT ] 777 in
Unix.close fd
in
print_endline "foo";
match Sys.argv.(1) with
| exception _ -> ()
| path -> touch path
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 3.6)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

exec + watch works fine when invoked at the root level
$ DONE_FLAG=_build/done_flag
$ dune exec --watch ./bin/main.exe $DONE_FLAG &
Success, waiting for filesystem changes...
foo
$ PID=$!

Wait for the $DONE_FLAG file to exist, then delete the file. This file is
created by the program being exec'd, so when it exists we know that it's safe to
change the code and proceed with the test.
$ ../wait-for-file.sh $DONE_FLAG
$ kill $PID


It's broken when invoked in a child folder
$ cd bin && dune exec --root .. --watch ./bin/main.exe &
Entering directory '..'
Error: posix_spawn(): No such file or directory
Leaving directory '..'
$ wait

But it works fine without watch mode
$ cd bin && dune exec --root .. ./bin/main.exe
Entering directory '..'
Leaving directory '..'
foo
Loading