Skip to content

Commit cdcf09e

Browse files
committed
test: repro case for #8075
Signed-off-by: Ali Caglayan <[email protected]>
1 parent aa803cf commit cdcf09e

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(cram
2+
(applies_to symlink-to-nonexistent)
3+
(deps %{bin:git} ../git-helpers.sh))
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Tests for promoting with symlink to non-existent file.
2+
3+
$ cat > dune-project <<EOF
4+
> (lang dune 3.21)
5+
> EOF
6+
$ cp dune-project dune-workspace
7+
8+
$ cat > dune <<EOF
9+
> (rule
10+
> (with-stdout-to "x.gen"
11+
> (echo "toto")))
12+
> (rule
13+
> (alias bench)
14+
> (action
15+
> (diff promoted x.gen)))
16+
> EOF
17+
18+
Unset INSIDE_DUNE in order to choose the "git diff" diff algorithm. Root
19+
detection will now be automatic so a dune-workspace file was included above.
20+
$ unset INSIDE_DUNE
21+
22+
The "git diff" command that dune will run will unfortunately go looking for a
23+
`.git` root. We therefore initialise a git repo to avoid this from escaping the
24+
test.
25+
$ . ../git-helpers.sh
26+
$ git init -q
27+
28+
This should fail initially but not with the "Unable to resolve symlink" error.
29+
$ dune build @bench
30+
File "dune", lines 4-7, characters 0-55:
31+
4 | (rule
32+
5 | (alias bench)
33+
6 | (action
34+
7 | (diff promoted x.gen)))
35+
Error: Unable to resolve symlink _build/default/promoted
36+
[1]
37+
38+
Promotion should work
39+
$ dune promote
40+
Promoting _build/default/x.gen to promoted.
41+
42+
$ cat promoted
43+
toto
44+

0 commit comments

Comments
 (0)