Skip to content

Add tests to trinity - #79

Draft
filipppavlov wants to merge 4 commits into
mainfrom
tests
Draft

Add tests to trinity#79
filipppavlov wants to merge 4 commits into
mainfrom
tests

Conversation

@filipppavlov

Copy link
Copy Markdown

Enable existing google tests to run on TC builds

…that require a metal compiler on Windows - it is not available on agents
Copilot AI lite review requested due to automatic review settings August 31, 2026 14:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_metalCompilerAvailable flag and use it to GTEST_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's GoogleTest module (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 thread trinityal/tests/CMakeLists.txt Outdated
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)

Comment thread shadercompiler/CMakeLists.txt Outdated
set_target_properties(ShaderCompilerTest PROPERTIES FOLDER "Tests")
add_dependencies(ShaderCompilerTest ShaderCompiler)

gtest_discover_tests(ShaderCompilerTest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants