Add render test to coverage report (#1192)

This commit is contained in:
Bart Louwers
2023-06-07 22:50:51 +02:00
committed by GitHub
parent 2e2a3c8bd2
commit 3260d32bb0
12 changed files with 113 additions and 3 deletions

View File

@@ -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

View File

@@ -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",
],
)

18
metrics/BUILD.bazel Normal file
View File

@@ -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__",
],
)

View File

@@ -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(

View File

@@ -4,6 +4,7 @@
#include <atomic>
#include <functional>
#include <stdexcept>
#include <uv.h>

View File

@@ -8,6 +8,7 @@
#include <cassert>
#include <functional>
#include <unordered_map>
#include <stdexcept>
namespace {

View File

@@ -1,5 +1,7 @@
#include <mbgl/util/timer.hpp>
#include <stdexcept>
#include <mbgl/util/run_loop.hpp>
#include <uv.h>

View File

@@ -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)

43
render-test/BUILD.bazel Normal file
View File

@@ -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",
],
)

View File

@@ -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(

View File

@@ -18,7 +18,7 @@
#include <mapbox/pixelmatch.hpp>
#include <../expression-test/test_runner_common.hpp>
#include "test_runner_common.hpp"
#include "allocation_index.hpp"
#include "file_source.hpp"
#include "metadata.hpp"

2
vendor/BUILD.bazel vendored
View File

@@ -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",