Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#10259 closed bug (invalid)

HPC code coverage fails

Reported by: LukeHoersten Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.10.1
Keywords: hpc Cc:
Operating System: MacOS X Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by LukeHoersten)

in a completely clean sandbox environment:

cabal install --dependencies-only --enable-tests --enable-coverage --enable-benchmarks cabal build test --enable-tests --enable-coverage --enable-benchmarks cabal test project --test-options=--html=dist/tasty/index.html

Command: cabal test project --test-options=--html=dist/tasty/index.html Exit code: 1 Stderr: hpc: can not find text_IINWRW1LxFGIctooOLjJAI/Data.Text.Unsafe in ["./.hpc","./dist/hpc/vanilla/mix/project-","./dist/hpc/vanilla/mix/project-test"]

$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.10.1

$ cabal --version cabal-install version using version of the Cabal library

$ clang --version Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) Target: x86_64-apple-darwin14.3.0 Thread model: posix

OS X version 10.10.3

Installed from home-brew and Haskell for Mac OS X both have the same problem.

Change History (5)

comment:1 Changed 4 years ago by LukeHoersten

Description: modified (diff)

comment:2 Changed 4 years ago by LukeHoersten

I was able to reproduce this on 7.8.4 as well. The error is slightly different though:

hpc: can not find text- in ["./.hpc","./dist/hpc/prof/mix/project-","./dist/hpc/prof/mix/project"]

I've also found it finishes the tests successfully. Looks like the problem may be in generating the HTML output?

Running 1 test suites... Test suite project: RUNNING... Test suite project: PASS Test suite logged to: dist/test/project- hpc: can not find text- in ["./.hpc","./dist/hpc/prof/mix/project-","./dist/hpc/prof/mix/project"]

The log output is just the normal Tasty test output.

Last edited 4 years ago by LukeHoersten (previous) (diff)

comment:3 Changed 4 years ago by LukeHoersten

Turns out this was my fault: Using --enable-coverage on cabal install was causing deps to get included in the mix file but for some reason no tix were being generated for the deps. Either way, I did not want deps to be tested for coverage.

Is this correct behavior that using --enable-coverage on cabal install should include deps in the mix file? It seems like that is never correct and for someone only using 'cabal install' it will never work for them.

Also, it's unclear to me when to use -fhpc vs. --enable-coverage. Is there anywhere this is documented?

comment:4 Changed 4 years ago by LukeHoersten

Resolution: invalid
Status: newclosed

comment:5 Changed 4 years ago by rwbarton

Right, actually the problem specifically is that Cabal doesn't install the .mix files anywhere when installing a package built with --enable-coverage. So effectively you never want to use cabal install --enable-coverage. This is a Cabal issue, not a GHC issue.

Also, it's unclear to me when to use -fhpc vs. --enable-coverage. Is there anywhere this is documented?

-fhpc is an option to GHC, and --enable-coverage is an option to cabal-install. If you use --enable-coverage then Cabal will take care of passing -fhpc to GHC.

Note: See TracTickets for help on using tickets.