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

Misspelled dependency in benchmark causes unhelpful errors #10796

Open
noughtmare opened this issue Feb 20, 2025 · 1 comment
Open

Misspelled dependency in benchmark causes unhelpful errors #10796

noughtmare opened this issue Feb 20, 2025 · 1 comment
Labels
needs triage re: benchmarks Concerning building/running benchmarks re: error-message Concerning error messages delivered to the user type: bug

Comments

@noughtmare
Copy link
Collaborator

noughtmare commented Feb 20, 2025

Describe the bug
If you write an invalid name into the dependencies of a benchmark and run cabal bench, it will produce the following error:

Error: [Cabal-7093]
Cannot benchmark the package tmp-lme6AnaAzo-0.1.0.0 because none of the components are available to build: the benchmark 'tmp-lme6AnaAzo' is not available because the solver picked a plan that does not include the benchmarks, perhaps because no such plan exists. To see the error message explaining the problems with such plans, force the solver to include the benchmarks for all packages, by adding the line 'tests: True' to the 'cabal.project.local' file.

If you follow the advice and add tests: True in the cabal.project.local file, then the error does not change.

If you run cabal repl tmp-lme6AnaAzo:benchmarks, it will produce a similarly unhelpful error:

Error: [Cabal-7076]
Cannot open a repl for the benchmarks in the package tmp-lme6AnaAzo-0.1.0.0 because none of the components are available to build: the benchmark 'tmp-lme6AnaAzo' is not available because the solver picked a plan that does not include the benchmarks, perhaps because no such plan exists. To see the error message explaining the problems with such plans, force the solver to include the benchmarks for all packages, by adding the line 'tests: True' to the 'cabal.project.local' file.

To Reproduce
Steps to reproduce the behavior:

$ git clone https://github.com/noughtmare/tmp-lme6AnaAzo
$ cd tmp-lme6AnaAzo
$ cabal bench
$ cabal repl tmp-lme6AnaAzo:benchmarks

Expected behavior
Ideally, in both cases the error message would immediately produce the real error (which does get produced if you add benchmarks: True in the cabal.project.local file):

Error: [Cabal-7107]
Could not resolve dependencies:
[__0] trying: tmp-lme6AnaAzo-0.1.0.0 (user goal)
[__1] trying: tmp-lme6AnaAzo:*bench
[__2] unknown package: tmp-lme6AnaAz (dependency of tmp-lme6AnaAzo *bench)
[__2] fail (backjumping, conflict set: tmp-lme6AnaAz, tmp-lme6AnaAzo, tmp-lme6AnaAzo:bench)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: tmp-lme6AnaAzo, tmp-lme6AnaAzo:bench, tmp-lme6AnaAz

(The problem is that I removed the o at the end of the tmp-lme6AnaAz dependency name)

But if that is too hard, then I'd at least add to the error message that you should put benchmarks: True in your cabal.project.local file to force the benchmark to be included.

System information

  • Operating system: NixOS
  • cabal 3.14.1.0, ghc 9.6.6
@noughtmare noughtmare added needs triage type: bug re: error-message Concerning error messages delivered to the user re: benchmarks Concerning building/running benchmarks labels Feb 20, 2025
@ulysses4ever
Copy link
Collaborator

Hey @noughtmare! Thank you for the report!

For the tests: true part, this is a dup of #8537 #7524

Presumably, the second part (straight to the helpful error) would be solved if cabal bench implied benchmarks: true. A similar proposal for cabal test was discussed here: #7883

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage re: benchmarks Concerning building/running benchmarks re: error-message Concerning error messages delivered to the user type: bug
Projects
None yet
Development

No branches or pull requests

2 participants