[msl-writer] Support MSL compiler validation in unit tests

The MSL writer GTest harness (TestHelper) now provides a function to
invoke the XCode SDK Metal compiler for the MSL output of a given
tint::Program.

The tint_unittests binary now provides the `--validate-msl` and
`--xcrun-path` command-line flags to optionally enable MSL validation
and to configure its path.

The MSL validation logic itself is conditionally compiled based on the
TINT_BUILD_MSL_WRITER define. The TINT_BUILD_* flags were previously
not propagated to the GTest binary which this CL addresses by linking
the common/public tint configs when building the tint_unittests_main
target.

Bug: tint:535
Fixed: tint:696
Change-Id: I08b1c36ba59c606ef6cffa5fa5454fd8cf8b035d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/45800
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Arman Uguray <armansito@chromium.org>
This commit is contained in:
Arman Uguray
2021-04-14 15:36:58 +00:00
committed by Commit Bot service account
parent f8313e5a6e
commit d13982ff2e
5 changed files with 153 additions and 0 deletions

View File

@@ -88,6 +88,7 @@ source_set("tint_unittests_main") {
sources = [ "//gpu/tint_unittests_main.cc" ]
} else {
sources = [ "../src/test_main.cc" ]
deps += [ "${tint_root_dir}/src:libtint" ]
}
}
@@ -538,6 +539,7 @@ source_set("tint_unittests_msl_writer_src") {
"../src/writer/msl/generator_impl_type_test.cc",
"../src/writer/msl/generator_impl_unary_op_test.cc",
"../src/writer/msl/generator_impl_variable_decl_statement_test.cc",
"../src/writer/msl/test_helper.cc",
"../src/writer/msl/test_helper.h",
]