Running the Cabal tests
Edward Z. Yang
ezyang at mit.edu
Sun Mar 20 01:34:19 UTC 2016
Excerpts from Mikhail Glushenkov's message of 2016-03-19 07:57:42 -0700:
> Hi,
>
> On 19 March 2016 at 08:35, Erik de Castro Lopo <mle+hs at mega-nerd.com> wrote:
> > Hi all,
> >
> > I hacked together what I thought was a neat little feature (a 3 line diff)
> > and thought I'd add a test. Thats when I figured out I couldn't even run
> > the tests.
> >
> > Reading `Cabal/tests/Readme.md` I see I need to set the environment var:
>
> Setting those vars shouldn't be *required*. Try to follow steps in
> HACKING.md (i.e. compile a Setup script manually and run './Setup
> [configure --enable tests | build | test]').
package-tests currently has a dumb hack to figure out these environment
variables: it tries to read out the local build information associated
with your build of Cabal. Unfortunately, this format is extremely
backwards incompatible, which means any time someone changes the LBI
data structure, the data becomes unreadable (spouting the error you've
seen here.)
Not too long ago, this problem never happened, because Cabal shipped
with a 'Custom' build script which forced Cabal to be built *twice*;
once to build the Setup script with the local source copy of Cabal,
and then again for the actual Cabal hosted build. We stopped doing
this because it was quite a pain to wait for Cabal to be built twice,
but it did solve the problem of the LBI being wrong.
Right now, Cabal is not bootstrapped in this way, which means that
the LBI is whatever version of Cabal you have running, which probably
is incompatible with the development version of Cabal, which means
error. Probably the right way to fix this problem is to make the
LBI serialization format more BC-friendly but this doesn't help
poor users who are trying to dev Cabal with a Cabal that is not
the most recent one.
> > The first four are obvious and easy, but I have no idea how to set the last
> one.
>
> It should look approx. like this:
> 'CABAL_PACKAGETESTS_DB_STACK=clear:global:/path/to/.cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d'.
> This assumes that you installed the version of Cabal you're testing
> into a sandbox under '/path/to/.cabal-sandbox'.
We should doc this. If you're not running any tests which need to build
against the Cabal you just compiled (so, really, just tests involving
Custom or the library test suite) then you can even just say
'clear:global' and the right thing should happen.
Edward
More information about the cabal-devel
mailing list