-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: reproduce
dune exec -w
crash with pkg management (#10960)
* test: reproduce `dune exec -w` crash with pkg management Signed-off-by: Antonio Nuno Monteiro <[email protected]> * fix: delay evaluating `env` until `get_path_and_build_if_necessary` Signed-off-by: Antonio Nuno Monteiro <[email protected]> --------- Signed-off-by: Antonio Nuno Monteiro <[email protected]>
- Loading branch information
1 parent
7838199
commit dce464e
Showing
2 changed files
with
79 additions
and
14 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,62 @@ | ||
Repro `dune exec --watch` crash with pkg management | ||
|
||
$ . ./helpers.sh | ||
|
||
$ mkdir external_sources | ||
$ cat >external_sources/dune-project <<EOF | ||
> (lang dune 3.11) | ||
> (package (name mypkg)) | ||
> EOF | ||
$ cat >external_sources/dune <<EOF | ||
> (library | ||
> (public_name mypkg.lib) | ||
> (name test_lib)) | ||
> EOF | ||
$ cat >external_sources/test_lib.ml <<EOF | ||
> let x = "hello" | ||
> EOF | ||
|
||
Now we set up a lock file with this package and then attempt to use it: | ||
|
||
$ cat >dune-project <<EOF | ||
> (lang dune 3.11) | ||
> EOF | ||
|
||
$ mkdir dune.lock | ||
$ cat >dune.lock/lock.dune <<EOF | ||
> (lang package 0.1) | ||
> EOF | ||
|
||
$ cat >dune.lock/mypkg.pkg <<EOF | ||
> (version 0.0.1) | ||
> (source (copy $PWD/external_sources)) | ||
> (build | ||
> (run dune build --release --promote-install-file=true . @install)) | ||
> EOF | ||
|
||
$ cat >dune <<EOF | ||
> (dirs (:standard \ external_sources)) | ||
> (executable | ||
> (name x) | ||
> (libraries mypkg.lib)) | ||
> EOF | ||
|
||
$ cat >x.ml <<EOF | ||
> let () = print_endline Test_lib.x | ||
> EOF | ||
|
||
$ dune exec -w ./x.exe > output.log 2>&1 & | ||
$ PID=$! | ||
|
||
$ TIME_WAITED=0 | ||
$ MAX_WAIT_TIME=20 | ||
$ SLEEP_INTERVAL=1 | ||
$ while [ $(cat output.log | wc -l) -lt 2 ] && [ "$TIME_WAITED" -lt "$MAX_WAIT_TIME" ]; do | ||
> sleep 0.1 | ||
> TIME_WAITED=$((TIME_WAITED + SLEEP_INTERVAL)) | ||
> done | ||
|
||
$ cat output.log | sort | ||
Success, waiting for filesystem changes... | ||
hello | ||
$ kill $PID |