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,54 @@
|
|||
Test exec --watch with a program that terminates 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 "foo"; Touch.touch "$DONE_FLAG"
|
||||
> EOF
|
||||
|
||||
$ dune exec --watch ./foo.exe &
|
||||
foo
|
||||
Success, waiting for filesystem changes...
|
||||
bar
|
||||
Success, waiting for filesystem changes...
|
||||
File "foo.ml", line 1, characters 23-24:
|
||||
1 | let () = print_endline "baz
|
||||
^
|
||||
Error: String literal not terminated
|
||||
Had 1 error, waiting for filesystem changes...
|
||||
baz
|
||||
Success, waiting for filesystem changes...
|
||||
$ 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
|
||||
|
||||
$ cat >foo.ml <<EOF
|
||||
> let () = print_endline "bar"; Touch.touch "$DONE_FLAG"
|
||||
> EOF
|
||||
|
||||
$ ../wait-for-file.sh $DONE_FLAG
|
||||
|
||||
$ cat >foo.ml <<EOF
|
||||
> let () = print_endline "baz
|
||||
> EOF
|
||||
|
||||
Wait until the error shows up in the log
|
||||
$ until grep 'print_endline "baz' _build/log > /dev/null; do sleep 0.1; done
|
||||
|
||||
$ cat >foo.ml <<EOF
|
||||
> let () = print_endline "baz"; Touch.touch "$DONE_FLAG"
|
||||
> EOF
|
||||
|
||||
$ ../wait-for-file.sh $DONE_FLAG
|
||||
|
||||
Prevent the test from leaking the dune process.
|
||||
$ kill $PID
|
||||
$ wait $PID
|
||||
[130]
|
||||
|
||||
|
|
@ -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