Commit 77a31642 authored by ttuegel's avatar ttuegel
Browse files

reorganize exitcode-stdio-1.0 tests

parent fe7b8784
......@@ -112,8 +112,8 @@ extra-source-files:
tests/PackageTests/TestOptions/TestOptions.cabal
tests/PackageTests/TestOptions/test-TestOptions.hs
tests/PackageTests/TestStanza/my.cabal
tests/PackageTests/TestSuiteExeV10/Foo.hs
tests/PackageTests/TestSuiteExeV10/my.cabal
tests/PackageTests/TestSuiteTests/ExeV10/Foo.hs
tests/PackageTests/TestSuiteTests/ExeV10/my.cabal
tests/PackageTests/TestSuiteExeV10/tests/test-Foo.hs
tests/Setup.hs
tests/hackage/check.sh
......@@ -307,7 +307,7 @@ test-suite package-tests
PackageTests.TemplateHaskell.Check
PackageTests.TestOptions.Check
PackageTests.TestStanza.Check
PackageTests.TestSuiteExeV10.Check
PackageTests.TestSuiteTests.ExeV10.Check
Test.Distribution.Version
Test.Laws
Test.QuickCheck.Utils
......
......@@ -33,7 +33,7 @@ import PackageTests.EmptyLib.Check
import PackageTests.Haddock.Check
import PackageTests.TestOptions.Check
import PackageTests.TestStanza.Check
import PackageTests.TestSuiteExeV10.Check
import PackageTests.TestSuiteTests.ExeV10.Check
import PackageTests.OrderFlags.Check
import PackageTests.ReexportedModules.Check
......@@ -77,9 +77,12 @@ tests config version =
, testCase "TestStanza" (PackageTests.TestStanza.Check.suite config)
-- ^ The Test stanza test will eventually be required
-- only for higher versions.
, testGroup "TestSuiteExeV10" (PackageTests.TestSuiteExeV10.Check.checks config)
, testCase "TestOptions" (PackageTests.TestOptions.Check.suite config)
, testCase "BenchmarkStanza" (PackageTests.BenchmarkStanza.Check.suite config)
, testGroup "TestSuiteTests"
[ testGroup "ExeV10"
(PackageTests.TestSuiteTests.ExeV10.Check.checks ghcPath)
]
, testCase "TestOptions" (PackageTests.TestOptions.Check.suite ghcPath)
, testCase "BenchmarkStanza" (PackageTests.BenchmarkStanza.Check.suite ghcPath)
-- ^ The benchmark stanza test will eventually be required
-- only for higher versions.
, testCase "BenchmarkExeV10/Test"
......
module PackageTests.TestSuiteExeV10.Check (checks) where
module PackageTests.TestSuiteTests.ExeV10.Check (checks) where
import qualified Control.Exception as E (IOException, catch)
import Control.Monad (when)
import Data.List (intercalate)
import Data.Maybe (catMaybes)
import System.Directory ( doesFileExist )
import System.FilePath
......@@ -23,12 +24,14 @@ import Distribution.Version (Version(..), orLaterVersion)
import PackageTests.PackageTester
checks :: SuiteConfig -> [TestTree]
checks config =
[ testCase "Test" $ checkTest config ]
++ hpcTestMatrix config ++
[ testCase "TestNoHpc/NoTix" $ checkTestNoHpcNoTix config
, testCase "TestNoHpc/NoMarkup" $ checkTestNoHpcNoMarkup config
checks :: FilePath -> [TestTree]
checks ghcPath =
[ testCase "Test" $ checkTest ghcPath
, testGroup "WithHpc" $ hpcTestMatrix ghcPath
, testGroup "WithoutHpc"
[ testCase "NoTix" $ checkTestNoHpcNoTix ghcPath
, testCase "NoMarkup" $ checkTestNoHpcNoMarkup ghcPath
]
]
hpcTestMatrix :: SuiteConfig -> [TestTree]
......@@ -37,26 +40,29 @@ hpcTestMatrix config = do
exeProf <- [True, False]
exeDyn <- [True, False]
shared <- [True, False]
let name = concat
[ "WithHpc-"
, if libProf then "LibProf" else ""
, if exeProf then "ExeProf" else ""
, if exeDyn then "ExeDyn" else ""
, if shared then "Shared" else ""
]
enable cond flag
| cond = Just $ "--enable-" ++ flag
| otherwise = Nothing
let name | null suffixes = "Vanilla"
| otherwise = intercalate "-" suffixes
where
suffixes = catMaybes
[ if libProf then Just "LibProf" else Nothing
, if exeProf then Just "ExeProf" else Nothing
, if exeDyn then Just "ExeDyn" else Nothing
, if shared then Just "Shared" else Nothing
]
opts = catMaybes
[ enable libProf "library-profiling"
, enable exeProf "profiling"
, enable exeDyn "executable-dynamic"
, enable shared "shared"
]
return $ testCase name $ checkTestWithHpc config name opts
where
enable cond flag
| cond = Just $ "--enable-" ++ flag
| otherwise = Nothing
return $ testCase name $ checkTestWithHpc ghcPath ("WithHpc-" ++ name) opts
dir :: FilePath
dir = "PackageTests" </> "TestSuiteExeV10"
dir = "PackageTests" </> "TestSuiteTests" </> "ExeV10"
checkTest :: SuiteConfig -> Assertion
checkTest config = buildAndTest config "Default" [] []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment