iOS C++ Unit Tests Bazel target & running on CI (#1534)

This commit is contained in:
Bart Louwers
2023-08-22 21:52:20 +02:00
committed by GitHub
parent e16995ec33
commit 32d65850c9
21 changed files with 308 additions and 155 deletions

View File

@@ -13,45 +13,84 @@ cc_library(
cc_library(
name = "testlib",
srcs = glob(
[
"src/mbgl/test/*.cpp",
],
exclude = [
"src/mbgl/test/test.cpp",
"src/mbgl/test/http_server.cpp",
],
),
srcs = select({
"//:ios": glob(
["src/mbgl/test/*.cpp"],
allow_empty = False,
),
"//conditions:default": glob(
["src/mbgl/test/*.cpp"],
allow_empty = False,
exclude = ["src/mbgl/test/http_server.cpp"],
),
}) + [
"include/mbgl/test.hpp",
],
hdrs = glob([
"src/mbgl/test/*.hpp",
]),
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
copts = CPP_FLAGS + MAPLIBRE_FLAGS + select({
"//:ios": ["-DUSE_CPP_TEST_SERVER"],
"//conditions:default": [],
}),
includes = [
"include",
],
strip_include_prefix = "src",
visibility = [
"//platform/ios/test/core:__pkg__",
],
deps = [
"testutils",
"//:mbgl-core",
],
] + select({
"//:ios": ["//vendor:httplib"],
"//conditions:default": [],
}),
)
cc_test(
name = "core",
cc_library(
name = "tests",
srcs = glob(
[
"**/*.test.cpp",
],
),
args = [
"--gtest_filter=-Map.StyleNetworkErrorRetry:Map.StyleNotFound:MainResourceLoader.CachedResourceLowPriority",
],
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
data = glob(["fixtures/**/*"]) + [
"//:scripts/style-spec-reference/v8.json",
visibility = [
"//platform/ios/test/core:__pkg__",
],
deps = [
"testlib",
"testutils",
"//:mbgl-core",
"//platform/linux:impl",
"//platform/default:mbgl-default",
"//vendor/googletest:gtest_main",
],
alwayslink = True,
)
filegroup(
name = "fixtures",
srcs = glob(
["fixtures/**/*"],
allow_empty = False,
),
visibility = [
"//platform/ios/test/core:__pkg__",
],
)
cc_test(
name = "core",
args = [
"--gtest_filter=-Map.StyleNetworkErrorRetry:Map.StyleNotFound:MainResourceLoader.CachedResourceLowPriority",
],
data = glob(["fixtures/**/*"]) + [
"//:scripts/style-spec-reference/v8.json",
],
deps = [
"tests",
"//platform/linux:impl",
],
)