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

Enabling tests via cabal config triggers internal error when building them #10795

Open
edmundnoble opened this issue Feb 17, 2025 · 6 comments
Open
Labels
cabal-install: nix-local-build re: config-file Concerning the cabal configuration file and the `--config-file` option type: bug

Comments

@edmundnoble
Copy link
Contributor

Describe the bug
cabal crashes attempting to build tests when tests are enabled via cabal config, but not when enabled with the --enable-tests CLI flag.

To Reproduce
Steps to reproduce the behavior:

$ git clone https://github.com/well-typed/ixset-typed.git
$ echo 'tests: True' >> ~/.cabal/config
$ cabal run tests
Resolving dependencies...
componentAvailableTargetStatus: impossible; cname=test:test-ixset-typed
CallStack (from HasCallStack):
  error, called at src/Distribution/Client/ProjectPlanning.hs:3028:15 in cabal-install-3.12.1.0-inplace:Distribution.Client.ProjectPlanning

Expected behavior
The tests should be built and run successfully, as they are with cabal run tests --enable-tests.

System information

  • Gentoo 6.6.62
  • cabal 3.12.1.0
  • ghc 9.8.2
@ulysses4ever
Copy link
Collaborator

@edmundnoble thank you for the report! Can you, please, try the latest version of cabal (3.14.1.1, available via ghcup)?

@ulysses4ever ulysses4ever added cabal-install: nix-local-build re: config-file Concerning the cabal configuration file and the `--config-file` option and removed needs triage labels Feb 18, 2025
@qxrein
Copy link

qxrein commented Feb 18, 2025

ixset-typed master via λ 9.6.6 took 5s
❯ : cabal -V
cabal-install version 3.12.1.0
compiled using version 3.12.1.0 of the Cabal library

@edmundnoble are you sure? I am using the same version of cabal and it passes all 22 tests. Maybe there could be some issues in [Portage] declaration.

@edmundnoble
Copy link
Contributor Author

edmundnoble commented Feb 18, 2025

ixset-typed master via λ 9.6.6 took 5s
❯ : cabal -V
cabal-install version 3.12.1.0
compiled using version 3.12.1.0 of the Cabal library

@edmundnoble are you sure? I am using the same version of cabal and it passes all 22 tests. Maybe there could be some issues in [Portage] declaration.

I am using cabal installed via ghcup, so I can't see why Portage would be an issue. Also, I see that you're using GHC 9.6.6; the error remains when I use GHC 9.6.6.

@edmundnoble
Copy link
Contributor Author

@edmundnoble thank you for the report! Can you, please, try the latest version of cabal (3.14.1.1, available via ghcup)?

I see the same issue with cabal 3.14.1.1 via ghcup.

@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Feb 22, 2025

I can reproduce it locally. Here's a stack trace from profiling build of cabal-head:

$c run tests -j1
Warning: this is a debug build of cabal-install with assertions enabled.
Configuration is affected by the following files:
- cabal.project
componentAvailableTargetStatus: impossible; cname=test:test-ixset-typed
CallStack (from HasCallStack):
  error, called at src/Distribution/Client/ProjectPlanning.hs:3192:15 in cabal-install-3.15.0.0-inplace:Distribution.Client.ProjectPlanning
CallStack (from -prof):
  Distribution.Client.ProjectPlanning.availableTargets (src/Distribution/Client/ProjectPlanning.hs:(3046,1)-(3068,9))
  Distribution.Client.ProjectOrchestration.resolveTargets (src/Distribution/Client/ProjectOrchestration.hs:(624,1)-(738,28))
  Distribution.Client.ProjectOrchestration.runProjectPreBuildPhase (src/Distribution/Client/ProjectOrchestration.hs:(385,1)-(439,9))
  Distribution.Client.ScriptUtils.withContextAndSelectors (src/Distribution/Client/ScriptUtils.hs:(298,1)-(399,55))
  Distribution.Client.CmdRun.runAction (src/Distribution/Client/CmdRun.hs:(208,1)-(363,47))
  Distribution.Simple.Command.commandAddAction (src/Distribution/Simple/Command.hs:(634,1)-(643,27))
  Distribution.Client.CmdLegacy.newCmd (src/Distribution/Client/CmdLegacy.hs:(164,1)-(184,9))
  Distribution.Simple.Command.commandFromSpec (src/Distribution/Simple/Command.hs:801:1-53)
  Distribution.Simple.Utils.topHandlerWith (src/Distribution/Simple/Utils.hs:(506,1)-(550,41))
  Distribution.Simple.Utils.topHandler (src/Distribution/Simple/Utils.hs:557:1-72)
  Distribution.Client.Main.main (src/Distribution/Client/Main.hs:(296,1)-(313,52))
  Main.main (main/Main.hs:11:1-30)

availableTargets has several lengthy comments. My hunch is that it's a dark corner of the past. @edmundnoble did it use to work for you at any point? I'd be surprised if it's a regression...

@edmundnoble
Copy link
Contributor Author

I haven't tried this before @ulysses4ever as far as I know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cabal-install: nix-local-build re: config-file Concerning the cabal configuration file and the `--config-file` option type: bug
Projects
None yet
Development

No branches or pull requests

3 participants