diff options
author | Scott Todd <scott.todd0@gmail.com> | 2024-01-26 13:47:13 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 16:47:13 -0500 |
commit | 80bc99c3d4a33fe07ae5dc93147bdd9495688b10 (patch) | |
tree | 7391b49e2de920a40bd11c0c607cdd83f1332f9c | |
parent | 0a6f0d1893fe6de870e5f504fd6253b3595d4d23 (diff) | |
download | SPIRV-Tools-80bc99c3d4a33fe07ae5dc93147bdd9495688b10.tar.gz |
Skip entire test/ folder if SPIRV_SKIP_TESTS is set. (#5548)
Without this (or similar filtering), the `spirv-tools_expect_unittests` and `spirv-tools_spirv_test_framework_unittests` Python tests at `test/tools/` get defined even when `SPIRV_SKIP_TESTS` is set.
-rw-r--r-- | test/CMakeLists.txt | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 662c0bf4..40c64f80 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -12,22 +12,23 @@ # See the License for the specific language governing permissions and # limitations under the License. +if (${SPIRV_SKIP_TESTS}) + return() +endif() + +if (TARGET gmock_main) + message(STATUS "Found Google Mock, building tests.") +else() + message(STATUS "Did not find googletest, tests will not be built. " + "To enable tests place googletest in '<spirv-dir>/external/googletest'.") +endif() + # Add a SPIR-V Tools unit test. Signature: # add_spvtools_unittest( # TARGET target_name # SRCS src_file.h src_file.cpp # LIBS lib1 lib2 # ) - -if (NOT "${SPIRV_SKIP_TESTS}") - if (TARGET gmock_main) - message(STATUS "Found Google Mock, building tests.") - else() - message(STATUS "Did not find googletest, tests will not be built. " - "To enable tests place googletest in '<spirv-dir>/external/googletest'.") - endif() -endif() - function(add_spvtools_unittest) if (NOT "${SPIRV_SKIP_TESTS}" AND TARGET gmock_main) set(one_value_args TARGET PCH_FILE) |