Skip to content
Open
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
46 changes: 46 additions & 0 deletions test/blackbox-tests/test-cases/pkg/local-dune-bin.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
The dune binary we resolve should be the current one we are running:

$ . ./helpers.sh

$ mkdir fake_dune
$ cat > fake_dune/dune <<EOF
> #!/usr/bin/env sh
> echo "Incorrect dune!"
> EOF
$ chmod +x fake_dune/dune

$ REAL_DUNE=$(which dune)

$ mkdir test && cd test
$ mkrepo

$ mkpkg bar <<EOF
> depends: [ "dune" ]
> build: [ "echo" "$(which dune)" ]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This might not be the most optimal way to test for this. One other issue is that we might just intercept (run dune ...) in the build plan and use our own, and that doesn't appear to be the case at the moment.

> EOF

$ solve_project <<EOF
> (lang dune 3.21)
> (package
> (name foo)
> (allow_empty)
> (depends bar))
> EOF
Solution for dune.lock:
- bar.0.0.1

$ test() {
> dune build @pkg-install 2>&1 | sed "s|$REAL_DUNE|Correct dune!|"
> }

Everything appears to build correctly.

$ test
Correct dune!

However if we put a different dune in PATH, the problems become apparent.

$ export PATH="$PWD/../fake_dune:$PATH"

$ test
Incorrect dune!
Loading