From 66347f78e6bf3998f4bf7d7c3a82aafd6f0bcaa6 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 22 Nov 2013 12:01:02 -0800 Subject: [PATCH] rework tests: always run locally --- .gitignore | 3 +- Makefile | 31 ++++++++----------- SConstruct | 2 +- benchmark/run | 2 ++ {utils/mapnik-config => bin}/build.py | 0 .../mapnik-config.template.sh | 0 run_tests | 9 +++--- tests/cpp_tests/run | 18 +++++++++++ 8 files changed, 39 insertions(+), 26 deletions(-) rename {utils/mapnik-config => bin}/build.py (100%) rename {utils/mapnik-config => bin}/mapnik-config.template.sh (100%) create mode 100755 tests/cpp_tests/run diff --git a/.gitignore b/.gitignore index 7080486b4..3a3a81a1c 100644 --- a/.gitignore +++ b/.gitignore @@ -19,8 +19,7 @@ demo/viewer/viewer.ini tests/cpp_tests/font_registration_test tests/python_tests/raster_colorizer_test.png tests/python_tests/raster_colorizer_test_save.xml -utils/mapnik-config/mapnik-config -utils/mapnik-config/mapnik2.pc +bin/mapnik-config utils/shapeindex/shapeindex utils/ogrindex/ogrindex utils/pgsql2sqlite/pgsql2sqlite diff --git a/Makefile b/Makefile index 8c05035d5..18d237d77 100755 --- a/Makefile +++ b/Makefile @@ -1,11 +1,5 @@ UNAME := $(shell uname) -LINK_FIX=LD_LIBRARY_PATH -ifeq ($(UNAME), Darwin) - LINK_FIX=DYLD_LIBRARY_PATH -else -endif - -OS:=$(shell uname -s) +OS := $(shell uname -s) ifeq ($(JOBS),) JOBS:=1 @@ -49,25 +43,26 @@ uninstall: @python scons/scons.py -j$(JOBS) --config=cache --implicit-cache --max-drift=1 uninstall test: - @ ./run_tests + ./run_tests test-local: - @echo "*** Boostrapping local test environment..." - @export ${LINK_FIX}=`pwd`/src:${${LINK_FIX}} && \ - export PATH=`pwd`/utils/mapnik-config/:${PATH} && \ - export PYTHONPATH=`pwd`/bindings/python/:${PYTHONPATH} && \ - export MAPNIK_FONT_DIRECTORY=`pwd`/fonts/dejavu-fonts-ttf-2.33/ttf/ && \ - export MAPNIK_INPUT_PLUGINS_DIRECTORY=`pwd`/plugins/input/ && \ make test -bench: - @export ${LINK_FIX}=`pwd`/src:${${LINK_FIX}} && \ - ./benchmark/run +test-visual: + $(shell source ./localize.sh && python tests/visual_tests/test.py -q) + +test-python: + $(shell source ./localize.sh && python tests/run_tests.py -q) + +test-cpp: + ./tests/cpp_tests/run check: test-local +bench: + LOCALIZE=true ./benchmark/run + demo: - @echo "*** Running rundemo.cpp…" cd demo/c++; ./rundemo `mapnik-config --prefix` pep8: diff --git a/SConstruct b/SConstruct index 1601f50bf..0dd75f130 100644 --- a/SConstruct +++ b/SConstruct @@ -2000,7 +2000,7 @@ if not HELP_REQUESTED: SConscript('benchmark/build.py') # install pkg-config script and mapnik-config script - SConscript('utils/mapnik-config/build.py') + SConscript('bin/build.py') # write the viewer.ini file SConscript('demo/viewer/build.py') diff --git a/benchmark/run b/benchmark/run index daaafe4af..a909710ca 100755 --- a/benchmark/run +++ b/benchmark/run @@ -2,6 +2,8 @@ cd "$( dirname "${BASH_SOURCE[0]}" )" cd ../ +source ./localize.sh + BASE=./benchmark/out function run { ${BASE}/$1 --threads 0 --iterations $3; diff --git a/utils/mapnik-config/build.py b/bin/build.py similarity index 100% rename from utils/mapnik-config/build.py rename to bin/build.py diff --git a/utils/mapnik-config/mapnik-config.template.sh b/bin/mapnik-config.template.sh similarity index 100% rename from utils/mapnik-config/mapnik-config.template.sh rename to bin/mapnik-config.template.sh diff --git a/run_tests b/run_tests index ccb045123..27282980a 100755 --- a/run_tests +++ b/run_tests @@ -2,16 +2,15 @@ failures=0 +source ./localize.sh + echo "*** Running visual tests..." python tests/visual_tests/test.py -q failures=$((failures+$?)) echo "*** Running C++ tests..." -for FILE in tests/cpp_tests/*-bin; do - ${FILE} -q -d .; - failures=$((failures+$?)) -done - +./tests/cpp_tests/run +failures=$((failures+$?)) echo echo "*** Running python tests..." diff --git a/tests/cpp_tests/run b/tests/cpp_tests/run new file mode 100755 index 000000000..34a15fc40 --- /dev/null +++ b/tests/cpp_tests/run @@ -0,0 +1,18 @@ +#!/bin/bash + +cd "$( dirname "${BASH_SOURCE[0]}" )" +cd ../../ +source ./localize.sh + +failures=0 +if [ -n "$(find tests/cpp_tests/ -maxdepth 1 -name '*-bin' -print -quit)" ]; then + for FILE in tests/cpp_tests/*-bin; do + ${FILE} -q -d .; + failures=$((failures+$?)) + done + echo +else + echo 'warning: no c++ tests found' +fi +exit $failures +