Skip to content

Support pure test packages #1186

feuerbach opened this Issue Jan 25, 2013 · 3 comments

3 participants


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-' '-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 the enhancement label Sep 13, 2014
@ttuegel ttuegel added the library label Apr 23, 2015
@ttuegel ttuegel added this to the _|_ milestone Apr 23, 2015
@ttuegel ttuegel added the easy label Jun 26, 2015
@ttuegel ttuegel modified the milestone: Cabal-1.24, _|_ Jun 26, 2015
Haskell 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.

Haskell 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 grayjay added a commit to grayjay/cabal that referenced this issue Jul 4, 2015
@grayjay grayjay Support pure test packages (issue #1186)
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
Haskell member
23Skidoo commented Jul 6, 2015

Looks like this was fixed by #2699.

@23Skidoo 23Skidoo closed this Jul 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.