2016-05-03 21:17:06 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
function testcmd()
|
|
|
|
{
|
|
|
|
local name=$1
|
|
|
|
shift
|
|
|
|
local command=$*
|
|
|
|
|
|
|
|
echo "== ${name}"
|
|
|
|
if $command; then
|
|
|
|
echo
|
|
|
|
else
|
|
|
|
echo "== FAILED"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-06-06 00:03:30 +03:00
|
|
|
function testdejafu()
|
|
|
|
{
|
|
|
|
local name=$1
|
|
|
|
shift
|
|
|
|
local stackopts=$*
|
|
|
|
|
|
|
|
echo "== $name"
|
|
|
|
if ! stack $stackopts build dejafu-tests; then
|
|
|
|
echo "== FAILED (build)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if ! stack $stackopts exec dejafu-tests; then
|
|
|
|
echo "== FAILED (test)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-05-03 21:17:06 +03:00
|
|
|
# Set the resolver. Uses the environment variable "RESOLVER" if set,
|
|
|
|
# otherwise whatever is in the "stack.yaml" file.
|
|
|
|
STACKOPTS="--no-terminal --install-ghc --resolver=$RESOLVER"
|
|
|
|
if [[ "$RESOLVER" == "" ]]; then
|
|
|
|
STACKOPTS="--no-terminal --install-ghc"
|
|
|
|
fi
|
|
|
|
|
2016-10-22 18:02:31 +03:00
|
|
|
stack $STACKOPTS setup
|
|
|
|
|
2016-06-06 00:49:00 +03:00
|
|
|
# Test dejafu-0.2 compat of async/hunit/tasty-dejafu
|
|
|
|
if [[ -z "$SKIP_OLD_DEJAFU" ]]; then
|
|
|
|
sed 's:^- dejafu$::' stack.yaml > stack-old-dejafu.yaml
|
|
|
|
sed -i 's/^extra-deps: \[\]/extra-deps: [ dejafu-0.2.0.0 ]/' stack-old-dejafu.yaml
|
|
|
|
|
2016-06-21 00:39:44 +03:00
|
|
|
for pkg in hunit-dejafu tasty-dejafu; do
|
2016-06-06 00:49:00 +03:00
|
|
|
testcmd "${pkg} (dejafu-0.2)" stack $STACKOPTS --stack-yaml=stack-old-dejafu.yaml test $pkg
|
|
|
|
done
|
|
|
|
fi
|
2016-05-03 21:17:06 +03:00
|
|
|
|
2016-06-06 00:03:30 +03:00
|
|
|
# Test dpor-0.1 compat of dejafu
|
|
|
|
if [[ -z "$SKIP_OLD_DPOR" ]]; then
|
|
|
|
# Use 0.1.0.1 because it builds with ghc 8.
|
|
|
|
sed 's:^- dpor$::' stack.yaml > stack-old-dpor.yaml
|
|
|
|
sed -i 's/^extra-deps: \[\]/extra-deps: [ dpor-0.1.0.1 ]/' stack-old-dpor.yaml
|
|
|
|
|
|
|
|
testdejafu "dejafu (dpor-0.1)" $STACKOPTS --stack-yaml=stack-old-dpor.yaml
|
|
|
|
fi
|
|
|
|
|
2016-06-06 00:49:00 +03:00
|
|
|
# Test HEAD version of everything
|
2016-05-03 21:17:06 +03:00
|
|
|
testcmd "dpor" stack $STACKOPTS test dpor
|
|
|
|
|
2016-06-06 00:03:30 +03:00
|
|
|
testdejafu "dejafu" $STACKOPTS
|
2016-05-03 21:17:06 +03:00
|
|
|
|
|
|
|
for pkg in hunit-dejafu tasty-dejafu async-dejafu; do
|
|
|
|
testcmd "${pkg}" stack $STACKOPTS test $pkg
|
|
|
|
done
|