Skip to content

Migrate integration tests to some Makefile/shell based format #2797

Closed
@ezyang

Description

@ezyang

Currently, the process for package tests in Cabal is something like:

  1. Create a new Haskell file and write a lot of boilerplate to call a bunch of Cabal/ghc-pkg commands
  2. Wire it up to the main test caller
  3. Call 'cabal test' and wait for the test suite to build
  4. Actually run the test suite

This really sucks, for a few reasons:

  1. It takes a lot of boilerplate to write the actual package test, way more than an equivalent shell script plus expected output to diff against would
  2. Under the most normal workflow, we have to rebuild the test suite every time we make a change (e.g. tweak a command). This makes for a pretty annoying compile-run cycles
  3. It's opaque: it's much harder to reverse engineer what the source level commands are being run

The way GHC does these tests is that it just has a test runner which runs some shell scripts (really a Makefile) which runs a test, and the diffs it against some expected output. There's a bit of fuzz to make it all work out, but it is quite nice. Cabal should grow something similar; maybe that would encourage more tests! (Maybe there is a good out-of-the-box thing we can use here.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions