Rewrite the package test suite.
I've rewritten the test suite to be more concise and "correct by
construction". The primary method that this is achieved by
is introducing the 'TestM' monad, which carries around the
important state for the tests so that (1) we don't have to
pass it as an argument all around, and (2) we can automatically
make the correct decisions about how to do things. This new
method emphasises "configuration by convention": we assume
that a test-case named "Foo" has its test packages in the
directory "tests/PackageTests/Foo".
A secondary change is that all command functions automatically fail if
they have a non-zero exit code (unless you use the 'shouldFail'
combinator which inverts the sense.) This saves a lot of typing
on test-cases. (In fact, I've reorganized all of the commands
related here.)
In the process, I've tightened up the logic for how to find the
LocalBuildInfo of the Cabal we've testing, so we should now
reliably be testing the inplace Cabal library, and not the
system library (as was often the case.)
Because things are a lot shorter, there is no good reason to
make Check modules except for the biggest test cases. Most
test-cases have been folded into PackageTests.Tests; if you
have a small test-case you should just put it there.
Signed-off-by:
Edward Z. Yang <ezyang@cs.stanford.edu>
Showing
- .gitignore 7 additions, 0 deletions.gitignore
- Cabal/Cabal.cabal 4 additions, 31 deletionsCabal/Cabal.cabal
- Cabal/tests/PackageTests.hs 174 additions, 152 deletionsCabal/tests/PackageTests.hs
- Cabal/tests/PackageTests/BenchmarkExeV10/Check.hs 0 additions, 16 deletionsCabal/tests/PackageTests/BenchmarkExeV10/Check.hs
- Cabal/tests/PackageTests/BenchmarkOptions/Check.hs 0 additions, 26 deletionsCabal/tests/PackageTests/BenchmarkOptions/Check.hs
- Cabal/tests/PackageTests/BenchmarkStanza/Check.hs 15 additions, 34 deletionsCabal/tests/PackageTests/BenchmarkStanza/Check.hs
- Cabal/tests/PackageTests/BuildDeps/InternalLibrary0/Check.hs 0 additions, 22 deletionsCabal/tests/PackageTests/BuildDeps/InternalLibrary0/Check.hs
- Cabal/tests/PackageTests/BuildDeps/InternalLibrary1/Check.hs 0 additions, 16 deletionsCabal/tests/PackageTests/BuildDeps/InternalLibrary1/Check.hs
- Cabal/tests/PackageTests/BuildDeps/InternalLibrary2/Check.hs 0 additions, 31 deletionsCabal/tests/PackageTests/BuildDeps/InternalLibrary2/Check.hs
- Cabal/tests/PackageTests/BuildDeps/InternalLibrary3/Check.hs 0 additions, 31 deletionsCabal/tests/PackageTests/BuildDeps/InternalLibrary3/Check.hs
- Cabal/tests/PackageTests/BuildDeps/InternalLibrary4/Check.hs 0 additions, 31 deletionsCabal/tests/PackageTests/BuildDeps/InternalLibrary4/Check.hs
- Cabal/tests/PackageTests/BuildDeps/SameDepsAllRound/Check.hs 0 additions, 21 deletionsCabal/tests/PackageTests/BuildDeps/SameDepsAllRound/Check.hs
- Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs 0 additions, 29 deletions...tests/PackageTests/BuildDeps/TargetSpecificDeps1/Check.hs
- Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps2/Check.hs 0 additions, 21 deletions...tests/PackageTests/BuildDeps/TargetSpecificDeps2/Check.hs
- Cabal/tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs 0 additions, 28 deletions...tests/PackageTests/BuildDeps/TargetSpecificDeps3/Check.hs
- Cabal/tests/PackageTests/CMain/Check.hs 0 additions, 20 deletionsCabal/tests/PackageTests/CMain/Check.hs
- Cabal/tests/PackageTests/CMain/Setup.hs 0 additions, 3 deletionsCabal/tests/PackageTests/CMain/Setup.hs
- Cabal/tests/PackageTests/DeterministicAr/Check.hs 9 additions, 32 deletionsCabal/tests/PackageTests/DeterministicAr/Check.hs
- Cabal/tests/PackageTests/EmptyLib/Check.hs 0 additions, 16 deletionsCabal/tests/PackageTests/EmptyLib/Check.hs
- Cabal/tests/PackageTests/Haddock/Check.hs 0 additions, 42 deletionsCabal/tests/PackageTests/Haddock/Check.hs
Loading
Please register or sign in to comment