The tests under the PackageTests directory define and build packages that exercise various components of Cabal. Each test case is an HUnit test. The entry point for the test suite, where all the test cases are listed, is PackageTests.hs. There are utilities for calling the stages of Cabal's build process in PackageTests/PackageTester.hs; have a look at an existing test case to see how they are used.
In order to run the tests, PackageTests
needs to know where the inplace
copy of Cabal being tested is, as well as some information which was
used to configure it. By default, PackageTests
tries to look at the
LocalBuildInfo
, but if the format of LocalBuildInfo
has changed
between the version of Cabal which ran the configure step, and the
version of Cabal we are testing against, this may fail. In that
case, you can manually specify the information we need using
the following environment variables:
CABAL_PACKAGETESTS_GHC
is the path to the GHC you compiled Cabal withCABAL_PACKAGETESTS_GHC_PKG
is the path to the ghc-pkg associated with this GHCCABAL_PACKAGETESTS_HADDOCK
is the path to the haddock associated with this GHCCABAL_PACKAGETESTS_GHC_VERSION
is the version of your GHCCABAL_PACKAGETESTS_DB_STACK
is a PATH-style list of package database paths,clear
,global
anduser
. Each component of the list is interpreted the same way as Cabal's-package-db
flag. This list must contain the copy of Cabal you are planning to test against (as well as its transitive dependencies).
If you can successfully run the test suite, we'll print out examples of all of these values for you under "Environment".