diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-07-09 12:37:59 -0700 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-07-09 12:37:59 -0700 |
commit | d0d68d08f4be9360c5fbeedb2edd08b8e0e8d75e (patch) | |
tree | 46d0766f5b87750f00c7e8b0a093d509b9a52e5c | |
parent | 5fe36a3cb055dd8be94186dfb75d5be3499956af (diff) | |
download | qtlocation-mapboxgl-d0d68d08f4be9360c5fbeedb2edd08b8e0e8d75e.tar.gz |
fix automated headless testing on travis
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .travis.yml | 11 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | bin/build-shaders.js | 12 | ||||
-rw-r--r-- | llmr.gyp | 8 | ||||
-rwxr-xr-x | scripts/deploy_results.sh | 12 | ||||
-rw-r--r-- | scripts/flags.sh | 31 | ||||
-rwxr-xr-x | scripts/run_tests.sh | 8 | ||||
-rwxr-xr-x | scripts/setup_travis.sh | 39 | ||||
-rwxr-xr-x | setup-libraries.sh | 14 | ||||
-rw-r--r-- | src/map/map.cpp | 13 | ||||
-rw-r--r-- | test/fixtures/styles/0.actual.png | bin | 9451 -> 0 bytes | |||
-rw-r--r-- | test/fixtures/styles/1.actual.png | bin | 31356 -> 0 bytes |
13 files changed, 85 insertions, 68 deletions
diff --git a/.gitignore b/.gitignore index e62b74b4a7..7c565ffc13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store *.xcodeproj *.o +*.actual.png /node_modules /mapnik-packaging /macosx/build diff --git a/.travis.yml b/.travis.yml index d88fa71e8d..dddd096c86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,8 @@ env: - secure: "Cbvap9ubVKgjPe3hUhI6JGeDZzBXHpOG9RaYKh+SdoIPhKnlJiNOYm1egomi+e4uqJInlFKuVHTw7Ng9Cun6Zm0jIxpkSchv1GpsR7hmB3UGnGed19Dw8121FwuUaktN+4YnbVlsyd+u8EHD3+h58t4eELrLrZolM4rS7DL6caA=" before_install: -- source ./scripts/setup_travis.sh +- ./scripts/setup_travis.sh +- source ./scripts/flags.sh install: - make setup @@ -25,8 +26,12 @@ before_script: - rm -rf mapnik-packaging/out/packages script: -- make linux BUILDTYPE=${BUILDTYPE} -- make run-tests BUILDTYPE=${BUILDTYPE} +- make linux -j4 BUILDTYPE=${BUILDTYPE} +- make test -j4 BUILDTYPE=${BUILDTYPE} +- ./scripts/run_tests.sh + +after_script: +- ./scripts/deploy_results.sh notifications: hipchat: @@ -27,10 +27,6 @@ build/test/Makefile: src common config.gypi test/test.gyp test: build/test/Makefile $(MAKE) -C build/test BUILDTYPE=$(BUILDTYPE) V=$(V) test -# Runs all test cases -run-tests: test - BUILDTYPE=$(BUILDTYPE) ./scripts/run_tests.sh - test/%: build/test/Makefile $(MAKE) -C build/test BUILDTYPE=$(BUILDTYPE) V=$(V) $* (cd build/$(BUILDTYPE) && exec ./test_$*) diff --git a/bin/build-shaders.js b/bin/build-shaders.js index b5072c3707..9679521e6b 100755 --- a/bin/build-shaders.js +++ b/bin/build-shaders.js @@ -117,12 +117,14 @@ module.exports = function(shader_type, prefix, suffix) { code += '\n};\n'; code += suffix + '\n'; - var file_path = path.join(process.argv[2], 'include/llmr/shader/shaders.hpp'); - mkdirp.sync(path.dirname(file_path)); - fs.writeFileSync(file_path, header); - var header_path = path.join(process.argv[2], 'src/shader/shaders_' + shader_type + '.cpp'); + var header_path = path.join(process.argv[2], 'include/llmr/shader/shaders.hpp'); mkdirp.sync(path.dirname(header_path)); - fs.writeFileSync(header_path, code); + fs.writeFileSync(header_path, header); + console.warn('wrote file ' + header_path); + var file_path = path.join(process.argv[2], 'src/shader/shaders_' + shader_type + '.cpp'); + mkdirp.sync(path.dirname(file_path)); + fs.writeFileSync(file_path, code); + console.warn('wrote file ' + file_path); }; @@ -15,9 +15,9 @@ '<!@(find src -name "*.glsl")' ], 'outputs': [ - 'include/llmr/shader/shaders.hpp', - 'src/shader/shaders_gl.cpp', - 'src/shader/shaders_gles2.cpp', + '<(SHARED_INTERMEDIATE_DIR)/include/llmr/shader/shaders.hpp', + '<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gl.cpp', + '<(SHARED_INTERMEDIATE_DIR)/src/shader/shaders_gles2.cpp', ], 'action': ['<@(node)', 'bin/build-shaders.js', '<(SHARED_INTERMEDIATE_DIR)'], } @@ -84,6 +84,7 @@ 'target_name': 'llmr-x86', 'product_name': 'llmr-x86', 'type': 'static_library', + 'hard_dependency': 1, 'dependencies': [ 'build_stylesheet', 'shaders', @@ -151,6 +152,7 @@ 'target_name': 'llmr-ios', 'product_name': 'llmr-ios', 'type': 'static_library', + 'hard_dependency': 1, 'dependencies': [ 'build_stylesheet', 'shaders', diff --git a/scripts/deploy_results.sh b/scripts/deploy_results.sh new file mode 100755 index 0000000000..9877f99843 --- /dev/null +++ b/scripts/deploy_results.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +aws s3 cp test/fixtures/styles/ s3://mapbox-gl-testing/headless/$TRAVIS_BUILD_NUMBER/$TRAVIS_JOB_NUMBER/ --acl public-read --recursive --exclude "*" --include "*.png" + +cd test/fixtures/styles +for FILE in *.png ; do + echo http://mapbox-gl-testing.s3.amazonaws.com/headless/$TRAVIS_BUILD_NUMBER/$TRAVIS_JOB_NUMBER/$FILE +done +cd ../../.. diff --git a/scripts/flags.sh b/scripts/flags.sh new file mode 100644 index 0000000000..0c0981cdc1 --- /dev/null +++ b/scripts/flags.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then + export DISPLAY=:99.0 + sh -e /etc/init.d/xvfb start + + # use g++ that supports c++11 + if [[ ${CXX} == "g++" ]]; then + export CXX="g++-4.8" ; + fi + + # If building in debug then turn on sanitizers. + # They should both work with latest g++/clang++ + # but it's not worth a standalone matrix so here + # we just test address->gcc and thread->clang for + # some limited coverage + if [[ ${BUILDTYPE} == "Debug" ]]; then + if [[ ${CXX} == "g++" ]]; then + export CXXFLAGS="-fsanitize=address ${CXXFLAGS}" + export CFLAGS="-fsanitize=address ${CFLAGS}" + export LDFLAGS="-fsanitize=address ${LDFLAGS}" + elif [[ ${CXX} == "clang++" ]]; then + export CXXFLAGS="-fsanitize=thread -fPIC ${CXXFLAGS}" + export CFLAGS="-fsanitize=thread ${CFLAGS}" + export LDFLAGS="-fsanitize=thread -pie ${LDFLAGS}" + fi + fi +fi + +# turn off a few warnings +export CXXFLAGS="-Wno-unknown-warning-option -Wno-unused-local-typedefs -Wno-unknown-pragmas ${CXXFLAGS}"; diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 3d0c0bdd95..be65356baf 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -3,8 +3,10 @@ set -e set -o pipefail -cd build/$BUILDTYPE +BUILDTYPE="${BUILDTYPE:-Release}" -for TEST in test_* ; do - ./$TEST +cd build/${BUILDTYPE} + +for TEST in ./test_* ; do + ${TEST} done diff --git a/scripts/setup_travis.sh b/scripts/setup_travis.sh index 3b819ea81e..128f6bbf72 100755 --- a/scripts/setup_travis.sh +++ b/scripts/setup_travis.sh @@ -3,15 +3,6 @@ set -e set -o pipefail -# enable testing locally (not on travis) -if [[ "${TRAVIS_OS_NAME:-false}" == false ]]; then - if [[ $(uname -s) == "Darwin" ]]; then - TRAVIS_OS_NAME="osx" - elif [[ $(uname -s) == "Linux" ]]; then - TRAVIS_OS_NAME="linux" - fi -fi - if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then if [[ `lsb_release -r` =~ "12.04" ]]; then @@ -19,36 +10,10 @@ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then fi sudo apt-get update -y sudo apt-get -y install gcc-4.8 g++-4.8 - sudo apt-get -y install git build-essential zlib1g-dev automake libtool xutils-dev make cmake pkg-config + sudo apt-get -y install git build-essential zlib1g-dev automake libtool xutils-dev make cmake pkg-config python-pip sudo apt-get -y install libxi-dev libglu1-mesa-dev x11proto-randr-dev x11proto-xext-dev libxrandr-dev x11proto-xf86vidmode-dev libxxf86vm-dev libxcursor-dev - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - - # use g++ that supports c++11 - if [[ ${CXX} == "g++" ]]; then - export CXX="g++-4.8" ; - fi - - # If building in debug then turn on sanitizers. - # They should both work with latest g++/clang++ - # but it's not worth a standalone matrix so here - # we just test address->gcc and thread->clang for - # some limited coverage - if [[ ${BUILDTYPE} == "Debug" ]]; then - if [[ ${CXX} == "g++" ]]; then - export CXXFLAGS="-fsanitize=address ${CXXFLAGS}" - export CFLAGS="-fsanitize=address ${CFLAGS}" - export LDFLAGS="-fsanitize=address ${LDFLAGS}" - elif [[ ${CXX} == "clang++" ]]; then - export CXXFLAGS="-fsanitize=thread -fPIC ${CXXFLAGS}" - export CFLAGS="-fsanitize=thread ${CFLAGS}" - export LDFLAGS="-fsanitize=thread -pie ${LDFLAGS}" - fi - fi + sudo pip install awscli elif [[ ${TRAVIS_OS_NAME} == "osx" ]]; then brew install autoconf automake libtool makedepend cmake pkg-config node git fi - -# turn off a few warnings -export CXXFLAGS="-Wno-unknown-warning-option -Wno-unused-local-typedefs -Wno-unknown-pragmas ${CXXFLAGS}"; diff --git a/setup-libraries.sh b/setup-libraries.sh index 3642d91ff4..aa0360d988 100755 --- a/setup-libraries.sh +++ b/setup-libraries.sh @@ -96,6 +96,13 @@ cd ../../ elif [ ${UNAME} = 'Linux' ]; then +if [ ! -z "${TRAVIS:-}" ]; then + if aws s3 cp s3://mapbox-gl-testing/dependencies/build-cpp11-libstdcpp-gcc-x86_64-linux.tar.gz ./out/ ; then + rm -rf out/build-cpp11-libstdcpp-gcc-x86_64-linux + tar -xzf out/build-cpp11-libstdcpp-gcc-x86_64-linux.tar.gz + fi +fi + source Linux.sh if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/libglfw3.a ] ; then ./scripts/build_glfw.sh ; fi if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/libpng.a ] ; then ./scripts/build_png.sh ; fi @@ -104,6 +111,13 @@ source Linux.sh if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/libcurl.a ] ; then ./scripts/build_curl.sh ; fi if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/libboost_regex.a ] ; then ./scripts/build_boost.sh --with-regex ; fi +if [ ! -z "${TRAVIS:-}" ]; then + if ! tar --compare -zf out/build-cpp11-libstdcpp-gcc-x86_64-linux.tar.gz ; then + tar -zcf out/build-cpp11-libstdcpp-gcc-x86_64-linux.tar.gz out/build-cpp11-libstdcpp-gcc-x86_64-linux + aws s3 cp out/build-cpp11-libstdcpp-gcc-x86_64-linux.tar.gz s3://mapbox-gl-testing/dependencies/ + fi +fi + cd ../../ ./configure \ --pkg-config-root=`pwd`/mapnik-packaging/osx/out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/pkgconfig \ diff --git a/src/map/map.cpp b/src/map/map.cpp index b04f88a546..516e8fe03f 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -491,15 +491,6 @@ void Map::render() { painter.drawClippingMasks(style->getActiveSources()); -#if defined(DEBUG) - // Generate debug information - size_t source_id = 0; - for (const std::shared_ptr<Source> &source : style->getActiveSources()) { - size_t count = source->getTileCount(); - debug.emplace_back(util::sprintf<100>("source %d: %d\n", source_id, count)); - source_id++; - } -#endif // Actually render the layers if (debug::renderTree) { std::cout << "{" << std::endl; indent++; } renderLayers(style->layers); @@ -515,10 +506,6 @@ void Map::render() { painter.renderMatte(); -#if defined(DEBUG) - painter.renderDebugText(debug); -#endif - // Schedule another rerender when we definitely need a next frame. if (transform.needsTransition() || style->hasTransitions()) { update(); diff --git a/test/fixtures/styles/0.actual.png b/test/fixtures/styles/0.actual.png Binary files differdeleted file mode 100644 index 34e984cce3..0000000000 --- a/test/fixtures/styles/0.actual.png +++ /dev/null diff --git a/test/fixtures/styles/1.actual.png b/test/fixtures/styles/1.actual.png Binary files differdeleted file mode 100644 index d34c46a6c9..0000000000 --- a/test/fixtures/styles/1.actual.png +++ /dev/null |