Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3347 #3352

Merged
2 commits merged into from Apr 9, 2020
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
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ Unreleased
- Add a `(subdir ..)` stanza to allow evaluating stanzas in sub directories.
(#3268, @rgrinberg)

- Fix a bug preventing one from running inline tests in multiple modes
(#3348, @diml)

2.4.0 (06/03/2020)
------------------

Expand Down
2 changes: 1 addition & 1 deletion src/dune/inline_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ include Sub_system.Register_end_point (struct
| Javascript -> Some "node"
in
SC.add_alias_action sctx ~dir ~loc:(Some info.loc) (Alias.runtest ~dir)
~stamp:("ppx-runner", name)
~stamp:("ppx-runner", name, mode)
(let exe =
Path.build (Path.Build.relative inline_test_dir (name ^ ext))
in
Expand Down
10 changes: 10 additions & 0 deletions test/blackbox-tests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,14 @@
test-cases/inline_tests
(progn (run dune-cram run run.t) (diff? run.t run.t.corrected)))))

(rule
(alias inline_tests-multi-mode)
(deps (package dune) (source_tree test-cases/inline_tests-multi-mode))
(action
(chdir
test-cases/inline_tests-multi-mode
(progn (run dune-cram run run.t) (diff? run.t run.t.corrected)))))

(rule
(alias install-dry-run)
(deps (package dune) (source_tree test-cases/install-dry-run))
Expand Down Expand Up @@ -2578,6 +2586,7 @@
(alias include-qualified)
(alias incremental-rebuilds)
(alias inline_tests)
(alias inline_tests-multi-mode)
(alias install-dry-run)
(alias install-libdir)
(alias install-mandir)
Expand Down Expand Up @@ -2861,6 +2870,7 @@
(alias include-qualified)
(alias incremental-rebuilds)
(alias inline_tests)
(alias inline_tests-multi-mode)
(alias install-mandir)
(alias install-multiple-contexts)
(alias install-partial-package)
Expand Down
35 changes: 35 additions & 0 deletions test/blackbox-tests/test-cases/inline_tests-multi-mode/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Test running inline tests in multiple modes at once

Reproduction case for #3347

$ cat >dune-project <<EOF
> (lang dune 2.0)
> EOF

$ cat >dune <<EOF
> (library
> (name test)
> (libraries test_backend)
> (modules test)
> (inline_tests (modes byte native)))
>
> (library
> (name test_backend)
> (modules ())
> (inline_tests.backend
> (generate_runner
> (progn
> (echo "Printf.eprintf \"Test %s\"\n")
> (echo " (match Sys.backend_type with")
> (echo " | Bytecode -> \"byte\"\n")
> (echo " | Native -> \"native\"\n")
> (echo " | Other s -> s)\n")))))
> EOF

$ touch test.ml

$ dune runtest
run alias runtest
Test byte
run alias runtest
Test native