Skip to content
Snippets Groups Projects
Commit ef8e63fb authored by lspitzner's avatar lspitzner
Browse files

Fix HACKING.md description of how to run tests

parent 0daccdec
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,9 @@ list, which is a good place to ask questions. ...@@ -24,6 +24,9 @@ list, which is a good place to ask questions.
Building Cabal from git cloned sources and running the tests Building Cabal from git cloned sources and running the tests
------------------------------------------------------------ ------------------------------------------------------------
_The steps below will make use of sandboxes for building. The process might be
somewhat different when you do not want to use sandboxes._
Building Cabal from from source requires the following: Building Cabal from from source requires the following:
* Glorious/Glasgow Haskell Compiler (ghc). * Glorious/Glasgow Haskell Compiler (ghc).
...@@ -31,45 +34,93 @@ Building Cabal from from source requires the following: ...@@ -31,45 +34,93 @@ Building Cabal from from source requires the following:
Haskell Platform, bootstrapped from the Haskell Platform, bootstrapped from the
[source tarball on Hackage](http://hackage.haskell.org/package/cabal-install) or [source tarball on Hackage](http://hackage.haskell.org/package/cabal-install) or
installed from your Linux vendor). installed from your Linux vendor).
* The sources. For example, you might want to
Once you have these, the steps are: ~~~~
1. Change into the directory where you want to stash the cabal sources, eg:
```
cd ~/MyHaskellCode cd ~/MyHaskellCode
``` git clone https://github.com/haskell/cabal.git
cd cabal
~~~~
2. Clone the repo and change into the `cabal-install` directory: to download the git repository to ~/MyHaskellCode/cabal.
``` To build and test the `Cabal` library, do:
git clone https://github.com/haskell/cabal.git
cd cabal/cabal-install/ 1. Move to `Cabal` directory:
```
3. If you are hacking on Cabal you probaly don't want your development version ~~~~
to interfere with the `cabal` executable you actually use, so we'll set up and cd Cabal
use a cabal sandbox: ~~~~
``` 2. Create a sandbox, and fill it with the necessary dependencies:
~~~~
cabal sandbox init cabal sandbox init
``` cabal install --only-dependencies --enable-tests
~~~~
3. Unfortunately, because of way the bootstrapping works for cabal,
we cannot use `cabal` for the next steps;
we need to use Setup instead.
So, compile Setup.hs:
~~~~
ghc --make -threaded Setup.hs
~~~~
4. However, we _do_ want to use the sandbox package database that was created
by cabal.
We need its path later, so we have to find out where it is,
for example with:
~~~~
cabal exec -- sh -c "echo \$GHC_PACKAGE_PATH" | sed s/:.*//
~~~~
4. Now add the `Cabal` library and install all the dependencies into the sandbox: the result should be something like
``` ~~~~
cabal sandbox add-source ../Cabal ~/MyHaskellCode/cabal/Cabal/.cabal-sandbox/$SOMESTUFF-packages.conf.d
cabal --enable-tests install --dependencies-only ~~~~
```
Since you used `add-source`, any changes to `Cabal/` will automatically be (or, as a relative path with my setup:)
picked up when building inside `cabal-install/` from now on.
~~~~
.cabal-sandbox/x86_64-linux-ghc-7.8.4-packages.conf.d
~~~~
5. Build cabal-install and run the tests: We will refer to this as `PACKAGEDB`.
5. Configure and build Cabal, and run all tests:
~~~~
./Setup configure --enable-tests --package-db=$PACKAGEDB
./Setup build
./Setup test
~~~~
The steps for building and testing the `cabal-install` executable are almost
identical; only the first two steps are different:
1. Move to the `cabal-install` directory:
~~~~
cd cabal-install
~~~~
2. Create a sandbox, and fill it with the necessary dependencies.
For this, we need to add the Cabal library from the repository as an
add-source dependency:
~~~~
cabal sandbox init
cabal sandbox add-source ../Cabal/
cabal install --only-dependencies
~~~~
``` (In addition, the absolute sandbox path will be slightly different
cabal build because we have to use the `cabal-install` sandbox, not the Cabal one. If you
cabal test use the relative path, you are set.)
```
Dependencies policy Dependencies policy
------------------- -------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment