Created
December 13, 2011 03:32
-
-
Save VoQn/1470421 to your computer and use it in GitHub Desktop.
Sample cabal configuration for HPC Test Coverage
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
-- example app.cabal file | |
Name: app | |
Version: 1.0 | |
-- ... | |
Build-type: Simple | |
Cabal-version: >= 1.2 | |
Tested-with: GHC >= 7.0.2 | |
Library | |
default-language: Haskell2010 | |
GHC-Options: -Wall -O2 | |
hs-source-dirs: src/ | |
Build-depends: base, mtl, random -- add dependency cabal library | |
Test-Suite unit-test | |
default-langurage: Haskell2010 | |
type: exitcode-stdio-1.0 | |
hs-source-dirs: src/ | |
Main-is: Test.hs | |
Build-depends: test-framework, test-framework-hunit, | |
test-framework-quickcheck2, HUnit, QuickCheck | |
GHC-Options: -fhpc -hpcdir dist/hpc/app-1.0 |
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
import Distribution.Simple | |
main = defaultMain |
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
#! /bin/sh | |
CABAL_NAME=app | |
CABAL_VER=1.0 | |
HPC_DIR=dist/hpc/${CABAL_NAME}-${CABAL_VER} | |
HPC_REPO_DIR=dist/test/unit-test | |
TEST_DIR=src/UnitTest | |
TIX=${HPC_REPO_DIR}/unit-test | |
TEST_MODULES=(`find ${TEST_DIR} -name "*.hs" | sed -e "s/\.hs$//g" | sed -e "s/^src\///g" | sed -e "s/\//\./g"`) | |
for ITEM in ${TEST_MODULES[@]} | |
do | |
EXCLUDES="${EXCLUDES} --exclude ${ITEM}" | |
done | |
hpc report ${TIX} ${EXCLUDES} --hpcdir=${HPC_DIR} --xml-output > ${HPC_REPO_DIR}/result.xml | |
hpc markup ${TIX} ${EXCLUDES} --hpcdir=${HPC_DIR} --destdir=${HPC_REPO_DIR} | |
open ${HPC_REPO_DIR}/hpc_index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment