diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 9ee806c34..583199692 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -204,7 +204,7 @@ jobs: - name: Generate coverage report run: | - bazel coverage --test_output=all --combined_report=lcov --instrumentation_filter="//:mbgl-core" //test:core --//:maplibre_platform=linux --run_under=//platform/linux:startxwrapper + bazel coverage --test_output=all --combined_report=lcov --nobuild_runfile_links --local_test_jobs=1 --instrumentation_filter="//:mbgl-core" //test:core //render-test:render-test --//:maplibre_platform=linux --run_under=//platform/linux:startxwrapper echo coverage_report=$(bazel info output_path)/_coverage/_coverage_report.dat >> $GITHUB_ENV - name: Upload coverage report diff --git a/expression-test/BUILD.bazel b/expression-test/BUILD.bazel new file mode 100644 index 000000000..4f0f2e798 --- /dev/null +++ b/expression-test/BUILD.bazel @@ -0,0 +1,20 @@ +load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS") + +cc_library( + name = "test_runner_common", + srcs = [ + "test_runner_common.cpp", + "test_runner_common.hpp", + ], + hdrs = [ + "test_runner_common.hpp", + ], + copts = CPP_FLAGS + MAPLIBRE_FLAGS, + includes = [ + ".", + ], + visibility = ["//visibility:public"], + deps = [ + "//:mbgl-core", + ], +) diff --git a/metrics/BUILD.bazel b/metrics/BUILD.bazel new file mode 100644 index 000000000..42fbba6f1 --- /dev/null +++ b/metrics/BUILD.bazel @@ -0,0 +1,18 @@ +filegroup( + name = "render-test-files", + srcs = glob([ + "cache-style.db", + "cache-metrics.db", + "integration/**", + "tests/**", + "linux-gcc8-release/**", + "expectations/platform-all/**", + "ignores/**", + ]) + [ + "linux-gcc8-release-metrics.json", + "linux-gcc8-release-style.json", + ], + visibility = [ + "//render-test:__pkg__", + ], +) diff --git a/platform/default/BUILD.bazel b/platform/default/BUILD.bazel index 07b498b75..b6901696c 100644 --- a/platform/default/BUILD.bazel +++ b/platform/default/BUILD.bazel @@ -12,6 +12,19 @@ cc_library( ], ) +cc_library( + name = "render-test-bin", + srcs = [ + "src/mbgl/render-test/main.cpp", + ], + visibility = [ + "//render-test:__pkg__", + ], + deps = [ + "//render-test:render-test-lib", + ], +) + # From: platform/ios/core-files.json # Mostly platform/default cc_library( diff --git a/platform/default/src/mbgl/util/async_task.cpp b/platform/default/src/mbgl/util/async_task.cpp index b3d1b4fe5..6e6d17c63 100644 --- a/platform/default/src/mbgl/util/async_task.cpp +++ b/platform/default/src/mbgl/util/async_task.cpp @@ -4,6 +4,7 @@ #include #include +#include #include diff --git a/platform/default/src/mbgl/util/run_loop.cpp b/platform/default/src/mbgl/util/run_loop.cpp index 3d4ac14b6..1a5939ec1 100644 --- a/platform/default/src/mbgl/util/run_loop.cpp +++ b/platform/default/src/mbgl/util/run_loop.cpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace { diff --git a/platform/default/src/mbgl/util/timer.cpp b/platform/default/src/mbgl/util/timer.cpp index c870ff16f..92eb4aa69 100644 --- a/platform/default/src/mbgl/util/timer.cpp +++ b/platform/default/src/mbgl/util/timer.cpp @@ -1,5 +1,7 @@ #include +#include + #include #include diff --git a/platform/linux/xorg/startxwrapper b/platform/linux/xorg/startxwrapper index 8e7476a61..49aff5550 100755 --- a/platform/linux/xorg/startxwrapper +++ b/platform/linux/xorg/startxwrapper @@ -3,6 +3,10 @@ script=$(realpath "$0") scriptpath=$(dirname "$script") +script=$(mktemp) exit_code=$(mktemp) -XAUTHORITY=$(mktemp) startx "$PWD/$@ && echo $? > $exit_code" -- -xf86config "$scriptpath/xorg.conf" -logfile /dev/null +echo "$PWD/$@ && echo \$? > $exit_code" > $script +chmod +x $script + +XAUTHORITY=$(mktemp) startx "$script" -- -xf86config "$scriptpath/xorg.conf" -logfile /dev/null exit $(cat $exit_code) \ No newline at end of file diff --git a/render-test/BUILD.bazel b/render-test/BUILD.bazel new file mode 100644 index 000000000..db6a967a6 --- /dev/null +++ b/render-test/BUILD.bazel @@ -0,0 +1,43 @@ +load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS") + +cc_library( + name = "render-test-lib", + hdrs = [ + "include/mbgl/render_test.hpp", + ], + includes = [ + "include", + ], + visibility = [ + "//platform/default:__pkg__", + ], +) + +cc_test( + name = "render-test", + srcs = glob( + [ + "*.cpp", + "*.hpp", + ], + ) + [ + "include/mbgl/render_test.hpp", + ], + args = [ + "--manifestPath", + "metrics/linux-gcc8-release-style.json", + ], + copts = CPP_FLAGS + MAPLIBRE_FLAGS, + data = [ + "//metrics:render-test-files", + ], + includes = [ + "include", + ], + deps = [ + "//expression-test:test_runner_common", + "//platform/default:render-test-bin", + "//platform/linux:impl", + "//vendor:mapbox-base", + ], +) diff --git a/render-test/CMakeLists.txt b/render-test/CMakeLists.txt index cb00f19e1..2ade54ead 100644 --- a/render-test/CMakeLists.txt +++ b/render-test/CMakeLists.txt @@ -46,6 +46,12 @@ target_include_directories( PUBLIC ${PROJECT_SOURCE_DIR}/render-test/include ${PROJECT_SOURCE_DIR}/include ) +# needed for test_runner_common.hpp +target_include_directories( + mbgl-render-test + PRIVATE ${PROJECT_SOURCE_DIR}/expression-test +) + include(${PROJECT_SOURCE_DIR}/vendor/boost.cmake) target_link_libraries( diff --git a/render-test/runner.cpp b/render-test/runner.cpp index 396a1225b..2ce806079 100644 --- a/render-test/runner.cpp +++ b/render-test/runner.cpp @@ -18,7 +18,7 @@ #include -#include <../expression-test/test_runner_common.hpp> +#include "test_runner_common.hpp" #include "allocation_index.hpp" #include "file_source.hpp" #include "metadata.hpp" diff --git a/vendor/BUILD.bazel b/vendor/BUILD.bazel index c4d05ae04..53e32afc4 100644 --- a/vendor/BUILD.bazel +++ b/vendor/BUILD.bazel @@ -18,6 +18,7 @@ cc_library( "mapbox-base/extras/filesystem/include/ghc/*.hpp", "mapbox-base/extras/kdbush.hpp/include/*.hpp", "mapbox-base/extras/rapidjson/include/**/*.h", + "mapbox-base/extras/args/args.hxx", "mapbox-base/include/mapbox/**/*.hpp", ], allow_empty = False, @@ -35,6 +36,7 @@ cc_library( "mapbox-base/deps/shelf-pack-cpp/include", "mapbox-base/deps/supercluster.hpp/include", "mapbox-base/deps/variant/include", + "mapbox-base/extras/args", "mapbox-base/extras/expected-lite/include", "mapbox-base/extras/filesystem/include", "mapbox-base/extras/kdbush.hpp/include",