Running the Testsuite
This section gives information on how to use the testsuite. Note that the testsuite driver requires Python 3.
The commands on this page can all be executed from the
You can run
make test (which uses the default speed settings, and is the same as just
This table shows the differences between these three speed settings.
|make||how many tests||how many ways||used by whom|
|fasttest||some||1||Travis (to stay within time limit)|
|test||all||1||Phabricator (slow takes too long?)|
|slowtest||all||all||Nightly (slow is ok)|
make slow is GHC >= 7.11 only.
Note [validate and testsuite speed] in the toplevel
Commonly used options
You can run the testsuite in parallel to speed it up:
$ make THREADS=4
By default the testsuite uses the stage2 compiler. If you want to use another stage then:
$ make stage=1
To run the testsuite against a different GHC, say ghc-5.04 (this assumes the name specified corresponds to an executable on your path):
$ make TEST_HC=ghc-5.04
To run an individual test or tests (eg. tc054):
$ make TEST=tc054
To make this even faster, you can also go straight to the subdirectory containing the test (e.g ./tests/typecheck/should_compile/) and say 'make TEST=tc054' from there, which will save some time as the testsuite framework won't need to search as long to find the test you are referring to.
To run several tests, you just space separate them:
$ make TEST="tc053 tc054"
You can also run a whole group of related tests by changing to a subdirectory in the test cases tree:
$ cd ./tests/array $ make
To run the tests one particular way only (eg. GHCi):
$ make WAY=ghci
To add specific options to the compiler:
$ make EXTRA_HC_OPTS='+RTS -K32M -RTS'
By default tests clean up after themselves. If you want to keep the temporary files that tests generate, you can run:
$ make CLEANUP=0
Some of the tests in the testsuite rely on packages that aren't part of the standard libraries included with GHC (grep for
reqlib). These tests will be skipped then unless you install the required packages for them. Since we don't run these tests very often, some might be currently broken.
The extra packages are:
These can be easily installed from the root of the source tree using,
cabal install --with-compiler=`pwd`/inplace/bin/ghc-stage2 --package-db=`pwd`/inplace/lib/package.conf.d mtl parallel parsec primitive QuickCheck random regex-compat syb stm utf8-string vector
You may need to add
--disable-library-profiling if your GHC tree is built without the profiling way.
Problems running the testsuite
If the testsuite fails mysteriously, make sure that the timeout utility is working properly. This Haskell utility is compiled with the stage 1 compiler and invoked by the python driver, which does not print a nice error report if the utility fails. This can happen if, for example, the compiler produces bogus binaries. A workaround is to compile timeout with a stable ghc.