Do not use Dawn's warnings for compiling Chromium's gtest main.

When building in Chromium, Dawn's gtest targets use sources files
in Chromium so it can use Chromium's GTest harness. These source
files were compiled with the "dawn_internal" config included.
This made them include Dawn-specific warnings that trigger on parts
of Chromium's //base.

Instead compile these "main" files as separate source_sets without
dawn_internal and link them in the dawn test executables.

Bug: chromium:1075817

Change-Id: I573390ca3e6a7dfd1e8a949dc10ed268f0d0f63e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20520
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-04-28 17:12:05 +00:00 committed by Commit Bot service account
parent c94f4a7a19
commit 2d79ef264e
1 changed files with 28 additions and 3 deletions

View File

@ -89,6 +89,31 @@ if (!build_with_chromium) {
}
}
###############################################################################
# Wrapping of Chromium targets
###############################################################################
# These targets are separated because they are Chromium sources files that
# can't use the dawn_internal config, otherwise Dawn's warning flags get
# applied while compiling a bunch of Chromium's //base (via header inclusion)
if (build_with_chromium) {
source_set("dawn_unittests_main") {
testonly = true
deps = [ ":gmock_and_gtest" ]
sources = [ "//gpu/dawn_unittests_main.cc" ]
}
source_set("dawn_end2end_tests_main") {
testonly = true
deps = [ ":gmock_and_gtest" ]
sources = [ "//gpu/dawn_end2end_tests_main.cc" ]
}
source_set("dawn_perf_tests_main") {
testonly = true
deps = [ ":gmock_and_gtest" ]
sources = [ "//gpu/dawn_perf_tests_main.cc" ]
}
}
###############################################################################
# Dawn unittests
###############################################################################
@ -198,7 +223,7 @@ test("dawn_unittests") {
# 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" ]
deps += [ ":dawn_unittests_main" ]
} else {
sources += [ "UnittestsMain.cpp" ]
}
@ -386,7 +411,7 @@ test("dawn_end2end_tests") {
# 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" ]
deps += [ ":dawn_end2end_tests_main" ]
} else {
sources += [ "End2EndTestsMain.cpp" ]
}
@ -435,7 +460,7 @@ test("dawn_perf_tests") {
# 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_perf_tests_main.cc" ]
deps += [ ":dawn_perf_tests_main" ]
} else {
sources += [ "PerfTestsMain.cpp" ]
}