From d6e9787d7f2e5b9146e125879b2aa5873df64889 Mon Sep 17 00:00:00 2001 From: Alpha DIALLO Date: Wed, 4 Sep 2024 18:42:37 +0200 Subject: [PATCH] fix: enabled_if with `dune describe` Fixes #10779. Signed-off-by: Alpha DIALLO --- bin/describe/describe_workspace.ml | 9 +++++++-- .../{eif-dune-describe-crash.t => eif-dune-describe.t} | 10 ++++------ 2 files changed, 11 insertions(+), 8 deletions(-) rename test/blackbox-tests/test-cases/enabled_if/{eif-dune-describe-crash.t => eif-dune-describe.t} (61%) diff --git a/bin/describe/describe_workspace.ml b/bin/describe/describe_workspace.ml index f405e0c9861d..08278c0be1a6 100644 --- a/bin/describe/describe_workspace.ml +++ b/bin/describe/describe_workspace.ml @@ -562,8 +562,13 @@ module Crawl = struct (Context.build_dir context) (Dune_file.dir dune_file) in - let project = Dune_file.project dune_file in - executables sctx ~options ~project ~dir exes + let* expander = Super_context.expander sctx ~dir in + Expander.eval_blang expander exes.enabled_if + >>= (function + | false -> Memo.return None + | true -> + let project = Dune_file.project dune_file in + executables sctx ~options ~project ~dir exes) | _ -> Memo.return None) >>| List.filter_opt) >>| List.concat diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-dune-describe-crash.t b/test/blackbox-tests/test-cases/enabled_if/eif-dune-describe.t similarity index 61% rename from test/blackbox-tests/test-cases/enabled_if/eif-dune-describe-crash.t rename to test/blackbox-tests/test-cases/enabled_if/eif-dune-describe.t index 273b7a7a82ae..edaa41ca97e9 100644 --- a/test/blackbox-tests/test-cases/enabled_if/eif-dune-describe-crash.t +++ b/test/blackbox-tests/test-cases/enabled_if/eif-dune-describe.t @@ -24,9 +24,7 @@ $ dune build $ dune runtest - $ dune describe 2>&1 | head -n 5 - Internal error, please report upstream including the contents of _build/log. - Description: - ("modules_and_obj_dir: failed lookup", - { keys = []; for_ = Exe { first_exe = "test" } }) - Raised at Stdune__Code_error.raise in file + $ dune describe 2>&1 + ((root + $TESTCASE_ROOT) + (build_context _build/default))