servant/scripts/test-all.sh

47 lines
1.1 KiB
Bash
Raw 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
2015-06-12 13:34:46 +02:00
if $TRAVIS ; then
2015-06-12 15:45:27 +02:00
travis_retry $CABAL install -v --enable-tests ${SOURCES[@]}
2015-06-12 13:34:46 +02:00
else
2015-06-12 15:45:27 +02:00
$CABAL install --enable-tests ${SOURCES[@]}
2015-06-12 13:34:46 +02:00
fi
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