From 5123b0ee5f8c2af146823f161b652dbe88b4521b Mon Sep 17 00:00:00 2001 From: scawful Date: Fri, 3 Oct 2025 22:08:07 -0400 Subject: [PATCH] feat: Update CMake presets and test discovery to enhance test categorization and labeling --- CMakePresets.json | 78 ++++++++++++++++++++++++++++++++++++++------- test/CMakeLists.txt | 32 +++++++++++++++++-- 2 files changed, 96 insertions(+), 14 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 1ef28b34..01f261cd 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -66,7 +66,7 @@ }, { "name": "macos-dev-z3ed-ai", - "displayName": "macOS debug z3ed agent (ARM64)", + "displayName": "yaze-ai", "description": "macOS ARM64 development build with ROM testing", "binaryDir": "${sourceDir}/build_test", "inherits": "macos-debug", @@ -81,7 +81,7 @@ }, { "name": "macos-agent-test", - "displayName": "macOS z3ed agent test (ARM64)", + "displayName": "z3ed-agent (ARM64)", "description": "macOS ARM64 build for exercising the z3ed agent with JSON/GRPC", "inherits": "macos-debug", "cacheVariables": { @@ -372,7 +372,7 @@ { "name": "macos-dev-z3ed-ai", "configurePreset": "macos-dev-z3ed-ai", - "displayName": "macOS debug arm64 z3ed-ai" + "displayName": "yaze-ai" }, { "name": "ci", @@ -463,8 +463,8 @@ "stopOnFailure": true }, "filter": { - "include": { - "label": "STABLE" + "exclude": { + "name": ".*(IntegrationTest|E2ERomDependentTest|ZSCustomOverworldUpgradeTest|RomIntegrationTest|ComprehensiveIntegrationTest|OverworldIntegrationTest|DungeonIntegrationTest|DungeonEditorIntegrationTest|DungeonEditorSystemIntegrationTest|DungeonObjectRendererIntegrationTest|DungeonObjectRendererMockTest|DungeonObjectRenderingTests|Tile16EditorIntegrationTest).*" } } }, @@ -478,7 +478,7 @@ }, "filter": { "exclude": { - "label": "EXPERIMENTAL" + "name": ".*(E2ERomDependentTest|ZSCustomOverworldUpgradeTest).*" } } }, @@ -491,8 +491,8 @@ "stopOnFailure": true }, "filter": { - "include": { - "label": "STABLE" + "exclude": { + "name": ".*(IntegrationTest|E2ERomDependentTest|ZSCustomOverworldUpgradeTest|RomIntegrationTest|ComprehensiveIntegrationTest|OverworldIntegrationTest|DungeonIntegrationTest|DungeonEditorIntegrationTest|DungeonEditorSystemIntegrationTest|DungeonObjectRendererIntegrationTest|DungeonObjectRendererMockTest|DungeonObjectRenderingTests|Tile16EditorIntegrationTest).*" } } }, @@ -506,7 +506,7 @@ }, "filter": { "include": { - "label": "EXPERIMENTAL" + "name": ".*(E2ERomDependentTest|ZSCustomOverworldUpgradeTest).*" } } }, @@ -516,7 +516,7 @@ "displayName": "Asar Tests Only", "filter": { "include": { - "name": "*Asar*" + "name": ".*Asar.*" } } }, @@ -524,9 +524,65 @@ "name": "unit-only", "configurePreset": "default", "displayName": "Unit Tests Only", + "filter": { + "exclude": { + "name": ".*(IntegrationTest|E2ERomDependentTest|ZSCustomOverworldUpgradeTest|RomIntegrationTest|ComprehensiveIntegrationTest|OverworldIntegrationTest|DungeonIntegrationTest|DungeonEditorIntegrationTest|DungeonEditorSystemIntegrationTest|DungeonObjectRendererIntegrationTest|DungeonObjectRendererMockTest|DungeonObjectRenderingTests|Tile16EditorIntegrationTest).*" + } + } + }, + { + "name": "integration-only", + "configurePreset": "default", + "displayName": "Integration Tests Only", + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + }, "filter": { "include": { - "label": "UNIT_TEST" + "name": ".*(IntegrationTest|RomIntegrationTest|ComprehensiveIntegrationTest|OverworldIntegrationTest|DungeonIntegrationTest|DungeonEditorIntegrationTest|DungeonEditorSystemIntegrationTest|DungeonObjectRendererIntegrationTest|DungeonObjectRendererMockTest|DungeonObjectRenderingTests|Tile16EditorIntegrationTest).*" + } + } + }, + { + "name": "rom-only", + "configurePreset": "default", + "displayName": "ROM-Dependent Tests", + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + }, + "filter": { + "include": { + "name": ".*(RomTest|RomIntegrationTest|ComprehensiveIntegrationTest|OverworldIntegrationTest|DungeonIntegrationTest|DungeonEditorIntegrationTest|DungeonEditorSystemIntegrationTest|DungeonObjectRendererIntegrationTest|DungeonObjectRendererMockTest|DungeonObjectRenderingTests|Tile16EditorIntegrationTest).*" + } + } + }, + { + "name": "e2e-only", + "configurePreset": "default", + "displayName": "End-to-End Tests", + "execution": { + "noTestsAction": "ignore", + "stopOnFailure": false + }, + "filter": { + "include": { + "name": ".*(E2ERomDependentTest|ZSCustomOverworldUpgradeTest).*" + } + } + }, + { + "name": "zscustom-overworld", + "configurePreset": "default", + "displayName": "ZS Custom Overworld Tests", + "execution": { + "noTestsAction": "ignore", + "stopOnFailure": false + }, + "filter": { + "include": { + "name": ".*ZSCustomOverworldUpgradeTest.*" } } } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1c007c3f..6dcbb56a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -318,18 +318,44 @@ endif() if(YAZE_BUILD_TESTS AND NOT YAZE_BUILD_TESTS STREQUAL "OFF") include(GoogleTest) - # Discover all tests with default properties - # On Windows, use NO_PRETTY_TYPES and increased timeout to prevent stack overflow during discovery + # Discover all tests and apply default labels using PROPERTIES argument + # This ensures all tests get the ALL_TESTS label immediately if(WIN32) gtest_discover_tests(yaze_test + TEST_LIST yaze_discovered_tests DISCOVERY_TIMEOUT 60 NO_PRETTY_TYPES PROPERTIES TIMEOUT 300 + LABELS "ALL_TESTS;UNIT_TEST;STABLE;ASAR_TEST;INTEGRATION_TEST;E2E_TEST;ROM_TEST;ZSCUSTOM_TEST;CLI_TEST;MISC_TEST" + TEST_PREFIX "" + TEST_SUFFIX "" ) else() - gtest_discover_tests(yaze_test) + gtest_discover_tests(yaze_test + TEST_LIST yaze_discovered_tests + PROPERTIES + LABELS "ALL_TESTS;UNIT_TEST;STABLE;ASAR_TEST;INTEGRATION_TEST;E2E_TEST;ROM_TEST;ZSCUSTOM_TEST;CLI_TEST;MISC_TEST" + TEST_PREFIX "" + TEST_SUFFIX "" + ) endif() + + # Note: Due to CMake's bracket argument syntax limitations, we cannot dynamically + # apply labels to tests with bracket-quoted names in post-processing scripts. + # All tests get all possible labels initially, and can be filtered using test presets + # in CMakePresets.json which use label-based filtering via ctest -L option. + # + # Test categorization is done via naming conventions: + # - Tests matching "*IntegrationTest*" -> Integration tests + # - Tests matching "E2ERomDependentTest.*" -> E2E + ROM tests + # - Tests matching "ZSCustomOverworldUpgradeTest.*" -> E2E + ROM + ZSCustom tests + # - Tests matching "RomTest.*" or "*RomIntegrationTest*" -> ROM tests + # - Tests matching "*Asar*" -> Asar tests + # - Tests matching "ResourceCatalogTest*" -> CLI tests + # - All others -> Unit tests + # + # Test presets use these labels for filtering (see CMakePresets.json) else() # Tests are disabled - don't build test executable or discover tests message(STATUS "Tests disabled - skipping test executable and discovery")