diff options
author | zmiao <miao.zhao@mapbox.com> | 2019-10-15 19:16:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-15 19:16:32 +0300 |
commit | e829d1ae6f01ff3c336cd429dacd98aeb3b7162a (patch) | |
tree | bad1b0bb1f46a820213cbe08cb40b56fd91d9389 | |
parent | 0f9666ebf3614dcc50e6a60c3c84bb578986bcf7 (diff) | |
download | qtlocation-mapboxgl-e829d1ae6f01ff3c336cd429dacd98aeb3b7162a.tar.gz |
[test-runner] make render-test a shared lib (#15816)
* [test-runner] make render-test a shared lib
[test-runner] nit
[test-runner] nit again
* [test-runner] Remove redundant linked file in cmake
-rw-r--r-- | cmake/render-test.cmake | 58 | ||||
-rw-r--r-- | next/CMakeLists.txt | 1 | ||||
-rw-r--r-- | next/platform/linux/linux.cmake | 27 | ||||
-rw-r--r-- | next/platform/macos/macos.cmake | 28 | ||||
-rw-r--r-- | next/render-test/CMakeLists.txt | 37 | ||||
-rw-r--r-- | platform/default/src/mbgl/render-test/main.cpp | 5 | ||||
-rw-r--r-- | render-test/include/mbgl/render_test.hpp | 9 | ||||
-rw-r--r-- | render-test/render_test.cpp (renamed from render-test/main.cpp) | 9 |
8 files changed, 134 insertions, 40 deletions
diff --git a/cmake/render-test.cmake b/cmake/render-test.cmake index 65240b54f3..8726fb4650 100644 --- a/cmake/render-test.cmake +++ b/cmake/render-test.cmake @@ -1,32 +1,60 @@ -add_executable(mbgl-render-test +add_executable( + mbgl-render-test + expression-test/test_runner_common.cpp + expression-test/test_runner_common.hpp + platform/default/src/mbgl/render-test/main.cpp render-test/allocation_index.cpp - render-test/main.cpp + render-test/allocation_index.hpp + render-test/filesystem.hpp + render-test/filesystem.hpp + render-test/include/mbgl/render_test.hpp + render-test/metadata.hpp render-test/parser.cpp + render-test/parser.hpp + render-test/render_test.cpp render-test/runner.cpp - expression-test/test_runner_common.cpp - expression-test/test_runner_common.hpp + render-test/runner.hpp ) if(APPLE) - target_link_libraries(mbgl-render-test PRIVATE mbgl-loop-darwin) + target_link_libraries( + mbgl-render-test + PRIVATE mbgl-loop-darwin + ) else() - target_link_libraries(mbgl-render-test PRIVATE mbgl-loop-uv) + target_link_libraries( + mbgl-render-test + PRIVATE mbgl-loop-uv + ) endif() -target_include_directories(mbgl-render-test +target_include_directories( + mbgl-render-test PRIVATE src PRIVATE platform/default/include PRIVATE render-test ) -target_link_libraries(mbgl-render-test PRIVATE - mbgl-core - mbgl-filesource - Mapbox::Base::Extras::args - mbgl-vendor-expected - Mapbox::Base::Extras::filesystem - Mapbox::Base::pixelmatch-cpp - Mapbox::Base::Extras::rapidjson +target_include_directories( + mbgl-render-test + PUBLIC render-test/include + PUBLIC include ) +target_link_libraries( + mbgl-render-test + PRIVATE + mbgl-core + mbgl-filesource + Mapbox::Base::Extras::args + mbgl-vendor-expected + Mapbox::Base::Extras::filesystem + Mapbox::Base::pixelmatch-cpp + Mapbox::Base::Extras::rapidjson +) + +create_source_groups(mbgl-render-test) + +set_target_properties(mbgl-render-test PROPERTIES FOLDER "Executables") + add_definitions(-DTEST_RUNNER_ROOT_PATH="${CMAKE_SOURCE_DIR}") diff --git a/next/CMakeLists.txt b/next/CMakeLists.txt index df56f04b22..fb0779bea4 100644 --- a/next/CMakeLists.txt +++ b/next/CMakeLists.txt @@ -943,3 +943,4 @@ endif() add_subdirectory(${PROJECT_SOURCE_DIR}/test) add_subdirectory(${PROJECT_SOURCE_DIR}/benchmark) +add_subdirectory(${PROJECT_SOURCE_DIR}/render-test) diff --git a/next/platform/linux/linux.cmake b/next/platform/linux/linux.cmake index 18531a2856..be905c204f 100644 --- a/next/platform/linux/linux.cmake +++ b/next/platform/linux/linux.cmake @@ -95,7 +95,6 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/bin) add_subdirectory(${PROJECT_SOURCE_DIR}/expression-test) add_subdirectory(${PROJECT_SOURCE_DIR}/platform/glfw) add_subdirectory(${PROJECT_SOURCE_DIR}/platform/node) -add_subdirectory(${PROJECT_SOURCE_DIR}/render-test) add_executable( mbgl-test-runner @@ -122,5 +121,31 @@ target_link_libraries( PRIVATE mbgl-benchmark ) +add_executable( + mbgl-render-test-runner + ${MBGL_ROOT}/platform/default/src/mbgl/render-test/main.cpp +) + +target_link_libraries( + mbgl-render-test-runner + PRIVATE mbgl-render-test +) + add_test(NAME mbgl-benchmark-runner COMMAND mbgl-benchmark-runner WORKING_DIRECTORY ${MBGL_ROOT}) add_test(NAME mbgl-test-runner COMMAND mbgl-test-runner WORKING_DIRECTORY ${MBGL_ROOT}) + +string(RANDOM LENGTH 5 ALPHABET 0123456789 MBGL_RENDER_TEST_SEED) + +add_test( + NAME mbgl-render-test + COMMAND + mbgl-render-test-runner + render-tests + --recycle-map + --shuffle + --seed=${MBGL_RENDER_TEST_SEED} + WORKING_DIRECTORY ${MBGL_ROOT} +) + +add_test(NAME mbgl-render-test-probes COMMAND mbgl-render-test-runner tests --rootPath=render-test WORKING_DIRECTORY ${MBGL_ROOT}) +add_test(NAME mbgl-query-test COMMAND mbgl-render-test-runner query-tests WORKING_DIRECTORY ${MBGL_ROOT}) diff --git a/next/platform/macos/macos.cmake b/next/platform/macos/macos.cmake index a0dcb9a829..cbe386a1ac 100644 --- a/next/platform/macos/macos.cmake +++ b/next/platform/macos/macos.cmake @@ -155,7 +155,6 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/bin) add_subdirectory(${PROJECT_SOURCE_DIR}/expression-test) add_subdirectory(${PROJECT_SOURCE_DIR}/platform/glfw) add_subdirectory(${PROJECT_SOURCE_DIR}/platform/node) -add_subdirectory(${PROJECT_SOURCE_DIR}/render-test) add_executable( mbgl-test-runner @@ -182,8 +181,35 @@ target_link_libraries( PRIVATE mbgl-benchmark ) +add_executable( + mbgl-render-test-runner + ${MBGL_ROOT}/platform/default/src/mbgl/render-test/main.cpp +) + +target_link_libraries( + mbgl-render-test-runner + PRIVATE mbgl-render-test +) + set_property(TARGET mbgl-benchmark-runner PROPERTY FOLDER Executables) set_property(TARGET mbgl-test-runner PROPERTY FOLDER Executables) +set_property(TARGET mbgl-render-test-runner PROPERTY FOLDER Executables) add_test(NAME mbgl-benchmark-runner COMMAND mbgl-benchmark-runner WORKING_DIRECTORY ${MBGL_ROOT}) add_test(NAME mbgl-test-runner COMMAND mbgl-test-runner WORKING_DIRECTORY ${MBGL_ROOT}) + +string(RANDOM LENGTH 5 ALPHABET 0123456789 MBGL_RENDER_TEST_SEED) + +add_test( + NAME mbgl-render-test + COMMAND + mbgl-render-test-runner + render-tests + --recycle-map + --shuffle + --seed=${MBGL_RENDER_TEST_SEED} + WORKING_DIRECTORY ${MBGL_ROOT} +) + +add_test(NAME mbgl-render-test-probes COMMAND mbgl-render-test-runner tests --rootPath=render-test WORKING_DIRECTORY ${MBGL_ROOT}) +add_test(NAME mbgl-query-test COMMAND mbgl-render-test-runner query-tests WORKING_DIRECTORY ${MBGL_ROOT}) diff --git a/next/render-test/CMakeLists.txt b/next/render-test/CMakeLists.txt index 1a4cd5ceb6..2e1c5438ed 100644 --- a/next/render-test/CMakeLists.txt +++ b/next/render-test/CMakeLists.txt @@ -1,16 +1,18 @@ -add_executable( - mbgl-render-test +add_library( + mbgl-render-test SHARED EXCLUDE_FROM_ALL + ${MBGL_ROOT}/expression-test/test_runner_common.cpp + ${MBGL_ROOT}/expression-test/test_runner_common.hpp ${MBGL_ROOT}/render-test/allocation_index.cpp ${MBGL_ROOT}/render-test/allocation_index.hpp ${MBGL_ROOT}/render-test/filesystem.hpp - ${MBGL_ROOT}/render-test/main.cpp + ${MBGL_ROOT}/render-test/filesystem.hpp + ${MBGL_ROOT}/render-test/include/mbgl/render_test.hpp ${MBGL_ROOT}/render-test/metadata.hpp ${MBGL_ROOT}/render-test/parser.cpp ${MBGL_ROOT}/render-test/parser.hpp + ${MBGL_ROOT}/render-test/render_test.cpp ${MBGL_ROOT}/render-test/runner.cpp ${MBGL_ROOT}/render-test/runner.hpp - ${MBGL_ROOT}/expression-test/test_runner_common.cpp - ${MBGL_ROOT}/expression-test/test_runner_common.hpp ) target_compile_definitions( @@ -24,6 +26,11 @@ target_include_directories( PRIVATE ${MBGL_ROOT}/src ) +target_include_directories( + mbgl-render-test + PUBLIC ${MBGL_ROOT}/render-test/include ${MBGL_ROOT}/include +) + include(${PROJECT_SOURCE_DIR}/vendor/boost.cmake) target_link_libraries( @@ -36,20 +43,8 @@ target_link_libraries( mbgl-vendor-boost ) -set_property(TARGET mbgl-render-test PROPERTY FOLDER Executables) - -string(RANDOM LENGTH 5 ALPHABET 0123456789 MBGL_RENDER_TEST_SEED) - -add_test( - NAME mbgl-render-test - COMMAND - mbgl-render-test - render-tests - --recycle-map - --shuffle - --seed=${MBGL_RENDER_TEST_SEED} - WORKING_DIRECTORY ${MBGL_ROOT} -) +if(CMAKE_SYSTEM_NAME STREQUAL Android) + set_target_properties(mbgl-render-test PROPERTIES LINK_FLAGS_RELEASE "-fuse-ld=gold -O2 -flto -Wl,--icf=safe") +endif() -add_test(NAME mbgl-render-test-probes COMMAND mbgl-render-test tests --rootPath=render-test WORKING_DIRECTORY ${MBGL_ROOT}) -add_test(NAME mbgl-query-test COMMAND mbgl-render-test query-tests WORKING_DIRECTORY ${MBGL_ROOT}) +set_property(TARGET mbgl-render-test PROPERTY FOLDER Core) diff --git a/platform/default/src/mbgl/render-test/main.cpp b/platform/default/src/mbgl/render-test/main.cpp new file mode 100644 index 0000000000..9b22b20e00 --- /dev/null +++ b/platform/default/src/mbgl/render-test/main.cpp @@ -0,0 +1,5 @@ +#include <mbgl/render_test.hpp> + +int main(int argc, char *argv[]) { + return mbgl::runRenderTests(argc, argv); +} diff --git a/render-test/include/mbgl/render_test.hpp b/render-test/include/mbgl/render_test.hpp new file mode 100644 index 0000000000..42a539603d --- /dev/null +++ b/render-test/include/mbgl/render_test.hpp @@ -0,0 +1,9 @@ +#pragma once + +#include <mbgl/util/util.hpp> + +namespace mbgl { + +MBGL_EXPORT int runRenderTests(int argc, char* argv[]); + +} // namespace mbgl diff --git a/render-test/main.cpp b/render-test/render_test.cpp index 6f5e2449a9..bac193237d 100644 --- a/render-test/main.cpp +++ b/render-test/render_test.cpp @@ -1,7 +1,8 @@ #include "allocation_index.hpp" -#include <mbgl/util/run_loop.hpp> +#include <mbgl/render_test.hpp> #include <mbgl/util/io.hpp> +#include <mbgl/util/run_loop.hpp> #include "metadata.hpp" #include "parser.hpp" @@ -36,7 +37,9 @@ void operator delete(void* ptr, size_t) noexcept { } #endif -int main(int argc, char** argv) { +namespace mbgl { + +int runRenderTests(int argc, char** argv) { bool recycleMap; bool shuffle; uint32_t seed; @@ -160,3 +163,5 @@ int main(int argc, char** argv) { return stats.failedTests + stats.erroredTests == 0 ? 0 : 1; } + +} // namespace mbgl
\ No newline at end of file |