How does GHC's testsuite work?

Edward Z. Yang ezyang at mit.edu
Mon Oct 30 15:51:27 UTC 2017


Excerpts from Sébastien Hinderer's message of 2017-10-30 16:39:24 +0100:
> Dear Edward,
> 
> Many thanks for your prompt response!
> 
> Edward Z. Yang (2017/10/30 11:25 -0400):
> > Actually, it's the reverse of what you said: like OCaml, GHC essentially
> > has ~no unit tests; it's entirely Haskell programs which we compile
> > (and sometimes run; a lot of tests are for the typechecker only so
> > we don't bother running those.)  The .T file is just a way of letting
> > the Python driver know what tests exist.
> 
> Oh okay! Would you be able to point me to just a few tests to get an
> idea of a few typical situations, please?

For example:

    The metadata
    https://github.com/ghc/ghc/blob/master/testsuite/tests/typecheck/should_fail/all.T

    The source file
    https://github.com/ghc/ghc/blob/master/testsuite/tests/typecheck/should_fail/tcfail011.hs

    The expected error output
    https://github.com/ghc/ghc/blob/master/testsuite/tests/typecheck/should_fail/tcfail011.stderr

> One other question I forgot to ask: how do you deal with conditional
> tests? For instance, if a test should be run only on some platforms? Or,
> in OCaml we have tests for Fortran bindings that should be run only if a
> Fortran compiler is available. How would you deal with such tests?

All managed inside the Python driver code.

Example:
https://github.com/ghc/ghc/blob/master/testsuite/tests/rts/all.T#L32

Edward


More information about the Glasgow-haskell-users mailing list