Kabbalah and HPC and errors when running tests with code coverage

I use Cabal to run my tests.

Here's how it is configured in the file .cabal:

test-suite test
    type:           exitcode-stdio-1.0
    main-is:        Test.hs
    build-depends:  base >= 4.7 && < 4.8, containers >=0.5 && <0.6, ghc, test-framework >=0.8 && <0.9, QuickCheck >=2.7 && <2.8, HUnit >=1.2 && <1.3, test-framework-hunit, test-framework-quickcheck2
    default-language:    Haskell2010
    ghc-options:    -Wall -fhpc

When I run the test for the first time, everything is fine.

However, if I change the tests and run them again, I get the following error:

Hpc failure: module mismatch with .tix/.mix file hash number
(perhaps remove test.tix file?)

So, I need to manually delete the file .tix.

Is there any way to get rid of this problem?

By the way, is there a way to create this .tixfile generated in the directory dist, and not in the root directory?

How can I configure my Cabal file to work with HPC (i.e. generated HTML files in a directory dist)?

Thank.

+4
source share
2 answers

cabal , :

cabal configure --enable-coverage

:

cabal test

, --enable-library-coverage cabal. IIRC hpc cabal ghc-7.6.

+4

GHC 7.8.3 Cabal 1.22.0.0

.tix .

  • HPCTIXDIR. tix . -.tix , .

  • HPCTIXFILE. tix , . . .

+1

All Articles