on 404bfdd help sign in
servant/scripts/test-all.sh
46 lines 1.1 kB history raw
1#!/bin/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 )
18GHC_FLAGS="-Werror"
19SOURCES_TXT="$( dirname $DIR)/sources.txt"
20CABAL=${CABAL:-cabal}
22declare -a SOURCES
23readarray -t SOURCES < "$SOURCES_TXT"
26prepare_sandbox () {
27 $CABAL sandbox init
28 for s in ${SOURCES[@]} ; do
29 (cd "$s" && $CABAL sandbox init --sandbox=../.cabal-sandbox/ && $CABAL sandbox add-source .)
30 done
31 $CABAL install --enable-tests ${SOURCES[@]}
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