Skip to content

Commit 9014b72

Browse files
Add repro case to show that setenv variables are not expanded
Signed-off-by: Marek Kubica <[email protected]>
1 parent bc9c360 commit 9014b72

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

test/blackbox-tests/test-cases/pkg/opam-package-with-setenv.t

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ Testing the translation of the setenv field of an opam file into the dune lock d
22

33
$ mkrepo
44

5-
Make a package with a setenv. We also test all the kinds of env updates here expcept for
6-
=+= which isn't used at all in the wild.
5+
Make a package with a setenv. We also test all the kinds of env updates here except for
6+
=+= which isn't used at all in the wild.
7+
78
$ mkpkg with-setenv <<EOF
89
> setenv: [
910
> [EXPORTED_ENV_VAR = "Hello from the other package!"]
@@ -25,7 +26,7 @@ Make another package that depends on that and outputs the exported env vars
2526
> [ "sh" "-c" "echo $append_with_leading_sep" ]
2627
> ]
2728
> EOF
28-
> solve deps-on-with-setenv
29+
$ solve deps-on-with-setenv
2930
Solution for dune.lock:
3031
- deps-on-with-setenv.0.0.1
3132
- with-setenv.0.0.1
@@ -102,7 +103,7 @@ difference between a propagated export_env versus the initial env.
102103
> [ "sh" "-c" "echo $append_with_leading_sep" ]
103104
> ]
104105
> EOF
105-
> solve deps-on-with-setenv-2
106+
$ solve deps-on-with-setenv-2
106107
Solution for dune.lock:
107108
- deps-on-with-setenv-2.0.0.1
108109
- with-setenv.0.0.1
@@ -134,3 +135,25 @@ Appended 2nd time without leading sep:Appended without leading sep
134135
Appended without leading sep:Appended 2nd time without leading sep
135136
Appended with leading sep:Appended 2nd time with leading sep
136137

138+
We also test whether OPAM variables are expanded in the setenv:
139+
140+
$ mkpkg with-setenv 0.0.2 <<EOF
141+
> setenv: [
142+
> [EXPANDED_EXPORTED_VARIABLE = "%{share}%/library"]
143+
> ]
144+
> EOF
145+
$ mkpkg deps-on-with-setenv 0.0.2 <<'EOF'
146+
> depends: [ "with-setenv" {>= "0.0.2"} ]
147+
> build: [
148+
> [ "sh" "-c" "echo $EXPANDED_EXPORTED_VARIABLE" ]
149+
> ]
150+
> EOF
151+
$ solve deps-on-with-setenv
152+
Solution for dune.lock:
153+
- deps-on-with-setenv.0.0.2
154+
- with-setenv.0.0.2
155+
156+
We expect that the variables get expanded, but alas at the moment they are not:
157+
158+
$ build_pkg deps-on-with-setenv
159+
%{share}%/library

0 commit comments

Comments
 (0)