haskell / haskell/cabal

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

Open
#4,619 8 comments 0 reactions 1 assignee Claimed by @fgaz View on GitHub
cabal-install: v2-build system type: assertion-fail type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

First reported [here](https://github.com/haskell/cabal/pull/4607#discussion_r128106006). 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`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.