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

'cabal new-test' seems to be confused by non-trivial project structure #4619

Open
23Skidoo opened this issue Jul 21, 2017 · 8 comments
Open
Assignees
Labels
cabal-install: nix-local-build type: assertion-fail NB: assertions are only enabled in devel-builds type: bug

Comments

@23Skidoo
Copy link
Member

23Skidoo commented Jul 21, 2017

First reported here. With a recent snapshot from master and using the cabal repo itself as a test project:

~/code/haskell/cabal[master]$ cabal new-test                    
cabal: No targets given and there is no package in the current directory. Use
the target 'all' for all packages in the project or specify packages or
components by name or location. See 'cabal build --help' for more details on
target options.

~/code/haskell/cabal[master]$ cabal new-test cabal-install
cabal: Cannot test the package cabal-install-2.1.0.0 because none of the
components are available to build: the test suite 'unit-tests', the test suite
'solver-quickcheck', the test suite 'memory-usage-tests' and the test suite
'integration-tests2' are all marked as 'buildable: False'

~/code/haskell/cabal[master]$ cabal new-test cabal-install:unit-tests               
cabal: Cannot run the test suite 'unit-tests' because it is marked as
'buildable: False' within the 'cabal-install.cabal' file (at least for the
current configuration). If you believe it should be buildable then check the
.cabal file to see if the buildable property is conditional on flags.
Alternatively you may simply have to edit the .cabal file to declare it as
buildable and fix any resulting build problems.

~/code/haskell/cabal[master]$ cabal new-test cabal-install:unit-tests --enable-tests
cabal: Cannot run the test suite 'unit-tests' because it is marked as
'buildable: False' within the 'cabal-install.cabal' file (at least for the
current configuration). If you believe it should be buildable then check the
.cabal file to see if the buildable property is conditional on flags.
Alternatively you may simply have to edit the .cabal file to declare it as
buildable and fix any resulting build problems.

~/code/haskell/cabal[master]$ cabal new-configure --enable-tests   
'cabal.project.local' file already exists. Now overwriting it.
In order, the following would be built (use -v for more details):
Assertion failed
CallStack (from HasCallStack):
  assert, called at ./Distribution/Client/ProjectPlanning.hs:280:5 in main:Distribution.Client.ProjectPlanning

Probably applies to new-bench too (or rather will do, once #4614 is merged). @fgaz, I think this is something that you can look into now that you're finished with new-run.

@dmwit
Copy link
Collaborator

dmwit commented Jul 21, 2017

For what it's worth: the first one appears consistent with other new-* commands. The next few I can't reproduce. The last one seems like a genuine bug, though.

@23Skidoo
Copy link
Member Author

Just tried with the latest snapshot:

$ cabal --version
cabal-install version 2.1.0.0
compiled using version 2.1.0.0 of the Cabal library

Still can reproduce them all. I'll delete dist-newstyle and try again.

@23Skidoo
Copy link
Member Author

Note that I have a slightly patched cabal.project:

diff --git a/cabal.project b/cabal.project
index e6899cb7d..02c716f65 100644
--- a/cabal.project
+++ b/cabal.project
@@ -1,6 +1,6 @@
 packages: Cabal/ cabal-testsuite/ cabal-install/
-constraints: unix >= 2.7.1.0,
-             cabal-install +lib +monolithic
+constraints: unix >= 2.7.1.0
+--             cabal-install +lib +monolithic
 
 -- Uncomment to allow picking up extra local unpacked deps:
 --optional-packages: */

@23Skidoo
Copy link
Member Author

It seems to work if I unapply this patch, at least it starts the build process.

@fgaz
Copy link
Member

fgaz commented Jul 23, 2017

Closing in favor of #4621

@fgaz fgaz closed this as completed Jul 23, 2017
@23Skidoo
Copy link
Member Author

@fgaz

You can reproduce the issue if you apply the patch from #4619 (comment) to cabal.project. I don't think that the behaviour in this case is correct right now, but I may be wrong.

@23Skidoo 23Skidoo reopened this Jul 23, 2017
@fgaz
Copy link
Member

fgaz commented Jul 23, 2017

Ah sorry, I assumed it was normal.

@hvr hvr added the type: assertion-fail NB: assertions are only enabled in devel-builds label Oct 27, 2018
@Mikolaj
Copy link
Member

Mikolaj commented Mar 22, 2022

This may be related to #6006.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cabal-install: nix-local-build type: assertion-fail NB: assertions are only enabled in devel-builds type: bug
Projects
None yet
Development

No branches or pull requests

5 participants