ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.6k stars 398 forks source link

Failed to pass tests: "The selected switch default is not installed" #3008

Open voodoos opened 4 years ago

voodoos commented 4 years ago

After building Dune master, test suite fails to execute on my mac.

Failing test is blackbox-tests/test-cases/env/envs-and-contexts.

Steps to reproduce on macOS Mojave 10.14.5:

Error:

--- a/test/blackbox-tests/test-cases/env/envs-and-contexts/run.t
+++ b/test/blackbox-tests/test-cases/env/envs-and-contexts/run.t.corrected
@@ -1,25 +1,10 @@
 Regression test for https://github.com/ocaml/dune/issues/1016#issuecomment-411390740

   $ dune printenv
-  Environment for context dev:
-
-     ((flags (dev-flags))
-      (ocamlc_flags (-g))
-      (ocamlopt_flags (-g))
-      (c_flags
-       ($flags))
-      (cxx_flags
-       ($flags)))
-
-
-  Environment for context release:
-
-     ((flags (release-flags))
-      (ocamlc_flags (-g))
-      (ocamlopt_flags (-g))
-      (c_flags
-       ($flags))
-      (cxx_flags
-       ($flags)))
-
-
+          opam (internal) (exit 2)
+  /usr/local/bin/opam config env --switch default --sexp --set-switch > /var/folders/qp/fdb35yvx6j1ggk6nww5lg6yr0000gn/T/dune5a1baa.output
+  [ERROR] The selected switch default is not installed.
+          opam (internal) (exit 2)
+  /usr/local/bin/opam config env --switch default --sexp --set-switch > /var/folders/qp/fdb35yvx6j1ggk6nww5lg6yr0000gn/T/dune51660c.output
+  [ERROR] The selected switch default is not installed.
+  [1]

Unsatisfing fix:

Create a global switch named default: opam switch create default ocaml-base-compiler.4.09.0

rgrinberg commented 4 years ago

In the short term, we can disable this test. In the long term, it would be nice to define build contexts entirely within dune workspace files. Once this is possible, we can use this functionality instead of relying on a corresponding opam switch existing.