This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
21
unikernel/duniverse/dune_/test/blackbox-tests/test-cases/env/env-var-expansion/correct.t/dune
vendored
Normal file
21
unikernel/duniverse/dune_/test/blackbox-tests/test-cases/env/env-var-expansion/correct.t/dune
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
(alias
|
||||
(name echo1)
|
||||
(action (echo %{env:DUNE_ENV_VAR=true})))
|
||||
|
||||
(alias
|
||||
(name echo2)
|
||||
(action
|
||||
(progn
|
||||
(echo "previous env: %{env:DUNE_ENV_VAR=unset}\n")
|
||||
(setenv DUNE_ENV_VAR "set by setenv"
|
||||
(echo "new env:%{env:DUNE_ENV_VAR=unset-by-env}")))))
|
||||
|
||||
(alias
|
||||
(name enabled)
|
||||
(enabled_if (= true %{env:DUNE_ENV_VAR=true}))
|
||||
(action (echo "enabled!")))
|
||||
|
||||
(alias
|
||||
(name disabled)
|
||||
(enabled_if (= true %{env:DUNE_ENV_VAR=false}))
|
||||
(action (echo "enabled!")))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.4)
|
||||
34
unikernel/duniverse/dune_/test/blackbox-tests/test-cases/env/env-var-expansion/correct.t/run.t
vendored
Normal file
34
unikernel/duniverse/dune_/test/blackbox-tests/test-cases/env/env-var-expansion/correct.t/run.t
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
Actually test that the environment changes are properly tracked, i.e. that
|
||||
incrementality works properly, that (setenv ...) is taken into account, etc.
|
||||
|
||||
$ dune build @echo1
|
||||
true
|
||||
$ DUNE_ENV_VAR=true dune build @echo1
|
||||
$ DUNE_ENV_VAR=false dune build @echo1
|
||||
false
|
||||
$ DUNE_ENV_VAR=false dune build @echo1
|
||||
$ DUNE_ENV_VAR=true dune build @echo1
|
||||
|
||||
This test is broken because previous/new values should differ in these tests. In
|
||||
the dune file, the environment variable ends up being set locally, but this
|
||||
isn't reflected on a per action basis.
|
||||
|
||||
$ dune build @echo2
|
||||
previous env: unset
|
||||
new env:set by setenv
|
||||
$ DUNE_ENV_VAR=true dune build @echo2
|
||||
previous env: true
|
||||
new env:set by setenv
|
||||
$ DUNE_ENV_VAR=false dune build @echo2
|
||||
previous env: false
|
||||
new env:set by setenv
|
||||
|
||||
$ dune build @enabled
|
||||
enabled!
|
||||
$ DUNE_ENV_VAR=true dune build @enabled
|
||||
$ DUNE_ENV_VAR=false dune build @enabled
|
||||
|
||||
$ dune build @disabled
|
||||
$ DUNE_ENV_VAR=true dune build @disabled
|
||||
enabled!
|
||||
$ DUNE_ENV_VAR=false dune build @disabled
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(alias
|
||||
(name echo)
|
||||
(action (echo %{env:DUNE_ENV_VAR})))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.4)
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
Make sure that we require a default value regardless of the context
|
||||
|
||||
$ dune build @echo
|
||||
File "dune", line 3, characters 15-34:
|
||||
3 | (action (echo %{env:DUNE_ENV_VAR})))
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
Error: %{env:..} must always come with a default value.
|
||||
Hint: the syntax is %{env:VAR=DEFAULT-VALUE}
|
||||
[1]
|
||||
$ dune build @echo
|
||||
File "dune", line 3, characters 15-34:
|
||||
3 | (action (echo %{env:DUNE_ENV_VAR})))
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
Error: %{env:..} must always come with a default value.
|
||||
Hint: the syntax is %{env:VAR=DEFAULT-VALUE}
|
||||
[1]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(alias
|
||||
(name echo)
|
||||
(enabled_if (= true %{env:DUNE_ENV_VAR}))
|
||||
(action (echo "enabled!")))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.4)
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
$ dune build @echo
|
||||
File "dune", line 3, characters 21-40:
|
||||
3 | (enabled_if (= true %{env:DUNE_ENV_VAR}))
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
Error: %{env:..} must always come with a default value.
|
||||
Hint: the syntax is %{env:VAR=DEFAULT-VALUE}
|
||||
[1]
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
(rule (with-stdout-to bar (echo "from bar")))
|
||||
|
||||
(alias
|
||||
(name default)
|
||||
(action
|
||||
(progn
|
||||
(echo "Initial value of %{env:DUNE_FOO=unset}\n")
|
||||
(setenv DUNE_FOO XXXX (echo "Now set: %{env:DUNE_FOO=unset}\n"))
|
||||
(setenv DUNE_FOO %{read:bar} (echo "From bar: %{env:DUNE_FOO=unset}\n")))))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.5)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
$ dune build
|
||||
Initial value of unset
|
||||
Now set: XXXX
|
||||
From bar: from bar
|
||||
Loading…
Add table
Add a link
Reference in a new issue