Skip to content

Commit 034d29d

Browse files
Extend the explanation of the test and why we do it.
Signed-off-by: Marek Kubica <marek@tarides.com>
1 parent 7830eab commit 034d29d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/blackbox-tests/test-cases/pkg/different-dune-in-path.t

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ Call Dune with an absolute PATH as argv[0]:
9292
$ PATH=$fakepath $DUNE build "$pkg_root/$foo_digest/target/"
9393
$ PATH=$fakepath $DUNE build "$pkg_root/$bar_digest/target/"
9494

95-
Make sure that fake dune is not picked up when dune is called with argv[0] = "dune":
95+
argv[0] is set by the calling program (like a shell or cram test runner) and
96+
could be wrong, hence it cannot always be trusted. In the examples above we
97+
launch dune with an absolute path, thus one could just use argv[0] to get the
98+
exact path to the `dune` binary.
99+
100+
To make sure that we pick up the right dune even when argv[0] is being set to
101+
unhelpful values we launch the binary but set the value to a relative value,
102+
namely argv[0] = "dune". This is exactly what happens if `dune` is in the PATH
103+
and the user launches `dune` in a shell.
96104

97105
$ dune clean
98106
$ PATH=$fakepath dune_cmd exec-a "dune" $DUNE build "$pkg_root/$foo_digest/target/"

0 commit comments

Comments
 (0)