Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ Unreleased

- Introduce mdx stanza 0.2, requiring mdx >= 1.9.0, with a new generic `deps`
field and the possibility to statically link `libraries` in the test
executable. (#3956, fixes #3955)
executable. (#3956, #5391, fixes #3955)

- Improve lookup of optional or disabled binaries. Previously, we'd treat every
executable with missing libraries as optional. Now, we treat make sure to
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ core_bench \
"csexp>=1.3.0" \
js_of_ocaml \
js_of_ocaml-compiler \
mdx \
"mdx>=2.1.0" \
menhir \
"merlin>=3.4.0" \
ocamlfind \
Expand Down
2 changes: 2 additions & 0 deletions src/dune_rules/mdx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ let gen_rules_for_single_file stanza ~sctx ~dir ~expander ~mdx_prog
Dep_conf_eval.unnamed ~expander (mdx_package_deps @ mdx_generic_deps)
in
Action_builder.with_no_targets deps
>>> Action_builder.with_no_targets
(Action_builder.env_var "MDX_RUN_NON_DETERMINISTIC")
>>> Action_builder.with_no_targets (Action_builder.dyn_deps dyn_deps)
>>> Command.run ~dir:(Path.build dir) ~stdout_to:files.corrected
executable command_line
Expand Down
59 changes: 59 additions & 0 deletions test/blackbox-tests/test-cases/mdx-stanza/env-variables.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Dune should know about the fact that mdx reads the MDX_RUN_NON_DETERMINISTIC
variable. When using the stanza 0.2, it is the mdx driver that reads that
variable. This is only the case since mdx 2.1.0.

$ cat > dune-project << EOF
> (lang dune 3.0)
> (using mdx 0.2)
> EOF

$ cat > dune << EOF
> (mdx (files README.md))
> EOF

$ cat > README.md << 'EOF'
> ```ocaml
> # "a";;
> ```
>
> ```ocaml non-deterministic
> # "b";;
> ```
> EOF

$ dune runtest --auto-promote
File "README.md", line 1, characters 0-0:
Error: Files _build/default/README.md and
_build/default/.mdx/README.md.corrected differ.
Promoting _build/default/.mdx/README.md.corrected to README.md.
[1]

$ cat README.md
```ocaml
# "a";;
- : string = "a"
```

```ocaml non-deterministic
# "b";;
```

$ dune runtest

$ MDX_RUN_NON_DETERMINISTIC=1 dune runtest --auto-promote
File "README.md", line 1, characters 0-0:
Error: Files _build/default/README.md and
_build/default/.mdx/README.md.corrected differ.
Promoting _build/default/.mdx/README.md.corrected to README.md.
[1]

$ cat README.md
```ocaml
# "a";;
- : string = "a"
```

```ocaml non-deterministic
# "b";;
- : string = "b"
```