From 69650452f373514df079cd841f2dff414ba127df Mon Sep 17 00:00:00 2001 From: Andor Penzes Date: Sat, 9 Jan 2016 20:31:14 +0100 Subject: separate coverage test suite --- .travis.yml | 2 +- create-test-report.sh | 2 +- lambdacube-compiler.cabal | 38 +++++++++++++++++++++++++++++++++++++- run-test-suite.sh | 17 +++++++++++++---- 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 308b49c0..de34f4ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,4 @@ before_install: script: - docker run --rm -it -v `pwd`:/root/source/lambdacube-compiler lambdacube3d/lambdacube3d - /bin/sh -c "cd /root/source/lambdacube-compiler;./run-test-suite.sh" + /bin/sh -c "cd /root/source/lambdacube-compiler;./run-test-suite.sh --coverage" diff --git a/create-test-report.sh b/create-test-report.sh index 0afde1fb..f7ef4ec7 100755 --- a/create-test-report.sh +++ b/create-test-report.sh @@ -6,7 +6,7 @@ HPC_DIR=dist/hpc/${CABAL_NAME} HPC_REPO_DIR=$HPC_DIR TEST_DIR=src/UnitTest -TIX=lambdacube-compiler-test-suite.tix +TIX=lambdacube-compiler-coverage-test-suite.tix hpc markup ${TIX} --hpcdir=${HPC_DIR} --destdir=${HPC_REPO_DIR} hpc report ${TIX} --hpcdir=${HPC_DIR} --per-module diff --git a/lambdacube-compiler.cabal b/lambdacube-compiler.cabal index aa5ac44d..ad4a64e9 100644 --- a/lambdacube-compiler.cabal +++ b/lambdacube-compiler.cabal @@ -16,6 +16,10 @@ Flag profiling Description: Enable profiling Default: False +Flag coverage + Description: Enable coverage reporting + Default: False + library exposed-modules: -- Compiler @@ -87,6 +91,8 @@ executable lambdacube-compiler-unit-tests executable lambdacube-compiler-test-suite hs-source-dirs: test main-is: runTests.hs + default-language: Haskell2010 + GHC-Options: -O2 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository build-depends: @@ -107,8 +113,38 @@ executable lambdacube-compiler-test-suite text >= 1.2 && <1.3, lambdacube-ir, vector >= 0.11 && <0.12 - default-language: Haskell2010 + + +executable lambdacube-compiler-coverage-test-suite + hs-source-dirs: src, test + main-is: runTests.hs + default-language: Haskell2010 + + if flag(coverage) + Buildable: True + else + Buildable: False + if flag(profiling) GHC-Options: -O2 -fhpc -hpcdir dist/hpc/lambdacube-compiler -prof -fprof-auto -rtsopts else GHC-Options: -O2 -fhpc -hpcdir dist/hpc/lambdacube-compiler + + -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository + build-depends: + aeson >= 0.9 && <1, + async >= 2.0 && <2.1, + base < 4.9, + containers >=0.5 && <0.6, + deepseq, + directory, + exceptions >= 0.8 && <0.9, + filepath, + mtl >=2.2 && <2.3, + monad-control >= 1.0 && <1.1, + parsec >= 3.1 && <3.2, + indentation >= 0.2 && <0.3, + pretty-compact >=1.0 && <1.1, + text >= 1.2 && <1.3, + lambdacube-ir, + vector >= 0.11 && <0.12 diff --git a/run-test-suite.sh b/run-test-suite.sh index cbe1fe56..88889a34 100755 --- a/run-test-suite.sh +++ b/run-test-suite.sh @@ -6,17 +6,28 @@ if [ "$1" == "--profile" ] ; then cabal sandbox delete cabal sandbox init cabal install --only-dependencies --enable-library-profiling --enable-executable-profiling --constraint="indentation -trifecta" - cabal configure --flags "profiling" --enable-library-profiling --enable-executable-profiling + cabal configure --flags "profiling coverage" --enable-library-profiling --enable-executable-profiling cabal build set +e cabal run lambdacube-compiler-unit-tests RESULT_UNITTESTS=`echo $?` - cabal run lambdacube-compiler-test-suite -- -r $@ +RTS -p + cabal run lambdacube-compiler-coverage-test-suite -- -r $@ +RTS -p RESULT_TESTS=`echo $?` ./create-test-report.sh rm lambdacube-compiler-test-suite.tix cabal sandbox delete cabal clean +elif [ "$1" == "--coverage" ] ; then + shift + set +e + cabal install --only-dependencies -j1 + cabal configure --flags "coverage" + cabal run lambdacube-compiler-unit-tests + RESULT_UNITTESTS=`echo $?` + cabal run lambdacube-compiler-coverage-test-suite -- -r $@ + RESULT_TESTS=`echo $?` + ./create-test-report.sh + rm lambdacube-compiler-coverage-test-suite.tix else set +e cabal install --only-dependencies -j1 @@ -24,8 +35,6 @@ else RESULT_UNITTESTS=`echo $?` cabal run lambdacube-compiler-test-suite -- -r $@ RESULT_TESTS=`echo $?` - ./create-test-report.sh - rm lambdacube-compiler-test-suite.tix fi if [[ $RESULT_UNITTESTS -ne 0 ]]; then -- cgit v1.2.3