From 0e928b5204ad5e2a8cfc1dd1a993396be0bd9d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Fri, 24 Oct 2014 17:39:18 +0200 Subject: [PATCH] make tests work --- common.gypi => gyp/common.gypi | 0 gyp/platform-linux.gypi | 1 + gyp/platform.gypi | 16 + .../mbgl/platform/default}/glx.h | 0 .../platform/default}/headless_display.hpp | 0 ios/mapbox-gl-cocoa | 2 +- linux/mapboxgl-app.gyp | 2 +- macosx/mapboxgl-app.gyp | 2 +- mapboxgl.gyp | 8 +- platform/darwin/log_nslog.mm | 2 +- .../default}/headless_display.cpp | 2 +- platform/default/headless_view.cpp | 4 +- scripts/run_tests.sh | 5 +- test/headless.cpp | 4 +- test/test.gyp | 330 ++++++++---------- 15 files changed, 174 insertions(+), 204 deletions(-) rename common.gypi => gyp/common.gypi (100%) create mode 100644 gyp/platform.gypi rename {common => include/mbgl/platform/default}/glx.h (100%) rename {common => include/mbgl/platform/default}/headless_display.hpp (100%) rename {common => platform/default}/headless_display.cpp (97%) diff --git a/common.gypi b/gyp/common.gypi similarity index 100% rename from common.gypi rename to gyp/common.gypi diff --git a/gyp/platform-linux.gypi b/gyp/platform-linux.gypi index 4288def7f..9126652a7 100644 --- a/gyp/platform-linux.gypi +++ b/gyp/platform-linux.gypi @@ -44,6 +44,7 @@ 'libraries': [ '<@(uv_libraries)', '<@(curl_libraries)', + '-lboost_regex', ] }] ] diff --git a/gyp/platform.gypi b/gyp/platform.gypi new file mode 100644 index 000000000..605f3d712 --- /dev/null +++ b/gyp/platform.gypi @@ -0,0 +1,16 @@ +{ + 'conditions': [ + ['platform == "osx"', { + 'includes': ['platform-osx.gypi'], + 'variables': { 'platform_library': 'mapboxgl-osx' }, + }], + ['platform == "ios"', { + 'includes': ['platform-ios.gypi'], + 'variables': { 'platform_library': 'mapboxgl-ios' }, + }], + ['platform == "linux"', { + 'includes': ['platform-linux.gypi'], + 'variables': { 'platform_library': 'mapboxgl-linux' }, + }], + ], +} diff --git a/common/glx.h b/include/mbgl/platform/default/glx.h similarity index 100% rename from common/glx.h rename to include/mbgl/platform/default/glx.h diff --git a/common/headless_display.hpp b/include/mbgl/platform/default/headless_display.hpp similarity index 100% rename from common/headless_display.hpp rename to include/mbgl/platform/default/headless_display.hpp diff --git a/ios/mapbox-gl-cocoa b/ios/mapbox-gl-cocoa index cfbd1cfad..3f9579ad3 160000 --- a/ios/mapbox-gl-cocoa +++ b/ios/mapbox-gl-cocoa @@ -1 +1 @@ -Subproject commit cfbd1cfad47802ee5489aef24a59e340b841e491 +Subproject commit 3f9579ad3a002433fee2df9b1a88869a57124175 diff --git a/linux/mapboxgl-app.gyp b/linux/mapboxgl-app.gyp index 09734fc1c..e4dacd9af 100644 --- a/linux/mapboxgl-app.gyp +++ b/linux/mapboxgl-app.gyp @@ -1,6 +1,6 @@ { 'includes': [ - '../common.gypi', + '../gyp/common.gypi', ], 'targets': [ { diff --git a/macosx/mapboxgl-app.gyp b/macosx/mapboxgl-app.gyp index 4451a207b..dc65c3756 100644 --- a/macosx/mapboxgl-app.gyp +++ b/macosx/mapboxgl-app.gyp @@ -1,6 +1,6 @@ { 'includes': [ - '../common.gypi', + '../gyp/common.gypi', ], 'targets': [ { diff --git a/mapboxgl.gyp b/mapboxgl.gyp index 64c0ccc0c..8b805ae6d 100644 --- a/mapboxgl.gyp +++ b/mapboxgl.gyp @@ -1,16 +1,12 @@ { 'includes': [ - './common.gypi', + './gyp/common.gypi', './gyp/shaders.gypi', './gyp/npm_install.gypi', './gyp/styles.gypi', './gyp/fixtures.gypi', './gyp/certificates.gypi', './gyp/library.gypi', - ], - 'conditions': [ - ['platform == "osx"', { 'includes': ['./gyp/platform-osx.gypi'] }], - ['platform == "ios"', { 'includes': ['./gyp/platform-ios.gypi'] }], - ['platform == "linux"', { 'includes': ['./gyp/platform-linux.gypi'] }], + './gyp/platform.gypi', ], } diff --git a/platform/darwin/log_nslog.mm b/platform/darwin/log_nslog.mm index 231037b2d..b196930b2 100644 --- a/platform/darwin/log_nslog.mm +++ b/platform/darwin/log_nslog.mm @@ -1,4 +1,4 @@ -#include "log_nslog.hpp" +#include #import diff --git a/common/headless_display.cpp b/platform/default/headless_display.cpp similarity index 97% rename from common/headless_display.cpp rename to platform/default/headless_display.cpp index 3aaf2020b..409fcbf05 100644 --- a/common/headless_display.cpp +++ b/platform/default/headless_display.cpp @@ -1,4 +1,4 @@ -#include "headless_display.hpp" +#include #include #include diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp index d1d13db5f..ec5c4aabe 100644 --- a/platform/default/headless_view.cpp +++ b/platform/default/headless_view.cpp @@ -1,5 +1,5 @@ -#include "headless_view.hpp" -#include "headless_display.hpp" +#include +#include #include #include diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 6b42b7991..e10700076 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -10,7 +10,10 @@ for TEST in ./test_* ; do ulimit -c unlimited -S echo 'ulimit -c: '`ulimit -c` echo '/proc/sys/kernel/core_pattern: '`cat /proc/sys/kernel/core_pattern` - sysctl kernel.core_pattern + + if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then + sysctl kernel.core_pattern + fi RESULT=0 ${TEST} || RESULT=$? diff --git a/test/headless.cpp b/test/headless.cpp index 02dd0165e..e1bdbdc06 100644 --- a/test/headless.cpp +++ b/test/headless.cpp @@ -9,8 +9,8 @@ #include #include -#include "../common/headless_view.hpp" -#include "../common/headless_display.hpp" +#include +#include #include "./fixtures/fixture_log.hpp" diff --git a/test/test.gyp b/test/test.gyp index 49cc33739..04287bd9a 100644 --- a/test/test.gyp +++ b/test/test.gyp @@ -1,200 +1,154 @@ { 'includes': [ - '../common.gypi', + '../gyp/common.gypi', + '../gyp/platform.gypi', ], 'targets': [ - { - 'target_name': 'link_gl', - 'type': 'none', - 'direct_dependent_settings': { - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ - '<@(glfw3_libraries)', # This is a hack since we're not actually using GLFW - ], - }, - }, { - 'link_settings': { - 'libraries': [ - '<@(glfw3_libraries)', # This is a hack since we're not actually using GLFW - '-lboost_regex', - ], - }, - }], - ], - }, + { 'target_name': 'rotation_range', + 'product_name': 'test_rotation_range', + 'type': 'executable', + 'sources': [ + './main.cpp', + './rotation_range.cpp', + ], + 'dependencies': [ + '../deps/gtest/gtest.gyp:gtest', + '../mapboxgl.gyp:mapboxgl', + ] }, - { - 'target_name': 'link_curl', - 'type': 'none', - 'direct_dependent_settings': { - 'conditions': [ - ['OS == "mac"', { - 'xcode_settings': { - 'OTHER_CPLUSPLUSFLAGS':[ - '<@(curl_cflags)', - ], - 'OTHER_LDFLAGS': [ - '<@(curl_libraries)', - ], - }, - }, { - 'cflags': [ - '<@(curl_cflags)', - ], - 'link_settings': { - 'libraries': [ - '<@(curl_libraries)', - ], - }, - }], - ], - }, + { 'target_name': 'clip_ids', + 'product_name': 'test_clip_ids', + 'type': 'executable', + 'sources': [ + './main.cpp', + './clip_ids.cpp', + ], + 'dependencies': [ + '../deps/gtest/gtest.gyp:gtest', + '../mapboxgl.gyp:mapboxgl', + ] }, - { - "target_name": "rotation_range", - "product_name": "test_rotation_range", - "type": "executable", - "sources": [ - "./main.cpp", - "./rotation_range.cpp", - ], - "dependencies": [ - "../deps/gtest/gtest.gyp:gtest", - "../mapboxgl.gyp:mapboxgl", + { 'target_name': 'enums', + 'product_name': 'test_enums', + 'type': 'executable', + 'sources': [ + './main.cpp', + './enums.cpp', + ], + 'dependencies': [ + '../deps/gtest/gtest.gyp:gtest', + '../mapboxgl.gyp:mapboxgl', + ] + }, + { 'target_name': 'style_parser', + 'product_name': 'test_style_parser', + 'type': 'executable', + 'sources': [ + './main.cpp', + './style_parser.cpp', + './fixtures/fixture_log.hpp', + './fixtures/fixture_log.cpp', + ], + 'dependencies': [ + '../deps/gtest/gtest.gyp:gtest', + '../mapboxgl.gyp:mapboxgl', + '../mapboxgl.gyp:copy_fixtures', + ] + }, + { 'target_name': 'variant', + 'product_name': 'test_variant', + 'type': 'executable', + 'sources': [ + './main.cpp', + './variant.cpp', + ], + 'dependencies': [ + '../deps/gtest/gtest.gyp:gtest', + '../mapboxgl.gyp:mapboxgl', + ] + }, + { 'target_name': 'comparisons', + 'product_name': 'test_comparisons', + 'type': 'executable', + 'sources': [ + './main.cpp', + './comparisons.cpp', + ], + 'dependencies': [ + '../deps/gtest/gtest.gyp:gtest', + '../mapboxgl.gyp:mapboxgl', + ] + }, + { 'target_name': 'tile', + 'product_name': 'test_tile', + 'type': 'executable', + 'sources': [ + './main.cpp', + './tile.cpp', + ], + 'dependencies': [ + '../deps/gtest/gtest.gyp:gtest', + '../mapboxgl.gyp:mapboxgl', + ] + }, + { 'target_name': 'functions', + 'product_name': 'test_functions', + 'type': 'executable', + 'sources': [ + './main.cpp', + './functions.cpp', + ], + 'dependencies': [ + '../deps/gtest/gtest.gyp:gtest', + '../mapboxgl.gyp:mapboxgl', ] }, - { - "target_name": "clip_ids", - "product_name": "test_clip_ids", - "type": "executable", - "sources": [ - "./main.cpp", - "./clip_ids.cpp", - ], - "dependencies": [ - "../deps/gtest/gtest.gyp:gtest", - "../mapboxgl.gyp:mapboxgl", - ] + { 'target_name': 'headless', + 'product_name': 'test_headless', + 'type': 'executable', + 'sources': [ + './main.cpp', + './headless.cpp', + './fixtures/fixture_request.cpp', + './fixtures/fixture_log.cpp', + '../platform/default/headless_view.cpp', + '../platform/default/headless_display.cpp', + ], + 'conditions': [ + # add libuv include path and OpenGL libs + ['OS == "mac"', + { + 'xcode_settings': { + 'OTHER_CPLUSPLUSFLAGS': ['<@(uv_cflags)'], + 'OTHER_LDFLAGS': ['<@(glfw3_libraries)'], + }, + }, + { + 'cflags': ['<@(uv_cflags)'], + 'libraries': ['<@(glfw3_libraries)'], + }], + ], + 'dependencies': [ + '../deps/gtest/gtest.gyp:gtest', + '../mapboxgl.gyp:mapboxgl', + '<(platform_library)', + ], }, - { - "target_name": "enums", - "product_name": "test_enums", - "type": "executable", - "sources": [ - "./main.cpp", - "./enums.cpp", - ], - "dependencies": [ - "../deps/gtest/gtest.gyp:gtest", - "../mapboxgl.gyp:mapboxgl", - ] - }, - { - "target_name": "style_parser", - "product_name": "test_style_parser", - "type": "executable", - "sources": [ - "./main.cpp", - "./style_parser.cpp", - "./fixtures/fixture_log.hpp", - "./fixtures/fixture_log.cpp", - ], - "dependencies": [ - "../deps/gtest/gtest.gyp:gtest", - "../mapboxgl.gyp:mapboxgl", - "../mapboxgl.gyp:copy_fixtures", - ] - }, - { - "target_name": "variant", - "product_name": "test_variant", - "type": "executable", - "sources": [ - "./main.cpp", - "./variant.cpp", - ], - "dependencies": [ - "../deps/gtest/gtest.gyp:gtest", - "../mapboxgl.gyp:mapboxgl", - ] - }, - { - "target_name": "comparisons", - "product_name": "test_comparisons", - "type": "executable", - "sources": [ - "./main.cpp", - "./comparisons.cpp", - ], - "dependencies": [ - "../deps/gtest/gtest.gyp:gtest", - "../mapboxgl.gyp:mapboxgl", - ] - }, - { - "target_name": "tile", - "product_name": "test_tile", - "type": "executable", - "sources": [ - "./main.cpp", - "./tile.cpp", - ], - "dependencies": [ - "../deps/gtest/gtest.gyp:gtest", - "../mapboxgl.gyp:mapboxgl", - ] - }, - { - "target_name": "functions", - "product_name": "test_functions", - "type": "executable", - "sources": [ - "./main.cpp", - "./functions.cpp", - ], - "dependencies": [ - "../deps/gtest/gtest.gyp:gtest", - "../mapboxgl.gyp:mapboxgl", - ] - }, - { - "target_name": "headless", - "product_name": "test_headless", - "type": "executable", - "sources": [ - "./main.cpp", - "./headless.cpp", - "../common/headless_view.hpp", - "../common/headless_view.cpp", - "../common/headless_display.hpp", - "../common/headless_display.cpp", - "../common/platform_default.cpp", - "./fixtures/fixture_request.cpp", - "./fixtures/fixture_log.hpp", - "./fixtures/fixture_log.cpp", - ], - "dependencies": [ - "../deps/gtest/gtest.gyp:gtest", - "../mapboxgl.gyp:mapboxgl", - "link_gl", - ] - }, - { - "target_name": "test", - "type": "none", - "dependencies": [ - "rotation_range", - "clip_ids", - "enums", - "variant", - "tile", - "functions", - "headless", - "style_parser", - "comparisons", - ], + + # Build all targets + { 'target_name': 'test', + 'type': 'none', + 'dependencies': [ + 'rotation_range', + 'clip_ids', + 'enums', + 'variant', + 'tile', + 'functions', + 'headless', + 'style_parser', + 'comparisons', + ], } ] }