summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndor Penzes <andor.penzes@gmail.com>2016-01-09 20:31:14 +0100
committerAndor Penzes <andor.penzes@gmail.com>2016-01-09 20:31:14 +0100
commit69650452f373514df079cd841f2dff414ba127df (patch)
tree4e2ae6b7580d362621af6c54a638ebc0bae5b028
parenta86447b6eb336eb451ba2f1e905100833097b8d0 (diff)
separate coverage test suite
-rw-r--r--.travis.yml2
-rwxr-xr-xcreate-test-report.sh2
-rw-r--r--lambdacube-compiler.cabal38
-rwxr-xr-xrun-test-suite.sh17
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:
12 12
13script: 13script:
14 - docker run --rm -it -v `pwd`:/root/source/lambdacube-compiler lambdacube3d/lambdacube3d 14 - docker run --rm -it -v `pwd`:/root/source/lambdacube-compiler lambdacube3d/lambdacube3d
15 /bin/sh -c "cd /root/source/lambdacube-compiler;./run-test-suite.sh" 15 /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}
6HPC_REPO_DIR=$HPC_DIR 6HPC_REPO_DIR=$HPC_DIR
7 7
8TEST_DIR=src/UnitTest 8TEST_DIR=src/UnitTest
9TIX=lambdacube-compiler-test-suite.tix 9TIX=lambdacube-compiler-coverage-test-suite.tix
10 10
11hpc markup ${TIX} --hpcdir=${HPC_DIR} --destdir=${HPC_REPO_DIR} 11hpc markup ${TIX} --hpcdir=${HPC_DIR} --destdir=${HPC_REPO_DIR}
12hpc report ${TIX} --hpcdir=${HPC_DIR} --per-module 12hpc 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
16 Description: Enable profiling 16 Description: Enable profiling
17 Default: False 17 Default: False
18 18
19Flag coverage
20 Description: Enable coverage reporting
21 Default: False
22
19library 23library
20 exposed-modules: 24 exposed-modules:
21 -- Compiler 25 -- Compiler
@@ -87,6 +91,8 @@ executable lambdacube-compiler-unit-tests
87executable lambdacube-compiler-test-suite 91executable lambdacube-compiler-test-suite
88 hs-source-dirs: test 92 hs-source-dirs: test
89 main-is: runTests.hs 93 main-is: runTests.hs
94 default-language: Haskell2010
95 GHC-Options: -O2
90 96
91 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository 97 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository
92 build-depends: 98 build-depends:
@@ -107,8 +113,38 @@ executable lambdacube-compiler-test-suite
107 text >= 1.2 && <1.3, 113 text >= 1.2 && <1.3,
108 lambdacube-ir, 114 lambdacube-ir,
109 vector >= 0.11 && <0.12 115 vector >= 0.11 && <0.12
110 default-language: Haskell2010 116
117
118executable lambdacube-compiler-coverage-test-suite
119 hs-source-dirs: src, test
120 main-is: runTests.hs
121 default-language: Haskell2010
122
123 if flag(coverage)
124 Buildable: True
125 else
126 Buildable: False
127
111 if flag(profiling) 128 if flag(profiling)
112 GHC-Options: -O2 -fhpc -hpcdir dist/hpc/lambdacube-compiler -prof -fprof-auto -rtsopts 129 GHC-Options: -O2 -fhpc -hpcdir dist/hpc/lambdacube-compiler -prof -fprof-auto -rtsopts
113 else 130 else
114 GHC-Options: -O2 -fhpc -hpcdir dist/hpc/lambdacube-compiler 131 GHC-Options: -O2 -fhpc -hpcdir dist/hpc/lambdacube-compiler
132
133 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository
134 build-depends:
135 aeson >= 0.9 && <1,
136 async >= 2.0 && <2.1,
137 base < 4.9,
138 containers >=0.5 && <0.6,
139 deepseq,
140 directory,
141 exceptions >= 0.8 && <0.9,
142 filepath,
143 mtl >=2.2 && <2.3,
144 monad-control >= 1.0 && <1.1,
145 parsec >= 3.1 && <3.2,
146 indentation >= 0.2 && <0.3,
147 pretty-compact >=1.0 && <1.1,
148 text >= 1.2 && <1.3,
149 lambdacube-ir,
150 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
6 cabal sandbox delete 6 cabal sandbox delete
7 cabal sandbox init 7 cabal sandbox init
8 cabal install --only-dependencies --enable-library-profiling --enable-executable-profiling --constraint="indentation -trifecta" 8 cabal install --only-dependencies --enable-library-profiling --enable-executable-profiling --constraint="indentation -trifecta"
9 cabal configure --flags "profiling" --enable-library-profiling --enable-executable-profiling 9 cabal configure --flags "profiling coverage" --enable-library-profiling --enable-executable-profiling
10 cabal build 10 cabal build
11 set +e 11 set +e
12 cabal run lambdacube-compiler-unit-tests 12 cabal run lambdacube-compiler-unit-tests
13 RESULT_UNITTESTS=`echo $?` 13 RESULT_UNITTESTS=`echo $?`
14 cabal run lambdacube-compiler-test-suite -- -r $@ +RTS -p 14 cabal run lambdacube-compiler-coverage-test-suite -- -r $@ +RTS -p
15 RESULT_TESTS=`echo $?` 15 RESULT_TESTS=`echo $?`
16 ./create-test-report.sh 16 ./create-test-report.sh
17 rm lambdacube-compiler-test-suite.tix 17 rm lambdacube-compiler-test-suite.tix
18 cabal sandbox delete 18 cabal sandbox delete
19 cabal clean 19 cabal clean
20elif [ "$1" == "--coverage" ] ; then
21 shift
22 set +e
23 cabal install --only-dependencies -j1
24 cabal configure --flags "coverage"
25 cabal run lambdacube-compiler-unit-tests
26 RESULT_UNITTESTS=`echo $?`
27 cabal run lambdacube-compiler-coverage-test-suite -- -r $@
28 RESULT_TESTS=`echo $?`
29 ./create-test-report.sh
30 rm lambdacube-compiler-coverage-test-suite.tix
20else 31else
21 set +e 32 set +e
22 cabal install --only-dependencies -j1 33 cabal install --only-dependencies -j1
@@ -24,8 +35,6 @@ else
24 RESULT_UNITTESTS=`echo $?` 35 RESULT_UNITTESTS=`echo $?`
25 cabal run lambdacube-compiler-test-suite -- -r $@ 36 cabal run lambdacube-compiler-test-suite -- -r $@
26 RESULT_TESTS=`echo $?` 37 RESULT_TESTS=`echo $?`
27 ./create-test-report.sh
28 rm lambdacube-compiler-test-suite.tix
29fi 38fi
30 39
31if [[ $RESULT_UNITTESTS -ne 0 ]]; then 40if [[ $RESULT_UNITTESTS -ne 0 ]]; then