This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
Regression test for using %{test} in (diff ...)
|
||||
|
||||
The action expander treats the second argument of diff? as "consuming
|
||||
a target". Since targets needs to be known at rule creation time
|
||||
rather than at rule evaluation time and dependencies are usually
|
||||
evaluated at the latter stage, the below pattern could break if we
|
||||
are not careful. We want to support it because it is a common pattern.
|
||||
|
||||
$ echo '(lang dune 2.8)' > dune-project
|
||||
$ cat > dune <<EOF
|
||||
> (rule
|
||||
> (alias runtest)
|
||||
> (deps
|
||||
> (:x test.ml))
|
||||
> (action
|
||||
> (diff? %{x} %{x}.corrected)))
|
||||
> EOF
|
||||
$ touch test.ml
|
||||
|
||||
$ dune runtest
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 2.8)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
(lang dune 2.8)
|
||||
(use_standard_c_and_cxx_flags true)
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
According to the doc: CC is the C compiler command line (list made of the
|
||||
compiler name followed by its flags) that was used to compile OCaml in the
|
||||
current build context.
|
||||
|
||||
In practice, in dune < 2.8 it consists in the concatenation of OCaml's
|
||||
`c_compiler` and flags. Theses flags are made of the :standard set of flags
|
||||
merged with (and sometimes replaced by) the flags in the env stanza.
|
||||
|
||||
$ O_CC=$(ocamlc -config-var c_compiler)
|
||||
$ O_CFLAGS=$(ocamlc -config-var ocamlc_cflags)
|
||||
$ O_CPPFLAGS=$(ocamlc -config-var ocamlc_cppflags)
|
||||
$ O_CC=$(echo $O_CC | sed -e 's/^[[:blank:]]*//')
|
||||
$ O_CFLAGS=$(echo $O_CFLAGS | sed -e 's/^[[:blank:]]*//')
|
||||
$ O_CPPFLAGS=$(echo $O_CPPFLAGS | sed -e 's/^[[:blank:]]*//')
|
||||
|
||||
No env
|
||||
$ cat > dune <<'EOF'
|
||||
> (rule
|
||||
> (alias cc)
|
||||
> (action (echo %{cc})))
|
||||
> EOF
|
||||
|
||||
$ dune build @cc | sed "s,${O_CC} ${O_CFLAGS},OK,"
|
||||
OK
|
||||
|
||||
With added env flags
|
||||
$ cat >> dune <<'EOF'
|
||||
> (env (_ (c_flags :standard -fPIC)))
|
||||
> EOF
|
||||
|
||||
$ dune build @cc | sed "s,${O_CC} ${O_CFLAGS} -fPIC,OK,"
|
||||
OK
|
||||
|
||||
With redefining env flags
|
||||
$ sed -i.bak "s/:standard //g" dune
|
||||
|
||||
$ dune build @cc | sed "s,${O_CC} -fPIC,OK,"
|
||||
OK
|
||||
|
||||
Since dune 2.8, when using the use_standard_c_and_cxx_flags option the :standard
|
||||
set of flag and thus the %{cc} variable contain both the cflags and cppflags
|
||||
from ocaml config. These flags are not added systematically anymore to the
|
||||
compiler command line.
|
||||
|
||||
$ cd new_ff_handling
|
||||
|
||||
No env
|
||||
$ cat > dune <<'EOF'
|
||||
> (rule
|
||||
> (alias cc28)
|
||||
> (action (echo %{cc})))
|
||||
> EOF
|
||||
|
||||
$ dune build @cc28 | sed "s,${O_CC} ${O_CFLAGS} ${O_CPPFLAGS} -Wall -fdiagnostics-color=always,OK,"
|
||||
OK
|
||||
|
||||
With added env flags
|
||||
$ cat >> dune <<'EOF'
|
||||
> (env (_ (c_flags :standard -fPIC)))
|
||||
> EOF
|
||||
|
||||
$ dune build @cc28 | sed "s,${O_CC} ${O_CFLAGS} ${O_CPPFLAGS} -Wall -fdiagnostics-color=always -fPIC,OK,"
|
||||
OK
|
||||
|
||||
With redefining env flags
|
||||
$ sed -i.bak "s/:standard //g" dune
|
||||
|
||||
$ dune build @cc28 | sed "s,${O_CC} -fPIC,OK,"
|
||||
OK
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
Test various aspect of variable resolution
|
||||
|
||||
$ test ()
|
||||
> {
|
||||
> cat >dune
|
||||
> echo
|
||||
> echo "*** Behavior with Dune 2.8 ***"
|
||||
> echo '(lang dune 2.8)' > dune-project
|
||||
> dune build
|
||||
> echo "exit code: $?"
|
||||
> echo
|
||||
> echo "*** Behavior with Dune 3.0 ***"
|
||||
> echo '(lang dune 3.0)' > dune-project
|
||||
> dune build
|
||||
> echo "exit code: $?"
|
||||
> }
|
||||
|
||||
Unknown variable:
|
||||
|
||||
$ test <<EOF
|
||||
> (alias
|
||||
> (name default)
|
||||
> (deps %{unknown}))
|
||||
> EOF
|
||||
|
||||
*** Behavior with Dune 2.8 ***
|
||||
File "dune", line 3, characters 7-17:
|
||||
3 | (deps %{unknown}))
|
||||
^^^^^^^^^^
|
||||
Error: Unknown variable %{unknown}
|
||||
exit code: 1
|
||||
|
||||
*** Behavior with Dune 3.0 ***
|
||||
File "dune", line 3, characters 7-17:
|
||||
3 | (deps %{unknown}))
|
||||
^^^^^^^^^^
|
||||
Error: Unknown variable %{unknown}
|
||||
exit code: 1
|
||||
|
||||
Unknown variable that we don't need to resolve:
|
||||
|
||||
$ test <<EOF
|
||||
> (alias
|
||||
> (name other)
|
||||
> (deps %{unknown}))
|
||||
> EOF
|
||||
|
||||
*** Behavior with Dune 2.8 ***
|
||||
exit code: 0
|
||||
|
||||
*** Behavior with Dune 3.0 ***
|
||||
File "dune", line 3, characters 7-17:
|
||||
3 | (deps %{unknown}))
|
||||
^^^^^^^^^^
|
||||
Error: Unknown variable %{unknown}
|
||||
exit code: 1
|
||||
|
||||
Specific variable used at the wrong place:
|
||||
|
||||
$ test <<EOF
|
||||
> (alias
|
||||
> (name default)
|
||||
> (deps %{library-name}))
|
||||
> EOF
|
||||
|
||||
*** Behavior with Dune 2.8 ***
|
||||
File "dune", line 3, characters 7-22:
|
||||
3 | (deps %{library-name}))
|
||||
^^^^^^^^^^^^^^^
|
||||
Error: %{library-name} isn't allowed in this position.
|
||||
exit code: 1
|
||||
|
||||
*** Behavior with Dune 3.0 ***
|
||||
File "dune", line 3, characters 7-22:
|
||||
3 | (deps %{library-name}))
|
||||
^^^^^^^^^^^^^^^
|
||||
Error: %{library-name} isn't allowed in this position.
|
||||
exit code: 1
|
||||
|
||||
Specific variable used at the wrong place that we don't need to
|
||||
resolve:
|
||||
|
||||
$ test <<EOF
|
||||
> (alias
|
||||
> (name other)
|
||||
> (deps %{library-name}))
|
||||
> EOF
|
||||
|
||||
*** Behavior with Dune 2.8 ***
|
||||
exit code: 0
|
||||
|
||||
*** Behavior with Dune 3.0 ***
|
||||
exit code: 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue