servant/scripts/test-all.sh

43 lines
1,023 B
Bash
Raw Permalink Normal View History

2015-04-20 11:57:55 +02:00
#!/bin/bash -
#===============================================================================
#
# FILE: test-all.sh
#
# USAGE: ./test-all.sh
#
# DESCRIPTION: Run tests for all source directories listed in $SOURCES.
# Uses local versions of those sources.
#
2015-04-20 19:13:06 +02:00
# REQUIREMENTS: bash >= 4
2015-04-20 11:57:55 +02:00
#===============================================================================
set -o nounset
set -o errexit
2015-06-05 15:08:52 +02:00
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "$DIR"/lib/common.sh
GHC_FLAGS="-Werror"
2015-04-20 11:57:55 +02:00
prepare_sandbox () {
2015-04-20 19:52:29 +02:00
$CABAL sandbox init
2015-04-20 11:57:55 +02:00
for s in ${SOURCES[@]} ; do
(cd "$s" && $CABAL sandbox init --sandbox=../.cabal-sandbox/ && $CABAL sandbox add-source .)
2015-04-20 11:57:55 +02:00
done
$CABAL install --enable-tests ${SOURCES[@]}
2015-04-20 11:57:55 +02:00
}
test_each () {
for s in ${SOURCES[@]} ; do
echo "Testing $s..."
pushd "$s"
2015-04-20 19:52:29 +02:00
$CABAL configure --enable-tests --ghc-options="$GHC_FLAGS"
$CABAL build
$CABAL test
popd
2015-04-20 11:57:55 +02:00
done
}
prepare_sandbox
test_each