From a2a1b21c8999313f60e37d706af9d3b462c212fc Mon Sep 17 00:00:00 2001 From: Lucas Pluvinage Date: Tue, 26 Jan 2021 00:14:30 +0100 Subject: [PATCH] Add failing test when cross-compiling with ppxs Signed-off-by: Lucas Pluvinage --- .../ppx-cross-context-issue.t/dune-project | 1 + .../ppx-cross-context-issue.t/dune-workspace | 7 +++++++ .../test-cases/ppx-cross-context-issue.t/lib/dune | 3 +++ .../ppx-cross-context-issue.t/lib/lib.ml | 0 .../test-cases/ppx-cross-context-issue.t/ppx/dune | 5 +++++ .../ppx-cross-context-issue.t/ppx/fooppx.ml | 0 .../test-cases/ppx-cross-context-issue.t/run.t | 14 ++++++++++++++ 7 files changed, 30 insertions(+) create mode 100644 test/blackbox-tests/test-cases/ppx-cross-context-issue.t/dune-project create mode 100644 test/blackbox-tests/test-cases/ppx-cross-context-issue.t/dune-workspace create mode 100644 test/blackbox-tests/test-cases/ppx-cross-context-issue.t/lib/dune create mode 100644 test/blackbox-tests/test-cases/ppx-cross-context-issue.t/lib/lib.ml create mode 100644 test/blackbox-tests/test-cases/ppx-cross-context-issue.t/ppx/dune create mode 100644 test/blackbox-tests/test-cases/ppx-cross-context-issue.t/ppx/fooppx.ml create mode 100644 test/blackbox-tests/test-cases/ppx-cross-context-issue.t/run.t diff --git a/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/dune-project b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/dune-project new file mode 100644 index 00000000000..c2e46604eed --- /dev/null +++ b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/dune-project @@ -0,0 +1 @@ +(lang dune 2.8) diff --git a/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/dune-workspace b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/dune-workspace new file mode 100644 index 00000000000..a3fcea1da67 --- /dev/null +++ b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/dune-workspace @@ -0,0 +1,7 @@ +(lang dune 2.0) + +(context (default)) + +(context (default + (name cross-environment) + (host default))) \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/lib/dune b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/lib/dune new file mode 100644 index 00000000000..e406eba77d7 --- /dev/null +++ b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/lib/dune @@ -0,0 +1,3 @@ +(library + (name foolib) + (preprocess (pps fooppx))) \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/lib/lib.ml b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/lib/lib.ml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/ppx/dune b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/ppx/dune new file mode 100644 index 00000000000..ce61f561fce --- /dev/null +++ b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/ppx/dune @@ -0,0 +1,5 @@ +(library + (name fooppx) + (enabled_if (= %{context_name} "default")) + (kind ppx_rewriter) + (libraries ppxlib)) diff --git a/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/ppx/fooppx.ml b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/ppx/fooppx.ml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/run.t b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/run.t new file mode 100644 index 00000000000..1f3a2e6f956 --- /dev/null +++ b/test/blackbox-tests/test-cases/ppx-cross-context-issue.t/run.t @@ -0,0 +1,14 @@ +# Using a ppx in a cross-compiled build context makes dune try to build the ppx +# in the target context instead of the host, then fail. + $ dune build --debug-dependency-path + File "lib/dune", line 3, characters 18-24: + 3 | (preprocess (pps fooppx))) + ^^^^^^ + Error: Library "fooppx" in _build/cross-environment/ppx is hidden + (unsatisfied 'enabled_if'). + -> required by lib/lib.pp.ml (context cross-environment) + -> required by alias lib/all (context cross-environment) + -> required by alias default (context cross-environment) + Hint: try: + dune external-lib-deps --missing --debug-dependency-path @@default + [1]