diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33032a5e..26fac954 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -107,6 +107,7 @@ jobs: --exclude='build.ninja' \ --exclude='cmake_install.cmake' \ -czf ci-artifacts/mobilegl-linux-runtime.tgz \ + "${BUILD_DIR}/CTestTestfile.cmake" \ "${BUILD_DIR}/MobileGL/MG_Test" \ "${BUILD_DIR}/MobileGL/MG_Benchmark" \ "${SHARED_LIBS[@]}" @@ -156,12 +157,12 @@ jobs: PY - name: Test - working-directory: build-linux/MobileGL/MG_Test + working-directory: build-linux run: | if [ "${{ secrets.ACTIONS_STEP_DEBUG }}" = "true" ]; then - ctest -V + ctest -V -L unit --no-tests=error else - ctest --output-on-failure + ctest --output-on-failure -L unit --no-tests=error fi benchmark: @@ -202,8 +203,8 @@ jobs: PY - name: Benchmark - working-directory: build-linux/MobileGL/MG_Benchmark - run: ctest -V -C Release + working-directory: build-linux + run: ctest -V -C Release -L benchmark --no-tests=error build-retrace: runs-on: ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index 88a02fe5..75c34a0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -476,6 +476,15 @@ if (NOT ANDROID AND NOT MOBILEGL_IOS) endif () if (NOT ANDROID) + # Enable testing in the top-level scope so a CTestTestfile.cmake is emitted + # at the build-tree root. This lets `ctest` be invoked from the top-level + # build directory (IDE "run all tests", CI) and discover every test in the + # subdirectories below, instead of having to descend into each + # MG_Test/MG_Benchmark subdirectory. Tests are tagged with CTest labels + # (unit / benchmark / integration), so e.g. `ctest -L unit` selects just + # the unit suite. + enable_testing() + if (MOBILEGL_BUILD_TEST) add_subdirectory(MobileGL/MG_Test) endif() @@ -485,7 +494,6 @@ if (NOT ANDROID) endif() if (MOBILEGL_BUILD_TRACE_REPLAY) - enable_testing() add_subdirectory(tools/trace_replay) endif() endif() diff --git a/MobileGL/MG_Benchmark/Buffer/CMakeLists.txt b/MobileGL/MG_Benchmark/Buffer/CMakeLists.txt index 35a2d983..8e413a76 100644 --- a/MobileGL/MG_Benchmark/Buffer/CMakeLists.txt +++ b/MobileGL/MG_Benchmark/Buffer/CMakeLists.txt @@ -16,4 +16,5 @@ target_link_libraries( ${LINK_LIBRARIES} ) -add_test(NAME BufferBench COMMAND BufferBench --benchmark_counters_tabular=true) \ No newline at end of file +add_test(NAME BufferBench COMMAND BufferBench --benchmark_counters_tabular=true) +set_tests_properties(BufferBench PROPERTIES LABELS benchmark) \ No newline at end of file diff --git a/MobileGL/MG_Benchmark/CMakeLists.txt b/MobileGL/MG_Benchmark/CMakeLists.txt index 6015aae6..a54decdb 100644 --- a/MobileGL/MG_Benchmark/CMakeLists.txt +++ b/MobileGL/MG_Benchmark/CMakeLists.txt @@ -38,6 +38,7 @@ target_link_libraries( ) add_test(NAME SanityBench COMMAND SanityBench --benchmark_counters_tabular=true) +set_tests_properties(SanityBench PROPERTIES LABELS benchmark) add_subdirectory(Program) add_subdirectory(Buffer) \ No newline at end of file diff --git a/MobileGL/MG_Benchmark/Program/CMakeLists.txt b/MobileGL/MG_Benchmark/Program/CMakeLists.txt index c8685a5b..317b4c7b 100644 --- a/MobileGL/MG_Benchmark/Program/CMakeLists.txt +++ b/MobileGL/MG_Benchmark/Program/CMakeLists.txt @@ -16,4 +16,5 @@ target_link_libraries( ${LINK_LIBRARIES} ) -add_test(NAME ProgramBench COMMAND ProgramBench --benchmark_counters_tabular=true) \ No newline at end of file +add_test(NAME ProgramBench COMMAND ProgramBench --benchmark_counters_tabular=true) +set_tests_properties(ProgramBench PROPERTIES LABELS benchmark) \ No newline at end of file diff --git a/MobileGL/MG_Test/Backend/DirectVulkan/CMakeLists.txt b/MobileGL/MG_Test/Backend/DirectVulkan/CMakeLists.txt index f375d54b..0fb14143 100644 --- a/MobileGL/MG_Test/Backend/DirectVulkan/CMakeLists.txt +++ b/MobileGL/MG_Test/Backend/DirectVulkan/CMakeLists.txt @@ -49,7 +49,7 @@ endif() target_compile_definitions(DirectVulkanSanityTest PRIVATE -DNOMINMAX) include(GoogleTest) -gtest_discover_tests(DirectVulkanSanityTest DISCOVERY_TIMEOUT 30) +gtest_discover_tests(DirectVulkanSanityTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS integration) add_executable( DirectVulkanTestExec diff --git a/MobileGL/MG_Test/BackendLoader/CMakeLists.txt b/MobileGL/MG_Test/BackendLoader/CMakeLists.txt index 60a85064..ea5ae92a 100644 --- a/MobileGL/MG_Test/BackendLoader/CMakeLists.txt +++ b/MobileGL/MG_Test/BackendLoader/CMakeLists.txt @@ -17,4 +17,4 @@ target_link_libraries( ) include(GoogleTest) -gtest_discover_tests(BackendLoaderTest DISCOVERY_TIMEOUT 30) +gtest_discover_tests(BackendLoaderTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit) diff --git a/MobileGL/MG_Test/Buffer/CMakeLists.txt b/MobileGL/MG_Test/Buffer/CMakeLists.txt index 0c59551f..2ac5fb76 100644 --- a/MobileGL/MG_Test/Buffer/CMakeLists.txt +++ b/MobileGL/MG_Test/Buffer/CMakeLists.txt @@ -24,4 +24,4 @@ if (MSVC) endif() include(GoogleTest) -gtest_discover_tests(BufferTest DISCOVERY_TIMEOUT 30) +gtest_discover_tests(BufferTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit) diff --git a/MobileGL/MG_Test/CMakeLists.txt b/MobileGL/MG_Test/CMakeLists.txt index 24c9d084..f7b98c9e 100644 --- a/MobileGL/MG_Test/CMakeLists.txt +++ b/MobileGL/MG_Test/CMakeLists.txt @@ -62,7 +62,7 @@ set(LINK_LIBRARIES ) include(GoogleTest) -gtest_discover_tests(SanityTest DISCOVERY_TIMEOUT 30) +gtest_discover_tests(SanityTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit) add_subdirectory(BackendLoader) add_subdirectory(Buffer) diff --git a/MobileGL/MG_Test/EGLState/CMakeLists.txt b/MobileGL/MG_Test/EGLState/CMakeLists.txt index 93fac362..344e7af8 100644 --- a/MobileGL/MG_Test/EGLState/CMakeLists.txt +++ b/MobileGL/MG_Test/EGLState/CMakeLists.txt @@ -17,4 +17,4 @@ target_link_libraries( ) include(GoogleTest) -gtest_discover_tests(EGLStateTest DISCOVERY_TIMEOUT 30) +gtest_discover_tests(EGLStateTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit) diff --git a/MobileGL/MG_Test/Framebuffer/CMakeLists.txt b/MobileGL/MG_Test/Framebuffer/CMakeLists.txt index 75d1fcb9..9a928980 100644 --- a/MobileGL/MG_Test/Framebuffer/CMakeLists.txt +++ b/MobileGL/MG_Test/Framebuffer/CMakeLists.txt @@ -17,4 +17,4 @@ target_link_libraries( ) include(GoogleTest) -gtest_discover_tests(FramebufferTest DISCOVERY_TIMEOUT 30) +gtest_discover_tests(FramebufferTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit) diff --git a/MobileGL/MG_Test/Program/CMakeLists.txt b/MobileGL/MG_Test/Program/CMakeLists.txt index 0ccab535..48671244 100644 --- a/MobileGL/MG_Test/Program/CMakeLists.txt +++ b/MobileGL/MG_Test/Program/CMakeLists.txt @@ -39,5 +39,5 @@ target_link_libraries( ) include(GoogleTest) -gtest_discover_tests(ProgramUtilTest DISCOVERY_TIMEOUT 30) -gtest_discover_tests(ProgramTest DISCOVERY_TIMEOUT 30) +gtest_discover_tests(ProgramUtilTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit) +gtest_discover_tests(ProgramTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit) diff --git a/MobileGL/MG_Test/Query/CMakeLists.txt b/MobileGL/MG_Test/Query/CMakeLists.txt index 7f2925ca..28ebd8c2 100644 --- a/MobileGL/MG_Test/Query/CMakeLists.txt +++ b/MobileGL/MG_Test/Query/CMakeLists.txt @@ -17,4 +17,4 @@ target_link_libraries( ) include(GoogleTest) -gtest_discover_tests(QueryTest DISCOVERY_TIMEOUT 30) +gtest_discover_tests(QueryTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit) diff --git a/MobileGL/MG_Test/Texture/CMakeLists.txt b/MobileGL/MG_Test/Texture/CMakeLists.txt index 060e85b3..8c46131e 100644 --- a/MobileGL/MG_Test/Texture/CMakeLists.txt +++ b/MobileGL/MG_Test/Texture/CMakeLists.txt @@ -17,7 +17,7 @@ target_link_libraries( ) include(GoogleTest) -gtest_discover_tests(TextureTest DISCOVERY_TIMEOUT 30) +gtest_discover_tests(TextureTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit) add_executable( VkClearManagerTest @@ -35,4 +35,4 @@ target_link_libraries( ${LINK_LIBRARIES} ) -gtest_discover_tests(VkClearManagerTest DISCOVERY_TIMEOUT 30) +gtest_discover_tests(VkClearManagerTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit) diff --git a/MobileGL/MG_Test/VertexArray/CMakeLists.txt b/MobileGL/MG_Test/VertexArray/CMakeLists.txt index 0221674e..bac2f850 100644 --- a/MobileGL/MG_Test/VertexArray/CMakeLists.txt +++ b/MobileGL/MG_Test/VertexArray/CMakeLists.txt @@ -17,4 +17,4 @@ target_link_libraries( ) include(GoogleTest) -gtest_discover_tests(VertexArrayTest DISCOVERY_TIMEOUT 30) +gtest_discover_tests(VertexArrayTest DISCOVERY_TIMEOUT 30 PROPERTIES LABELS unit)