Skip to content
Snippets Groups Projects
Commit 94a9c33c authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Fix setup-no-tix to be hermetic, solves test failures.


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 3ef451c0
No related branches found
No related tags found
No related merge requests found
......@@ -16,5 +16,5 @@ Building test suite 'test-Short' for my-0.1..
Running 1 test suites...
Test suite test-Short: RUNNING...
Test suite test-Short: PASS
Test suite logged to: setup-no-tix.cabal.dist/work/dist/test/my-0.1-test-Short.log
Test suite logged to: ../work/dist/test/my-0.1-test-Short.log
1 of 1 test suites (1 of 1 test cases) passed.
......@@ -11,5 +11,5 @@ Building test suite 'test-Short' for my-0.1..
Running 1 test suites...
Test suite test-Short: RUNNING...
Test suite test-Short: PASS
Test suite logged to: setup-no-tix.dist/work/dist/test/my-0.1-test-Short.log
Test suite logged to: ../work/dist/test/my-0.1-test-Short.log
1 of 1 test suites (1 of 1 test cases) passed.
import Test.Cabal.Prelude
import Distribution.Simple.Hpc
-- Ensures that even if -fhpc is manually provided no .tix file is output.
-- When -fhpc is manually provided, but --enable-coverage is not,
-- the desired behavior is that we pass on -fhpc to GHC, but do NOT
-- attempt to do anything with the tix file (i.e., do not change
-- where it gets output, do not attempt to run hpc on it.)
--
-- This was requested in #1945, by a user who wanted to handle the
-- coverage manually. Unfortunately, this behavior is (not yet)
-- documented in the manual. (In fact, coverage is not documented
-- at all.)
--
main = setupAndCabalTest $ do
dist_dir <- fmap testDistDir getTestEnv
setup_build
[ "--enable-tests"
, "--ghc-option=-fhpc"
, "--ghc-option=-hpcdir"
, "--ghc-option=" ++ dist_dir ++ "/hpc/vanilla" ]
setup "test" ["test-Short", "--show-details=direct"]
lbi <- getLocalBuildInfoM
let way = guessWay lbi
shouldNotExist $ tixFilePath dist_dir way "test-Short"
-- Source copy is necessary as GHC defaults to dumping tix
-- file in the CWD, and we do NOT clean it up after the fact.
withSourceCopy $ do
dist_dir <- fmap testDistDir getTestEnv
setup_build
[ "--enable-tests"
, "--ghc-option=-fhpc"
, "--ghc-option=-hpcdir"
, "--ghc-option=" ++ dist_dir ++ "/hpc/vanilla" ]
setup "test" ["test-Short", "--show-details=direct"]
lbi <- getLocalBuildInfoM
let way = guessWay lbi
shouldNotExist $ tixFilePath dist_dir way "test-Short"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment