git.iko.soy/typeable/servant
on v0.6 help sign in
46 lines 1.2 kB history raw
1#!/usr/bin/env bash
2#===============================================================================
3#
4# FILE: test-all.sh
5#
6# USAGE: ./test-all.sh
7#
8# DESCRIPTION: Run tests for all source directories listed in $SOURCES.
9# Uses local versions of those sources.
11# REQUIREMENTS: bash >= 4
12#===============================================================================
14set -o nounset
15set -o errexit
17DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
18. "$DIR"/lib/common.sh
20GHC_FLAGS="-Werror"
22prepare_sandbox () {
23 $CABAL sandbox init
24 for s in ${SOURCES[@]} ; do
25 (cd "$s" && $CABAL sandbox init --sandbox=../.cabal-sandbox/ && $CABAL sandbox add-source .)
26 done
27 if $TRAVIS ; then
28 travis_retry $CABAL install --enable-tests ${SOURCES[@]}
29 else
30 $CABAL install --max-backjumps -1 --reorder-goals --enable-tests ${SOURCES[@]}
31 fi
34test_each () {
35 for s in ${SOURCES[@]} ; do
36 echo "Testing $s..."
37 pushd "$s"
38 $CABAL configure --enable-tests --ghc-options="$GHC_FLAGS"
39 $CABAL build
40 $CABAL test
41 popd
42 done
45prepare_sandbox
46test_each