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

Support pure test packages #1186

Closed
UnkindPartition opened this issue Jan 25, 2013 · 3 comments
Closed

Support pure test packages #1186

UnkindPartition opened this issue Jan 25, 2013 · 3 comments

Comments

@UnkindPartition
Copy link
Contributor

Currently if I have a package description file that defines just a test suite (without a library), I get the message

% cabal configure --enable-tests
Resolving dependencies...
Configuring smallcheck-tests-0.7...
cabal: No executables and no library found. Nothing to do.

I suppose there are no technical issues with building and running such tests?

The reason I want to do this is that the test for smallcheck also depends on test-framework-smallcheck, which in turn depends on smallcheck. If I put the test suite description into smallcheck.cabal, the build command will produce the following error:

'/opt/ghc762rc/bin/ghc' '--make' '-no-link' '-fbuilding-cabal-package' '-O' '-static' '-odir' 'dist/build/test/test-tmp' '-hidir' 'dist/build/test/test-tmp' '-stubdir' 'dist/build/test/test-tmp' '-i' '-idist/build/test/test-tmp' '-itest' '-idist/build/autogen' '-Idist/build/autogen' '-Idist/build/test/test-tmp' '-optP-include' '-optPdist/build/autogen/cabal_macros.h' '-hide-all-packages' '-package-db' 'dist/package.conf.inplace' '-package-id' 'base-4.6.0.1-4957e18cdbf85bf6a8e2f1860a9aa808' '-package-id' 'test-framework-0.8-0ce644c59b770473a8dff65350e80268' '-package-id' 'test-framework-smallcheck-0.2-c3c898b7eb147b3e3fd55e4e402b186d' '-package-id' 'smallcheck-0.7-inplace' '-XHaskell98' 'test/test.hs'
<command line>: cannot satisfy -package-id smallcheck-0.7-inplace: 
    smallcheck-0.7-inplace is shadowed by package smallcheck-0.7-531c49bb37bfd4fbc8779021d10a9776
    (use -v for more information)
@ttuegel ttuegel added this to the _|_ milestone Apr 23, 2015
@ttuegel ttuegel modified the milestones: Cabal-1.24, _|_ Jun 26, 2015
@ttuegel
Copy link
Member

ttuegel commented Jun 26, 2015

This would be helpful to resolve #960.

@BardurArantsson This would be a good task for a newcomer. There isn't any technical problem to resolve here, it's just a matter of flipping a switch in the source code.

@ttuegel
Copy link
Member

ttuegel commented Jun 30, 2015

Here are a few notes about what must be done before we close this issue.

  • Relax the constraint which requires a library or an executable to be defined in the package description. The package description should be considered valid if a library, an executable, a test, or a benchmark is defined.
  • Trying to install a pure test or pure benchmark package should exit with a "nothing to do" message because there is nothing to install.

grayjay added a commit to grayjay/cabal that referenced this issue Jul 4, 2015
This commit relaxes D.PackageDescription.Check.checkConfiguredPackage so that it
only warns when a package declares no executables, libraries, tests, or
benchmarks.  Similarly, it relaxes the check during build to only require one
component that is buildable and enabled.  Install now requires an executable or
library.
dcoutts added a commit that referenced this issue Jul 6, 2015
@23Skidoo
Copy link
Member

23Skidoo commented Jul 6, 2015

Looks like this was fixed by #2699.

@23Skidoo 23Skidoo closed this as completed Jul 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants