3 -- The logic here is tricky.
4 -- If this is compiled by cabal-install, then the MIN_VERSION_Cabal is set
5 -- otherwise, we are compiling against Cabal library under test,
7 #ifndef MIN_VERSION_Cabal
8 #define MIN_VERSION_Cabal
(x
,y
,z
) 1
11 import Test
.Cabal
.Prelude
12 import Distribution
.Simple
.Hpc
13 #if MIN_VERSION_Cabal
(3,11,0)
14 import Distribution
.Utils
.Path
15 ( unsafeMakeSymbolicPath
, getSymbolicPath
)
16 mkPath
= unsafeMakeSymbolicPath
17 getPath
= getSymbolicPath
23 -- When -fhpc is manually provided, but --enable-coverage is not,
24 -- the desired behavior is that we pass on -fhpc to GHC, but do NOT
25 -- attempt to do anything with the tix file (i.e., do not change
26 -- where it gets output, do not attempt to run hpc on it.)
28 -- This was requested in #1945, by a user who wanted to handle the
29 -- coverage manually. Unfortunately, this behavior is (not yet)
30 -- documented in the manual. (In fact, coverage is not documented
33 main
= setupAndCabalTest
$ do
34 dist_dir
<- fmap testDistDir getTestEnv
37 , "--ghc-option=-fhpc"
38 , "--ghc-option=-hpcdir"
39 , "--ghc-option=" ++ dist_dir
++ "/hpc/vanilla" ]
40 setup
"test" ["test-Short", "--show-details=direct"]
41 lbi
<- getLocalBuildInfoM
42 let way
= guessWay lbi
43 shouldNotExist
$ getPath
$ tixFilePath
(mkPath dist_dir
) way
"test-Short"