Skip to content

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

Open

Description

@23Skidoo

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.

Activity

  1. added
    cabal-install: v2-build system
    on Jul 21, 2017
  2. dmwit commented on Jul 21, 2017

    @dmwit
    Collaborator

    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.

  3. 23Skidoo commented on Jul 21, 2017

    @23Skidoo
    MemberAuthor

    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.

  4. 23Skidoo commented on Jul 21, 2017

    @23Skidoo
    MemberAuthor

    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: */
  5. 23Skidoo commented on Jul 21, 2017

    @23Skidoo
    MemberAuthor

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

  6. fgaz commented on Jul 23, 2017

    @fgaz
    Member

    Closing in favor of #4621

  7. 23Skidoo commented on Jul 23, 2017

    @23Skidoo
    MemberAuthor

    @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.

  8. fgaz commented on Jul 23, 2017

    @fgaz
    Member

    Ah sorry, I assumed it was normal.

  9. added
    type: assertion-fail
    on Oct 27, 2018
  10. Mikolaj commented on Mar 22, 2022

    @Mikolaj
    Member

    This may be related to #6006.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cabal-install: v2-build systemtype: assertion-failtype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions