How does GHC's testsuite work?

Joachim Breitner mail at joachim-breitner.de
Mon Oct 30 17:44:14 UTC 2017


Hi Sebastien,

I’m looking forward to your report, surely there will be some
interesting inspirations for us.

Am Montag, den 30.10.2017, 11:25 -0400 schrieb Edward Z. Yang:
> 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.

let me add that these tests rarely check the actual output of the
compiler (i.e. the program, or even the simplified code). Often it is
enough to check
 * whether the compile succeeds or fails as expected, or maybe
 * what messages the compiler prints.

In a few cases we do dump the complete intermediate code (-ddump-
simpl), but then the test case specifies a “normalization function”
that checks the output for a certain property, e.g. by grepping for
certain patterns.

The only real unit tests that I know of are these:
http://git.haskell.org/ghc.git/tree/HEAD:/testsuite/tests/callarity/unittest
These are effectively programs using “GHC-the-library”

Joachim


-- 
Joachim Breitner
  mail at joachim-breitner.de
  http://www.joachim-breitner.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20171030/1f6df500/attachment.sig>


More information about the Glasgow-haskell-users mailing list