From 2d79ef264eba950c255f62698b7fcb362b140495 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Tue, 28 Apr 2020 17:12:05 +0000 Subject: [PATCH] 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 Reviewed-by: Stephen White Commit-Queue: Corentin Wallez --- src/tests/BUILD.gn | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/tests/BUILD.gn b/src/tests/BUILD.gn index acae871a8b..581f1fc82b 100644 --- a/src/tests/BUILD.gn +++ b/src/tests/BUILD.gn @@ -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" ] }