mapnik/test/run

67 lines
1.9 KiB
Text
Raw Normal View History

#!/usr/bin/env bash
2015-04-26 22:45:12 +00:00
2016-05-18 17:38:07 +00:00
set -o pipefail
set -eu
2015-04-26 22:45:12 +00:00
failures=0
cd "$( dirname "${BASH_SOURCE[0]}" )"
cd ../
2015-04-26 22:45:12 +00:00
source ./localize.sh
function run_step { >&2 echo -e "\033[1m\033[34m* $1\033[0m"; }
function run_substep { >&2 echo -e "\033[1m\033[36m* $1\033[0m"; }
function run_success { >&2 echo -e "\033[1m\033[32m* $1\033[0m"; }
function run_warn { >&2 echo -e "\033[1m\033[31m* $1\033[0m"; }
run_step "Starting Mapnik tests"
2015-04-26 22:45:12 +00:00
ran_a_test=false
if [ -d "test/data" ]; then
2015-04-26 22:45:12 +00:00
run_substep "Running C++ Unit tests..."
if [[ -f ./test/unit/run ]]; then
ran_a_test=true
2016-05-18 17:38:07 +00:00
./test/unit/run || failures=$((failures+$?))
else
run_warn "Skipping unit tests since they were not built"
fi
run_substep "Running standalone C++ tests..."
found_test=false
if [ -n "$(find test/standalone/ -maxdepth 1 -name '*-bin' -print -quit)" ]; then
for FILE in test/standalone/*-bin; do
found_test=true
ran_a_test=true
2016-05-18 17:38:07 +00:00
${FILE} || failures=$((failures+$?))
done
fi
if [[ $found_test == false ]]; then
run_warn "Skipping standalone tests since they were not built"
fi
if [ -d "test/data-visual/styles" ]; then
run_substep "Running visual tests..."
if [ -z "${JOBS:-}" ]; then
JOBS=1
fi
2016-03-12 02:08:08 +00:00
if [[ -f ./test/visual/run ]]; then
ran_a_test=true
2016-05-18 17:38:07 +00:00
./test/visual/run -j $JOBS || failures=$((failures+$?))
else
run_warn "Skipping visual tests since they were not built"
fi
else
echo "Notice: Skipping visual tests, the visual tests data are not present under the standard directory \"test/data-visual\"."
fi
else
echo "Notice: Skipping all tests, the test data are not present under the standard directory \"test/data\"."
fi
2015-02-17 16:28:49 +00:00
if [[ $ran_a_test == false ]]; then
run_warn "**** WARNING: no tests were run ****"
fi
2015-02-17 16:28:49 +00:00
exit $failures