tests: add a shortcut env variable to run all tests
Instead of having to specify all env variables manually, this defaults to running all tests.
This commit is contained in:
parent
9cfe060a9d
commit
9724c649ce
|
@ -22,7 +22,9 @@ $ cabal configure --enable-tests
|
|||
$ cabal build
|
||||
$ cabal test
|
||||
# To run all of the tests, which takes up to a minute:
|
||||
$ LANGUAGE_TESTS=yes NIXPKGS_TESTS=yes cabal test
|
||||
$ env ALL_TESTS=yes cabal test
|
||||
# To run only specific tests (see `tests/Main.hs` for a list)
|
||||
$ env NIXPKGS_TESTS=yes PRETTY_TESTS=yes cabal test
|
||||
$ ./dist/build/hnix/hnix --help
|
||||
```
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ module Main where
|
|||
|
||||
import Control.DeepSeq
|
||||
import qualified Control.Exception as Exc
|
||||
import Control.Applicative ((<|>))
|
||||
import Control.Monad
|
||||
import Control.Monad.IO.Class
|
||||
import Data.Fix
|
||||
|
@ -84,9 +85,11 @@ main :: IO ()
|
|||
main = do
|
||||
nixLanguageTests <- NixLanguageTests.genTests
|
||||
evalComparisonTests <- EvalTests.genEvalCompareTests
|
||||
nixpkgsTestsEnv <- lookupEnv "NIXPKGS_TESTS"
|
||||
prettyTestsEnv <- lookupEnv "PRETTY_TESTS"
|
||||
hpackTestsEnv <- lookupEnv "HPACK_TESTS"
|
||||
let allOrLookup = \var ->
|
||||
lookupEnv "ALL_TESTS" <|> lookupEnv var
|
||||
nixpkgsTestsEnv <- allOrLookup "NIXPKGS_TESTS"
|
||||
prettyTestsEnv <- allOrLookup "PRETTY_TESTS"
|
||||
hpackTestsEnv <- allOrLookup "HPACK_TESTS"
|
||||
|
||||
pwd <- getCurrentDirectory
|
||||
setEnv "NIX_REMOTE" ("local?root=" ++ pwd ++ "/")
|
||||
|
|
Loading…
Reference in a new issue