From 042d106cf5bea3ef6b29186c2561490b8fa06136 Mon Sep 17 00:00:00 2001 From: Ambre Austen Suhamy Date: Tue, 22 Oct 2024 14:07:28 +0200 Subject: [PATCH 1/2] Added reproduction test case for missing dep Signed-off-by: Ambre Austen Suhamy --- .../test-cases/pkg/non-existent-dep.t | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 test/blackbox-tests/test-cases/pkg/non-existent-dep.t diff --git a/test/blackbox-tests/test-cases/pkg/non-existent-dep.t b/test/blackbox-tests/test-cases/pkg/non-existent-dep.t new file mode 100644 index 00000000000..636b8cfae7e --- /dev/null +++ b/test/blackbox-tests/test-cases/pkg/non-existent-dep.t @@ -0,0 +1,110 @@ +A package depending on a package that doesn't exist. +The solver should give a more sane error message. + + $ cat > dune-project << EOF + > (lang dune 3.15) + > (name abc) + > (package + > (name abc) + > (synopsis "A short synopsis") + > (description "A longer description") + > (depends + > ocaml + > dune + > base + > re + > unix + > foobar + > core + > core_unix + > ocamlformat + > ocamlformat-lib) + > (tags + > (topics "to describe" your project))) + > EOF + + $ dune pkg lock + Error: Unable to solve dependencies for the following lock directories: + Lock directory dune.lock: + Can't find all required versions. + Selected: abc.dev base.v0.17.1 base-threads.base base-unix.base + base_bigstring.v0.17.0 base_quickcheck.v0.17.0 bin_prot.v0.17.0 + capitalization.v0.17.0 cmdliner.1.3.0 core.v0.17.1 + core_kernel.v0.17.0 core_unix.v0.17.0 csexp.1.5.2 + dune-configurator.3.16.0 expect_test_helpers_core.v0.17.0 + fieldslib.v0.17.0 gel.v0.17.0 int_repr.v0.17.0 + jane-street-headers.v0.17.0 jst-config.v0.17.0 num.1.5-1 + ocaml.5.4.0 ocaml-config.3 ocaml_intrinsics_kernel.v0.17.1 + ocamlformat.0.26.2 parsexp.v0.17.0 ppx_assert.v0.17.0 + ppx_base.v0.17.0 ppx_bench.v0.17.0 ppx_cold.v0.17.0 + ppx_compare.v0.17.0 ppx_custom_printf.v0.17.0 ppx_diff.v0.17.0 + ppx_disable_unused_warnings.v0.17.0 ppx_enumerate.v0.17.0 + ppx_expect.v0.17.2 ppx_fields_conv.v0.17.0 + ppx_fixed_literal.v0.17.0 ppx_hash.v0.17.0 ppx_here.v0.17.0 + ppx_ignore_instrumentation.v0.17.0 ppx_inline_test.v0.17.0 + ppx_jane.v0.17.0 ppx_let.v0.17.0 ppx_log.v0.17.0 + ppx_module_timer.v0.17.0 ppx_optcomp.v0.17.0 ppx_optional.v0.17.0 + ppx_pipebang.v0.17.0 ppx_sexp_conv.v0.17.0 ppx_sexp_message.v0.17.0 + ppx_sexp_value.v0.17.0 ppx_stable.v0.17.0 + ppx_stable_witness.v0.17.0 ppx_string.v0.17.0 + ppx_string_conv.v0.17.0 ppx_tydi.v0.17.0 ppx_typerep_conv.v0.17.0 + ppx_variants_conv.v0.17.0 ppxlib_jane.v0.17.1 re.1.12.0 seq.base + sexp_pretty.v0.17.0 sexplib.v0.17.0 sexplib0.v0.17.0 spawn.v0.15.1 + splittable_random.v0.17.0 stdio.v0.17.0 time_now.v0.17.0 + timezone.v0.17.0 uopt.v0.17.0 variantslib.v0.17.0 + ocaml-base-compiler ocaml-base-compiler ocaml + - dune -> dune.3.16.0 + User requested = 3.17 + - foobar -> (problem) + No known implementations at all + - ocaml-base-compiler -> (problem) + Rejected candidates: + ocaml-base-compiler.5.2.0: Requires ocaml = 5.2.0 + ocaml-base-compiler.5.1.1: Requires ocaml = 5.1.1 + ocaml-base-compiler.5.1.0: Requires ocaml = 5.1.0 + ocaml-base-compiler.5.0.0: Requires ocaml = 5.0.0 + ocaml-base-compiler.4.14.2: Requires ocaml = 4.14.2 + ... + - ocamlformat-lib -> (problem) + ocamlformat 0.26.2 requires = 0.26.2 + Rejected candidates: + ocamlformat-lib.0.26.2: Requires ocaml >= 4.08 & < 5.3 + ocamlformat-lib.0.26.1: Incompatible with restriction: = 0.26.2 + ocamlformat-lib.0.26.0: Incompatible with restriction: = 0.26.2 + ocamlformat-lib.0.25.1: Incompatible with restriction: = 0.26.2 + - ppx_bin_prot -> (problem) + Rejected candidates: + ppx_bin_prot.v0.17.0: Requires ppxlib_jane >= v0.17 & < v0.17.1 + ppx_bin_prot.v0.16.0: Requires base >= v0.16 & < v0.17 + ppx_bin_prot.v0.15.0: Requires base >= v0.15 & < v0.16 + ppx_bin_prot.v0.14.0: Requires base >= v0.14 & < v0.15 + ppx_bin_prot.v0.13.0: Requires base >= v0.13 & < v0.14 + ... + - ppx_globalize -> (problem) + ppx_base v0.17.0 requires >= v0.17 & < v0.18 + Rejected candidates: + ppx_globalize.v0.17.0: Requires ocaml >= 5.1.0 & < 5.3 + ppx_globalize.v0.16.0: Incompatible with restriction: >= v0.17 & < + v0.18 + - ppxlib -> (problem) + base_quickcheck v0.17.0 requires >= 0.28.0 + Rejected candidates: + ppxlib.0.33.0: Requires ocaml >= 4.04.1 & < 5.3.0 + ppxlib.0.32.1: Requires ocaml >= 4.04.1 & < 5.3.0 + ppxlib.0.32.0: Requires ocaml >= 4.04.1 & < 5.2.0 & <> 5.1.0~alpha1 + ppxlib.0.31.0: Requires ocaml >= 4.04.1 & < 5.2.0 & <> 5.1.0~alpha1 + ppxlib.0.30.0: Requires ocaml >= 4.04.1 & < 5.2.0 & <> 5.1.0~alpha1 + ... + - typerep -> (problem) + core v0.17.1 requires >= v0.17 & < v0.18 + Rejected candidates: + typerep.v0.17.0: Requires ocaml >= 5.1.0 & < 5.3 + typerep.v0.16.0: Incompatible with restriction: >= v0.17 & < v0.18 + typerep.v0.15.0: Incompatible with restriction: >= v0.17 & < v0.18 + typerep.v0.14.0: Incompatible with restriction: >= v0.17 & < v0.18 + typerep.v0.13.0: Incompatible with restriction: >= v0.17 & < v0.18 + ... + - unix -> (problem) + No known implementations at all + [1] +The problem with unix and foobar seems important enough to not show the wall of text above... From 228cf0efc2cd4853c4bdd657cce64f1833f9397a Mon Sep 17 00:00:00 2001 From: Ambre Austen Suhamy Date: Tue, 22 Oct 2024 17:26:40 +0200 Subject: [PATCH 2/2] Use mock opam repo in tests Signed-off-by: Ambre Austen Suhamy --- .../test-cases/pkg/non-existent-dep.t | 127 +++++------------- 1 file changed, 33 insertions(+), 94 deletions(-) diff --git a/test/blackbox-tests/test-cases/pkg/non-existent-dep.t b/test/blackbox-tests/test-cases/pkg/non-existent-dep.t index 636b8cfae7e..029ee21b499 100644 --- a/test/blackbox-tests/test-cases/pkg/non-existent-dep.t +++ b/test/blackbox-tests/test-cases/pkg/non-existent-dep.t @@ -1,110 +1,49 @@ A package depending on a package that doesn't exist. The solver should give a more sane error message. +A few packages here so the errors get large. + $ . ./helpers.sh + $ mkrepo + $ add_mock_repo_if_needed + $ mkpkg a 0.0.1 + $ mkpkg a 0.0.2 + $ mkpkg a 0.1.0 + $ mkpkg b 0.0.1 + $ mkpkg c 0.0.1 << EOF + > depends: [ "b" "a" {< "0.1.0"}] + > EOF + $ mkpkg d 0.0.1 << EOF + > depends: [ "a" {>= "0.0.1"} "b"] + > EOF + $ mkpkg e 0.0.1 + $ mkpkg e 0.1.0 + $ mkpkg e 0.1.1 + $ cat > dune-project << EOF > (lang dune 3.15) > (name abc) > (package - > (name abc) - > (synopsis "A short synopsis") - > (description "A longer description") - > (depends - > ocaml - > dune - > base - > re - > unix - > foobar - > core - > core_unix - > ocamlformat - > ocamlformat-lib) - > (tags - > (topics "to describe" your project))) + > (name abc) + > (depends + > a + > b + > c + > d + > (e (= 0.1.0)) + > foobar)) > EOF $ dune pkg lock Error: Unable to solve dependencies for the following lock directories: Lock directory dune.lock: Can't find all required versions. - Selected: abc.dev base.v0.17.1 base-threads.base base-unix.base - base_bigstring.v0.17.0 base_quickcheck.v0.17.0 bin_prot.v0.17.0 - capitalization.v0.17.0 cmdliner.1.3.0 core.v0.17.1 - core_kernel.v0.17.0 core_unix.v0.17.0 csexp.1.5.2 - dune-configurator.3.16.0 expect_test_helpers_core.v0.17.0 - fieldslib.v0.17.0 gel.v0.17.0 int_repr.v0.17.0 - jane-street-headers.v0.17.0 jst-config.v0.17.0 num.1.5-1 - ocaml.5.4.0 ocaml-config.3 ocaml_intrinsics_kernel.v0.17.1 - ocamlformat.0.26.2 parsexp.v0.17.0 ppx_assert.v0.17.0 - ppx_base.v0.17.0 ppx_bench.v0.17.0 ppx_cold.v0.17.0 - ppx_compare.v0.17.0 ppx_custom_printf.v0.17.0 ppx_diff.v0.17.0 - ppx_disable_unused_warnings.v0.17.0 ppx_enumerate.v0.17.0 - ppx_expect.v0.17.2 ppx_fields_conv.v0.17.0 - ppx_fixed_literal.v0.17.0 ppx_hash.v0.17.0 ppx_here.v0.17.0 - ppx_ignore_instrumentation.v0.17.0 ppx_inline_test.v0.17.0 - ppx_jane.v0.17.0 ppx_let.v0.17.0 ppx_log.v0.17.0 - ppx_module_timer.v0.17.0 ppx_optcomp.v0.17.0 ppx_optional.v0.17.0 - ppx_pipebang.v0.17.0 ppx_sexp_conv.v0.17.0 ppx_sexp_message.v0.17.0 - ppx_sexp_value.v0.17.0 ppx_stable.v0.17.0 - ppx_stable_witness.v0.17.0 ppx_string.v0.17.0 - ppx_string_conv.v0.17.0 ppx_tydi.v0.17.0 ppx_typerep_conv.v0.17.0 - ppx_variants_conv.v0.17.0 ppxlib_jane.v0.17.1 re.1.12.0 seq.base - sexp_pretty.v0.17.0 sexplib.v0.17.0 sexplib0.v0.17.0 spawn.v0.15.1 - splittable_random.v0.17.0 stdio.v0.17.0 time_now.v0.17.0 - timezone.v0.17.0 uopt.v0.17.0 variantslib.v0.17.0 - ocaml-base-compiler ocaml-base-compiler ocaml - - dune -> dune.3.16.0 - User requested = 3.17 - - foobar -> (problem) - No known implementations at all - - ocaml-base-compiler -> (problem) + Selected: a.0.1.0 abc.dev b.0.0.1 d.0.0.1 + - c -> (problem) Rejected candidates: - ocaml-base-compiler.5.2.0: Requires ocaml = 5.2.0 - ocaml-base-compiler.5.1.1: Requires ocaml = 5.1.1 - ocaml-base-compiler.5.1.0: Requires ocaml = 5.1.0 - ocaml-base-compiler.5.0.0: Requires ocaml = 5.0.0 - ocaml-base-compiler.4.14.2: Requires ocaml = 4.14.2 - ... - - ocamlformat-lib -> (problem) - ocamlformat 0.26.2 requires = 0.26.2 - Rejected candidates: - ocamlformat-lib.0.26.2: Requires ocaml >= 4.08 & < 5.3 - ocamlformat-lib.0.26.1: Incompatible with restriction: = 0.26.2 - ocamlformat-lib.0.26.0: Incompatible with restriction: = 0.26.2 - ocamlformat-lib.0.25.1: Incompatible with restriction: = 0.26.2 - - ppx_bin_prot -> (problem) - Rejected candidates: - ppx_bin_prot.v0.17.0: Requires ppxlib_jane >= v0.17 & < v0.17.1 - ppx_bin_prot.v0.16.0: Requires base >= v0.16 & < v0.17 - ppx_bin_prot.v0.15.0: Requires base >= v0.15 & < v0.16 - ppx_bin_prot.v0.14.0: Requires base >= v0.14 & < v0.15 - ppx_bin_prot.v0.13.0: Requires base >= v0.13 & < v0.14 - ... - - ppx_globalize -> (problem) - ppx_base v0.17.0 requires >= v0.17 & < v0.18 - Rejected candidates: - ppx_globalize.v0.17.0: Requires ocaml >= 5.1.0 & < 5.3 - ppx_globalize.v0.16.0: Incompatible with restriction: >= v0.17 & < - v0.18 - - ppxlib -> (problem) - base_quickcheck v0.17.0 requires >= 0.28.0 - Rejected candidates: - ppxlib.0.33.0: Requires ocaml >= 4.04.1 & < 5.3.0 - ppxlib.0.32.1: Requires ocaml >= 4.04.1 & < 5.3.0 - ppxlib.0.32.0: Requires ocaml >= 4.04.1 & < 5.2.0 & <> 5.1.0~alpha1 - ppxlib.0.31.0: Requires ocaml >= 4.04.1 & < 5.2.0 & <> 5.1.0~alpha1 - ppxlib.0.30.0: Requires ocaml >= 4.04.1 & < 5.2.0 & <> 5.1.0~alpha1 - ... - - typerep -> (problem) - core v0.17.1 requires >= v0.17 & < v0.18 - Rejected candidates: - typerep.v0.17.0: Requires ocaml >= 5.1.0 & < 5.3 - typerep.v0.16.0: Incompatible with restriction: >= v0.17 & < v0.18 - typerep.v0.15.0: Incompatible with restriction: >= v0.17 & < v0.18 - typerep.v0.14.0: Incompatible with restriction: >= v0.17 & < v0.18 - typerep.v0.13.0: Incompatible with restriction: >= v0.17 & < v0.18 - ... - - unix -> (problem) + c.0.0.1: Requires a < 0.1.0 + - e -> e.0.1.0 + abc dev requires = 0.1.0 + - foobar -> (problem) No known implementations at all [1] -The problem with unix and foobar seems important enough to not show the wall of text above... +The problem with foobar seems important enough to not show the wall of text above...