Commit 69fb30ce authored by ttuegel's avatar ttuegel
Browse files

add deadlock test for detailed-0.9 test suites

parent 77a31642
......@@ -114,7 +114,10 @@ extra-source-files:
tests/PackageTests/TestStanza/my.cabal
tests/PackageTests/TestSuiteTests/ExeV10/Foo.hs
tests/PackageTests/TestSuiteTests/ExeV10/my.cabal
tests/PackageTests/TestSuiteExeV10/tests/test-Foo.hs
tests/PackageTests/TestSuiteTests/ExeV10/tests/test-Foo.hs
tests/PackageTests/TestSuiteTests/LibV09/LibV09.cabal
tests/PackageTests/TestSuiteTests/LibV09/Lib.hs
tests/PackageTests/TestSuiteTests/LibV09/Deadlock.hs
tests/Setup.hs
tests/hackage/check.sh
tests/hackage/download.sh
......@@ -308,6 +311,7 @@ test-suite package-tests
PackageTests.TestOptions.Check
PackageTests.TestStanza.Check
PackageTests.TestSuiteTests.ExeV10.Check
PackageTests.TestSuiteTests.LibV09.Check
Test.Distribution.Version
Test.Laws
Test.QuickCheck.Utils
......
......@@ -34,6 +34,7 @@ import PackageTests.Haddock.Check
import PackageTests.TestOptions.Check
import PackageTests.TestStanza.Check
import PackageTests.TestSuiteTests.ExeV10.Check
import PackageTests.TestSuiteTests.LibV09.Check
import PackageTests.OrderFlags.Check
import PackageTests.ReexportedModules.Check
......@@ -80,6 +81,8 @@ tests config version =
, testGroup "TestSuiteTests"
[ testGroup "ExeV10"
(PackageTests.TestSuiteTests.ExeV10.Check.checks ghcPath)
, testGroup "LibV09"
(PackageTests.TestSuiteTests.LibV09.Check.checks inplaceSpec ghcPath)
]
, testCase "TestOptions" (PackageTests.TestOptions.Check.suite ghcPath)
, testCase "BenchmarkStanza" (PackageTests.BenchmarkStanza.Check.suite ghcPath)
......
......@@ -25,6 +25,7 @@ module PackageTests.PackageTester
, assertBuildFailed
, assertHaddockSucceeded
, assertTestSucceeded
, assertTestFailed
, assertInstallSucceeded
, assertOutputContains
, assertOutputDoesNotContain
......@@ -284,6 +285,12 @@ assertTestSucceeded result = unless (successful result) $
"expected: \'setup test\' should succeed\n" ++
" output: " ++ outputText result
assertTestFailed :: Result -> Assertion
assertTestFailed result = when (successful result) $
assertFailure $
"expected: \'setup test\' should fail\n" ++
" output: " ++ outputText result
assertInstallSucceeded :: Result -> Assertion
assertInstallSucceeded result = unless (successful result) $
assertFailure $
......
module PackageTests.TestSuiteTests.LibV09.Check (checks) where
import Test.Tasty
import Test.Tasty.HUnit
import System.FilePath ((</>))
import PackageTests.PackageTester
dir :: FilePath
dir = "PackageTests" </> "TestSuiteTests" </> "LibV09"
checks :: PackageSpec -> FilePath -> [TestTree]
checks inplaceSpec ghcPath =
[ testCase "Build" $ checkBuild inplaceSpec ghcPath
, localOption (mkTimeout $ 10 * 10 ^ (6 :: Int))
$ testCase "Deadlock" $ checkDeadlock inplaceSpec ghcPath
]
checkBuild :: PackageSpec -> FilePath -> Assertion
checkBuild inplaceSpec ghcPath = do
let spec = inplaceSpec
{ directory = dir
, distPref = Just $ "dist-Build"
, configOpts = "--enable-tests" : configOpts inplaceSpec
}
buildResult <- cabal_build spec ghcPath
assertBuildSucceeded buildResult
checkDeadlock :: PackageSpec -> FilePath -> Assertion
checkDeadlock inplaceSpec ghcPath = do
let spec = inplaceSpec
{ directory = dir
, distPref = Just $ "dist-Test"
, configOpts = "--enable-tests" : configOpts inplaceSpec
}
buildResult <- cabal_build spec ghcPath
assertBuildSucceeded buildResult
testResult <- cabal_test spec [] [] ghcPath
assertTestFailed testResult
module Lib where
import Distribution.TestSuite
nullt x = Test $ TestInstance
{ run = return $ Finished (Fail "no reason")
, name = "test " ++ show x
, tags = []
, options = []
, setOption = \_ _-> Left "No Options"
}
name: LibV09
version: 0.1
cabal-version: >= 1.2
license: BSD3
author: Thomas Tuegel
stability: stable
category: PackageTests
build-type: Simple
cabal-version: >= 1.9.2
description: Check type detailed-0.9 test suites.
library
exposed-modules: Lib
build-depends: base, Cabal
test-suite LibV09-Deadlock
type: detailed-0.9
hs-source-dirs: tests
test-module: Deadlock
build-depends: base, Cabal, LibV09
module Deadlock where
import Distribution.TestSuite
import Lib
tests :: IO [Test]
tests = return [nullt x | x <- [1 .. 10000]]
Supports Markdown
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