------------------------------------------------------------------------------- GHC COMPILER TESTS ------------------------------------------------------------------------------- This directory contains tests for various bits of the internals of ghc. Note that tests for other parts of the ghc system (such as the driver, parser, runtime system, standard prelude) belong elsewhere. Each test takes the form of a single program (for example, reader001.hs) and a files which specify ghc's expected error output (reader001.stderr). "make reader001.runtest" will compile reader001.hs using ghc and compare the resulting output with that specified in the file reader001.stderr. "make runtests" run all tests. ------------------------------------------------------------------------------- ADDING A NEW TEST ------------------------------------------------------------------------------- To add a new test copy your Haskell program into an appropriately named file in the appropriate directory (for example, "typecheck/tc093.hs" for the 93rd typechecker test). Edit the Makefile in that directory to add your test. Most directories have some flags which are set for every test (RUNSTDTEST_OPTS), but you can also set some extra per-file runtest flags (to control the output of ghc, for instance). Just set ttc093_flags to the flags you want. For example, tc093_flags = -noC -ddump-tc -x1 -noC tells not bother generating any C (not point in doing that, since we only want to test the typechecker). -ddump-tc tells ghc to dump the typechcker state, while -x1 tells runtest that the expected exit code is 1, not 0 (the default). "touch" the file tc093.stderr. "make tc093.runtest" will then build tc093.runtest and fail (because the expected output doesn't match the empty tc093.stderr). However, it is then easy to update tc093.stderr with the stuff printed out during "make tc093.runtest".