summaryrefslogtreecommitdiff
path: root/run-test-suite.sh
blob: 88889a34a5d4f018201fb723d6d380651c5d0726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash -e

if [ "$1" == "--profile" ] ; then
  shift
  cabal clean
  cabal sandbox delete
  cabal sandbox init
  cabal install --only-dependencies --enable-library-profiling --enable-executable-profiling --constraint="indentation -trifecta"
  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-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
  cabal run lambdacube-compiler-unit-tests
  RESULT_UNITTESTS=`echo $?`
  cabal run lambdacube-compiler-test-suite -- -r $@
  RESULT_TESTS=`echo $?`
fi

if [[ $RESULT_UNITTESTS -ne 0 ]]; then
  echo "***************************"
  echo "* Unit tests are failing. *"
  echo "***************************"
fi

if [[ $RESULT_TESTS -ne 0 ]]; then
  echo "*******************************"
  echo "* Compiler tests are failing. *"
  echo "*******************************"
fi

exit $((RESULT_TESTS + RESULT_UNITTESTS))