Skip to content
Snippets Groups Projects
Matthew Pickering's avatar
Matthew Pickering authored
I can't think of a reason why it would be desirable to expose the user's
cabal store or local dist-newstyle to the test runner. In fact, this can
break test output in certain situations depending on what is in your
store.

Tests should run in as hemertic environment as possible and not
depend on anything to do with external system configuration.

I have introduced a Note [Testsuite package environments] which explains
what the environments are for the three different components of the
testsuite.

{- Note [Testsuite package environments]

There are three different package environments which are used when running the
testsuite.

1. Environment used to compile `cabal-tests` executable
2. Environment used to run test scripts "setup.test.hs"
3. Environment made available to tests themselves via `./Setup configure`

These are all distinct from each other and should be specified separately.

Where are these environments specified:

1. The build-depends on `cabal-tests` executable in `cabal-testsuite.cabal`
2. The build-depends of `test-runtime-deps` executable in `cabal-testsuite.cabal`
   These dependencies are injected in a special module (`Test.Cabal.ScriptEnv0`) which
   then is consulted in `Test.Cabal.Monad` in order to pass the right environmnet.
   This is mechanism by which the `./Setup` tests have access to the in-tree `Cabal`
   and `Cabal-syntax` libraries.
3. No specification, only the `GlobalPackageDb` is available (see
   `testPackageDBStack`) unless the test itself augments the environment with
   `withPackageDb`.

At the moment, `cabal-install` tests always use the bootstrap cabal, which is a
bit confusing but `cabal-install` is not flexible enough to be given additional
package databases (yet).

-}
dbe5cf42
History

Cabal

Hackage version Stackage version Documentation Status IRC chat Matrix chat

This Cabal Git repository contains the following main packages:

The canonical upstream repository is located at https://github.com/haskell/cabal.

Ways to get the cabal-install binary

  1. GHCup (preferred): get GHCup using the directions on its website and run:

    ghcup install --set cabal latest
  2. Download from official website: the cabal-install binary download for your platform should contain the cabal executable.

Getting unreleased versions of cabal-install: gives you a chance to try out yet-unreleased features. Currently, we only provide binaries for x86_64 platforms.

  1. GitHub preview release built from the tip of the master branch: download from GitHub or use this GHCup command to install:

    ghcup install cabal -u https://github.com/haskell/cabal/releases/download/cabal-head/cabal-head-Linux-x86_64.tar.gz head

    Replace "Linux" with "Windows" or "macOS" as appropriate.

  2. Even more cutting-edge binaries built from pull requests are always available from the Validate worklow page on GitHub, at the very bottom of the page.

Ways to build cabal-install for everyday use

  1. With cabal-install: if you have a pre-existing version of cabal-install, run:

    cabal install cabal-install

    to get the latest version of cabal-install. (You may want to cabal update first.)

  2. From Git: again with a pre-existing version of cabal-install, you can install the latest version from the Git repository. Clone the Git repository, move to its root, and run:

    cabal install --project-file=cabal.project.release cabal-install
  3. Bootstrapping: if you don't have a pre-existing version of cabal-install, look into the bootstrap directory.

Learn how to use cabal and get support

cabal comes with a thorough User Manual. If you are new to cabal and want to quickly learn the basics, check Getting Started With Haskell and Cabal.

Got questions? Ask in Haskell Matrix (online chat) or Haskell Discourse.

Build for hacking and contributing to cabal

Refer to CONTRIBUTING.md.