This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
(executable
|
||||
(public_name foo)
|
||||
(libraries unix))
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
(lang dune 3.6)
|
||||
(package (name foo))
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
Test exec --watch with a program that doesn't terminate immediately.
|
||||
|
||||
File created by the program being exec'd. In between each experiment we'll wait
|
||||
until the file exists so that dune has enough time to build and run the program
|
||||
between each change to its code.
|
||||
$ export DONE_FLAG=_build/done_flag
|
||||
|
||||
$ cat >foo.ml <<EOF
|
||||
> let () =
|
||||
> print_endline "0: before";
|
||||
> Touch.touch "$DONE_FLAG";
|
||||
> Unix.sleep 1000;
|
||||
> print_endline "0: after"
|
||||
> EOF
|
||||
|
||||
$ dune exec --watch ./foo.exe &
|
||||
0: before
|
||||
1: before
|
||||
1: after
|
||||
Success, waiting for filesystem changes...
|
||||
2: before
|
||||
$ PID=$!
|
||||
|
||||
$ ../wait-for-file.sh $DONE_FLAG
|
||||
|
||||
Change the program so that it terminates immediately.
|
||||
$ cat >foo.ml <<EOF
|
||||
> let () =
|
||||
> print_endline "1: before";
|
||||
> Unix.sleep 0;
|
||||
> print_endline "1: after";
|
||||
> Touch.touch "$DONE_FLAG"
|
||||
> EOF
|
||||
|
||||
$ ../wait-for-file.sh $DONE_FLAG
|
||||
|
||||
Change the program so that it no longer terminates immediately.
|
||||
$ cat >foo.ml <<EOF
|
||||
> let () =
|
||||
> print_endline "2: before";
|
||||
> Touch.touch "$DONE_FLAG";
|
||||
> Unix.sleep 1000;
|
||||
> print_endline "2: after"
|
||||
> EOF
|
||||
|
||||
$ ../wait-for-file.sh $DONE_FLAG
|
||||
|
||||
Prevent the test from leaking the dune process.
|
||||
$ kill $PID
|
||||
|
||||
Checking for the child process
|
||||
$ pgrep -c "foo.exe" || true
|
||||
0
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
let touch path =
|
||||
let fd = Unix.openfile path [ Unix.O_CREAT ] 777 in
|
||||
Unix.close fd
|
||||
Loading…
Add table
Add a link
Reference in a new issue