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