From 94ec6209a722aed8e5b646011f91c39781292320 Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Sat, 19 Oct 2024 17:05:04 -0700 Subject: [PATCH] better test Signed-off-by: Antonio Nuno Monteiro --- test/blackbox-tests/test-cases/pkg/gh10959.t | 56 +++++++++++--------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/test/blackbox-tests/test-cases/pkg/gh10959.t b/test/blackbox-tests/test-cases/pkg/gh10959.t index 1e41229bb7c4..e9d39ac65d32 100644 --- a/test/blackbox-tests/test-cases/pkg/gh10959.t +++ b/test/blackbox-tests/test-cases/pkg/gh10959.t @@ -2,53 +2,61 @@ Repro `dune exec --watch` crash with pkg management $ . ./helpers.sh - $ cat >dune-project < (lang dune 3.13) - > (pin - > (url file://$PWD/_multiple) - > (package (name foo)) - > (package (name bar))) - > (package - > (name main) - > (depends foo bar)) + $ mkdir external_sources + $ cat >external_sources/dune-project < (lang dune 3.11) + > (package (name mypkg)) > EOF - - $ cat >dune < (executable - > (name x)) + $ cat >external_sources/dune < (library + > (public_name mypkg.lib) + > (name test_lib)) > EOF - $ cat >x.ml < let () = print_endline "hello" + $ cat >external_sources/test_lib.ml < let x = "hello" + > EOF + +Now we set up a lock file with this package and then attempt to use it: + + $ cat >dune-project < (lang dune 3.11) > EOF $ mkdir dune.lock $ cat >dune.lock/lock.dune < (lang package 0.1) - > (repositories - > (complete true)) > EOF - $ cat >dune.lock/test.pkg <dune.lock/mypkg.pkg < (version 0.0.1) + > (source (copy $PWD/external_sources)) > (build - > (system "echo building test")) + > (run dune build --release --promote-install-file=true . @install)) + > EOF + + $ cat >dune < (dirs (:standard \ external_sources)) + > (executable + > (name x) + > (libraries mypkg.lib)) + > EOF + + $ cat >x.ml < let () = print_endline Test_lib.x > EOF $ dune exec -w ./x.exe > output.log 2>&1 & $ PID=$! $ TIME_WAITED=0 - $ MAX_WAIT_TIME=30 + $ MAX_WAIT_TIME=20 $ SLEEP_INTERVAL=1 - $ while [ $(cat output.log | wc -l) -lt 3 ] && [ "$TIME_WAITED" -lt "$MAX_WAIT_TIME" ]; do + $ 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 - $ echo $TIME_WAITED - 6 $ cat output.log | sort Success, waiting for filesystem changes... - building test hello $ kill $PID