Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add deadlock test for detailed-0.9 test suites
- Loading branch information
Showing
7 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
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" | ||
} |
21 changes: 21 additions & 0 deletions
21
Cabal/tests/PackageTests/TestSuiteTests/LibV09/LibV09.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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 |
8 changes: 8 additions & 0 deletions
8
Cabal/tests/PackageTests/TestSuiteTests/LibV09/tests/Deadlock.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Deadlock where | ||
|
||
import Distribution.TestSuite | ||
|
||
import Lib | ||
|
||
tests :: IO [Test] | ||
tests = return [nullt x | x <- [1 .. 550]] |