forked from haskell/cabal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hpc: Don't cover non-dependency libraries
We were passing the flag --coverage-for for every library in the package when building the testsuites. However, if a particular testsuite doesn't depend on one of the packages passed with --coverage-for we would crash. Since we look for the unit ids of all packages given in --coverage-for in the package database (to find hpc artifacts), if the testsuite builds before the library this lookup would fail. The fix is easy: don't pass --coverage-for=<lib> to <testsuite> if <testsuite> doesn't depend on <lib>. If <lib> is an indirect dependency of <testsuite> it'll no longer be covered by HPC, but this is a weird behaviour that I doubt anyone relies on. Fixes haskell#10046
- Loading branch information
Showing
10 changed files
with
65 additions
and
8 deletions.
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,28 @@ | ||
cabal-version: 3.0 | ||
name: aa | ||
version: 0.1.0.0 | ||
license: NONE | ||
build-type: Simple | ||
extra-doc-files: CHANGELOG.md | ||
|
||
library | ||
exposed-modules: MyLib | ||
build-depends: base, template-haskell | ||
hs-source-dirs: src | ||
default-language: Haskell2010 | ||
|
||
test-suite bb-test | ||
default-language: Haskell2010 | ||
type: exitcode-stdio-1.0 | ||
hs-source-dirs: testbb | ||
main-is: Main.hs | ||
build-depends: | ||
base, aa | ||
|
||
test-suite aa-test | ||
default-language: Haskell2010 | ||
type: exitcode-stdio-1.0 | ||
hs-source-dirs: test | ||
main-is: Main.hs | ||
build-depends: | ||
base |
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 @@ | ||
main = pure () |
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 @@ | ||
packages: . |
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,6 @@ | ||
import Test.Cabal.Prelude | ||
|
||
-- T10046 | ||
main = cabalTest $ recordMode DoNotRecord $ do | ||
out <- cabal' "test" ["all"] | ||
assertOutputDoesNotContain "Failed to find the installed unit 'aa-0.1.0.0-inplace'" out' |
12 changes: 12 additions & 0 deletions
12
cabal-testsuite/PackageTests/Regression/T10046/src/MyLib.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,12 @@ | ||
{-# LANGUAGE TemplateHaskell #-} | ||
module MyLib where | ||
|
||
import Control.Concurrent | ||
import Language.Haskell.TH | ||
|
||
-- Must take longer to compile than the testsuite | ||
$(do runIO $ | ||
threadDelay (5*1000*1000) -- 5s | ||
|
||
[d| data X |] | ||
) |
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 @@ | ||
main = pure () |
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 @@ | ||
main = pure () |