Build with a different gtest harness when in Chromium
Running test in a Chromium build requires using their gtest and gmock targets as well as a harness that is in //base. Since we want to run Dawn tests on the Chromium GPU bots, we need to support two configurations both building tests standalone and in Chromium. BUG=chromium:870747 Change-Id: I862e62a607e193a27562ece0f1f6d46d8728e446 Reviewed-on: https://dawn-review.googlesource.com/c/2080 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
be948aa8e0
commit
e92ad5bb89
24
BUILD.gn
24
BUILD.gn
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
import("scripts/dawn_overrides_with_defaults.gni")
|
import("scripts/dawn_overrides_with_defaults.gni")
|
||||||
import("scripts/dawn_features.gni")
|
import("scripts/dawn_features.gni")
|
||||||
|
import("//build_overrides/build.gni")
|
||||||
|
|
||||||
import("//testing/test.gni")
|
import("//testing/test.gni")
|
||||||
|
|
||||||
|
@ -750,13 +751,11 @@ test("dawn_unittests") {
|
||||||
":libdawn_native_sources",
|
":libdawn_native_sources",
|
||||||
":libdawn_wire",
|
":libdawn_wire",
|
||||||
":mock_dawn_gen",
|
":mock_dawn_gen",
|
||||||
"third_party:gmock",
|
"third_party:gmock_and_gtest",
|
||||||
"third_party:gtest",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
sources = get_target_outputs(":mock_dawn_gen")
|
sources = get_target_outputs(":mock_dawn_gen")
|
||||||
sources += [
|
sources += [
|
||||||
"src/tests/UnittestsMain.cpp",
|
|
||||||
"src/tests/unittests/BitSetIteratorTests.cpp",
|
"src/tests/unittests/BitSetIteratorTests.cpp",
|
||||||
"src/tests/unittests/CommandAllocatorTests.cpp",
|
"src/tests/unittests/CommandAllocatorTests.cpp",
|
||||||
"src/tests/unittests/EnumClassBitmasksTests.cpp",
|
"src/tests/unittests/EnumClassBitmasksTests.cpp",
|
||||||
|
@ -791,6 +790,14 @@ test("dawn_unittests") {
|
||||||
if (dawn_enable_d3d12) {
|
if (dawn_enable_d3d12) {
|
||||||
sources += [ "src/tests/unittests/d3d12/CopySplitTests.cpp" ]
|
sources += [ "src/tests/unittests/d3d12/CopySplitTests.cpp" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# When building inside Chromium, use their gtest main function because it is
|
||||||
|
# needed to run in swarming correctly.
|
||||||
|
if (build_with_chromium) {
|
||||||
|
sources += [ "//gpu/dawn_unittests_main.cc" ]
|
||||||
|
} else {
|
||||||
|
sources += [ "src/tests/UnittestsMain.cpp" ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test("dawn_end2end_tests") {
|
test("dawn_end2end_tests") {
|
||||||
|
@ -803,13 +810,12 @@ test("dawn_end2end_tests") {
|
||||||
":libdawn_native",
|
":libdawn_native",
|
||||||
":libdawn_wire",
|
":libdawn_wire",
|
||||||
"third_party:glfw",
|
"third_party:glfw",
|
||||||
"third_party:gtest",
|
"third_party:gmock_and_gtest",
|
||||||
]
|
]
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
"src/tests/DawnTest.cpp",
|
"src/tests/DawnTest.cpp",
|
||||||
"src/tests/DawnTest.h",
|
"src/tests/DawnTest.h",
|
||||||
"src/tests/End2EndTestsMain.cpp",
|
|
||||||
"src/tests/end2end/BasicTests.cpp",
|
"src/tests/end2end/BasicTests.cpp",
|
||||||
"src/tests/end2end/BindGroupTests.cpp",
|
"src/tests/end2end/BindGroupTests.cpp",
|
||||||
"src/tests/end2end/BlendStateTests.cpp",
|
"src/tests/end2end/BlendStateTests.cpp",
|
||||||
|
@ -828,6 +834,14 @@ test("dawn_end2end_tests") {
|
||||||
"src/tests/end2end/TextureViewTests.cpp",
|
"src/tests/end2end/TextureViewTests.cpp",
|
||||||
"src/tests/end2end/ViewportOrientationTests.cpp",
|
"src/tests/end2end/ViewportOrientationTests.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# When building inside Chromium, use their gtest main function because it is
|
||||||
|
# needed to run in swarming correctly.
|
||||||
|
if (build_with_chromium) {
|
||||||
|
sources += [ "//gpu/dawn_end2end_tests_main.cc" ]
|
||||||
|
} else {
|
||||||
|
sources += [ "src/tests/End2EndTestsMain.cpp" ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
import("../scripts/dawn_overrides_with_defaults.gni")
|
import("../scripts/dawn_overrides_with_defaults.gni")
|
||||||
import("../scripts/dawn_features.gni")
|
import("../scripts/dawn_features.gni")
|
||||||
|
import("//build_overrides/build.gni")
|
||||||
|
|
||||||
is_msvc = is_win && !is_clang
|
is_msvc = is_win && !is_clang
|
||||||
|
|
||||||
|
@ -107,41 +108,69 @@ source_set("vulkan_headers") {
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Gtest Gmock - build targets when outside of Chrome
|
# Gtest Gmock - Handle building inside and outside of Chromium.
|
||||||
# TODO(cwallez@chromium.org): Adapt them to build with Chromium's harness
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
googletest_dir = dawn_googletest_dir
|
# When building outside of Chromium we need to define our own targets for GTest
|
||||||
|
# and GMock. However when compiling inside of Chromium we need to reuse the
|
||||||
|
# existing targets, both because Chromium has a special harness for swarming
|
||||||
|
# and because otherwise the "gn check" fails.
|
||||||
|
|
||||||
config("gtest_config") {
|
if (!build_with_chromium) {
|
||||||
include_dirs = [
|
# When we aren't in Chromium we define out own targets based on the location
|
||||||
"${googletest_dir}/googletest",
|
# of the googletest repo.
|
||||||
"${googletest_dir}/googletest/include",
|
googletest_dir = dawn_googletest_dir
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
static_library("gtest") {
|
config("gtest_config") {
|
||||||
testonly = true
|
include_dirs = [
|
||||||
sources = [
|
"${googletest_dir}/googletest",
|
||||||
"${googletest_dir}/googletest/src/gtest-all.cc",
|
"${googletest_dir}/googletest/include",
|
||||||
]
|
]
|
||||||
public_configs = [ ":gtest_config" ]
|
}
|
||||||
}
|
|
||||||
|
|
||||||
config("gmock_config") {
|
static_library("gtest") {
|
||||||
include_dirs = [
|
testonly = true
|
||||||
"${googletest_dir}/googlemock",
|
sources = [
|
||||||
"${googletest_dir}/googlemock/include",
|
"${googletest_dir}/googletest/src/gtest-all.cc",
|
||||||
"${googletest_dir}/googletest/include",
|
]
|
||||||
]
|
public_configs = [ ":gtest_config" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
static_library("gmock") {
|
config("gmock_config") {
|
||||||
testonly = true
|
include_dirs = [
|
||||||
sources = [
|
"${googletest_dir}/googlemock",
|
||||||
"${googletest_dir}/googlemock/src/gmock-all.cc",
|
"${googletest_dir}/googlemock/include",
|
||||||
]
|
"${googletest_dir}/googletest/include",
|
||||||
public_configs = [ ":gmock_config" ]
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
static_library("gmock") {
|
||||||
|
testonly = true
|
||||||
|
sources = [
|
||||||
|
"${googletest_dir}/googlemock/src/gmock-all.cc",
|
||||||
|
]
|
||||||
|
public_configs = [ ":gmock_config" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
group("gmock_and_gtest") {
|
||||||
|
testonly = true
|
||||||
|
public_deps = [
|
||||||
|
":gmock",
|
||||||
|
":gtest",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# When we are in Chromium we reuse its targets, and also add some deps that
|
||||||
|
# are needed to launch the test in swarming mode.
|
||||||
|
group("gmock_and_gtest") {
|
||||||
|
testonly = true
|
||||||
|
public_deps = [
|
||||||
|
"//base",
|
||||||
|
"//base/test:test_support",
|
||||||
|
"//testing/gmock",
|
||||||
|
"//testing/gtest",
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
Loading…
Reference in New Issue