1 -------------------------------------------------------------------------------
3 -------------------------------------------------------------------------------
5 This directory contains the regression tests for the compiler and the
6 prelude libraries. Regression tests meaning "correctness", NoFib
7 deals with "performance". Note that regression tests for other parts
8 of the ghc system (such as the driver, runtime system, system libs)
11 Each test takes the form of a single program (for example, reader001.hs)
12 and files which specify ghc's expected error output (reader001.stderr).
14 "make reader001.runtest" will compile reader001.hs using ghc and compare
15 the resulting output with that specified in the file reader001.stderr.
17 "make all" run all tests.
19 If you want to set compilation options globally from the commandline,
20 use `make EXTRA_HC_OPTS="-foo-option -blah', for global runstdtest options
21 use EXTRA_RUNTEST_OPTS.
23 -------------------------------------------------------------------------------
25 -------------------------------------------------------------------------------
27 To add a new test copy your Haskell program into an appropriately named
28 file in the appropriate directory (for example, "typecheck/tc093.hs" for
29 the 93rd typechecker test).
31 If the test needs to set the compiler options to something other than
32 the default for the directory, either modify the SRC_HC_OPTS (applies
33 to all tests in that directory), or set some extra per-file compiler
36 tc093_HC_OPTS = -noC -ddump-tc
38 -noC tells not bother generating any C (not point in doing that, since we
39 only want to test the typechecker). -ddump-tc tells ghc to dump the
42 Depending on the tests/ subdirectory, a default exit code is
43 expected from all tests therein, normally 0 (==success).
44 Per-file options to the runtests script can be set as follows
46 tc093_RUNTEST_OPTS = -x 1
48 telling the test script that the compiler is expected to fail
51 "touch" the file tc093.stderr. "make tc093.o" will then run
52 the compiler and fail (because the expected output doesn't match the empty
53 tc093.stderr). However, it is then easy to update tc093.stderr with the
54 stuff printed out during "make tc093.o". An alternative is to run
55 `make' with EXTRA_RUNTEST_OPTS=-accept-output on the new test, and the
56 runtest script will add the stderr&stdout dump files for you *in the