Move tint unittest behind a build flag.

This CL moves the Tint unittest code behind a build flag in order
to hide the //testing/test.gni dependency from downstream consumers.

The unittests are enabled by default and can be disabled by setting
`tint_build_unittests` to false.

Bug: dawn:1517
Change-Id: Id560ed98416ba0725b62a93ddd27caf341699e75
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94481
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
dan sinclair 2022-06-22 12:40:43 +00:00 committed by Dawn LUCI CQ
parent 32bcc0413d
commit 77bf233cef
3 changed files with 805 additions and 792 deletions

View File

@ -19,3 +19,5 @@ tint_build_spv_reader = true
tint_build_spv_writer = true tint_build_spv_writer = true
tint_build_wgsl_reader = true tint_build_wgsl_reader = true
tint_build_wgsl_writer = true tint_build_wgsl_writer = true
tint_build_unittests = true

View File

@ -13,9 +13,13 @@
# limitations under the License. # limitations under the License.
import("//build_overrides/build.gni") import("//build_overrides/build.gni")
import("//testing/test.gni")
import("../../tint_overrides_with_defaults.gni") import("../../tint_overrides_with_defaults.gni")
if (tint_build_unittests) {
import("//testing/test.gni")
}
############################################################################### ###############################################################################
# Common - Configs, etc. shared across targets # Common - Configs, etc. shared across targets
############################################################################### ###############################################################################
@ -849,6 +853,7 @@ source_set("libtint") {
} }
} }
if (tint_build_unittests) {
############################################################################### ###############################################################################
# Gtest Gmock - Handle building inside and outside of Chromium. # Gtest Gmock - Handle building inside and outside of Chromium.
############################################################################### ###############################################################################
@ -1666,3 +1671,4 @@ test("tint_unittests") {
testonly = true testonly = true
} }
}

View File

@ -71,4 +71,9 @@ declare_args() {
if (!defined(tint_build_glsl_writer)) { if (!defined(tint_build_glsl_writer)) {
tint_build_glsl_writer = true tint_build_glsl_writer = true
} }
# Build unittests
if (!defined(tint_build_unittests)) {
tint_build_unittests = true
}
} }