Add tests to trinity - #79
Draft
filipppavlov wants to merge 4 commits into
Draft
Conversation
…that require a metal compiler on Windows - it is not available on agents
There was a problem hiding this comment.
🟡 Changes recommended
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR aims to enable existing GoogleTest-based tests to run in TC builds by turning on CTest at the top level and registering test executables via gtest_discover_tests, while also skipping Metal-dependent shadercompiler tests when the Metal toolchain isn’t available.
Changes:
- Enable CTest (
enable_testing()) when building as the top-level project. - Register test executables with CTest using
gtest_discover_tests(TrinityAL tests + ShaderCompiler tests). - Add a
g_metalCompilerAvailableflag and use it toGTEST_SKIP()Metal-dependent tests when the Metal compiler isn’t available (primarily on Windows).
File summaries
| File | Description |
|---|---|
CMakeLists.txt |
Enables testing when the project is top-level. |
trinityal/tests/CMakeLists.txt |
Registers TrinityAL DX11/DX12 tests via gtest_discover_tests. |
shadercompiler/CMakeLists.txt |
Registers ShaderCompiler tests via gtest_discover_tests. |
shadercompiler/tests/TesingUtils.h |
Exposes g_metalCompilerAvailable for test files. |
shadercompiler/tests/ShaderCompilerTest.cpp |
Implements Windows-side Metal compiler availability detection. |
shadercompiler/tests/RayTracingTest.cpp |
Skips Metal-compiler-dependent typed tests when unavailable. |
shadercompiler/tests/MetalConversionTest.cpp |
Skips Metal conversion tests when the Metal compiler is unavailable. |
shadercompiler/EffectCompilerMetal.cpp |
Minor Windows command string construction fix for Metal tool path. |
Review details
Suppressed comments (1)
trinityal/tests/CMakeLists.txt:261
gtest_discover_tests()requires CMake'sGoogleTestmodule (include(GoogleTest)). Without it, configuration fails with "Unknown CMake command "gtest_discover_tests"" when BUILD_DX11 is off but BUILD_DX12 is on.
#GTest
set_target_properties(TrinityALTest_dx12 PROPERTIES FOLDER "Tests")
gtest_discover_tests(TrinityALTest_dx12)
- Files reviewed: 8/8 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+65
to
+77
| FILE* process = _popen( cmd.str().c_str(), "r" ); | ||
| char readBuffer[128]; | ||
| while( fgets( readBuffer, sizeof( readBuffer ), process ) ) | ||
| { | ||
| } | ||
| if( !process ) | ||
| { | ||
| g_metalCompilerAvailable = false; | ||
| } | ||
| else | ||
| { | ||
| g_metalCompilerAvailable = _pclose( process ) == 0; | ||
| } |
Comment on lines
173
to
176
| #GTest | ||
| set_target_properties(TrinityALTest_dx11 PROPERTIES FOLDER "Tests") | ||
| #gtest_discover_tests(TrinityALTest_dx11 myListOfTests) | ||
| gtest_discover_tests(TrinityALTest_dx11) | ||
|
|
| set_target_properties(ShaderCompilerTest PROPERTIES FOLDER "Tests") | ||
| add_dependencies(ShaderCompilerTest ShaderCompiler) | ||
|
|
||
| gtest_discover_tests(ShaderCompilerTest) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enable existing google tests to run on TC builds