backend-infra-engineer: Release v0.3.2 snapshot

This commit is contained in:
scawful
2025-10-17 12:10:25 -04:00
parent 4371618a9b
commit 3d71417f62
857 changed files with 174954 additions and 45626 deletions

View File

@@ -1,158 +1,163 @@
# This file defines the yaze test suites and configures test discovery with labels.
set(YAZE_SRC_FILES "")
foreach (file
app/rom.cc
${YAZE_APP_CORE_SRC}
${YAZE_APP_EMU_SRC}
${YAZE_APP_GFX_SRC}
${YAZE_APP_ZELDA3_SRC}
${YAZE_APP_EDITOR_SRC}
${YAZE_UTIL_SRC}
${YAZE_GUI_SRC})
list(APPEND YAZE_SRC_FILES ${CMAKE_SOURCE_DIR}/src/${file})
endforeach()
if(YAZE_BUILD_TESTS)
add_executable(
yaze_test
yaze_test.cc
rom_test.cc
test_editor.cc
hex_test.cc
core/asar_wrapper_test.cc
gfx/snes_tile_test.cc
gfx/compression_test.cc
gfx/snes_palette_test.cc
zelda3/message_test.cc
zelda3/overworld_test.cc
zelda3/overworld_integration_test.cc
zelda3/comprehensive_integration_test.cc
zelda3/dungeon_integration_test.cc
zelda3/dungeon_object_renderer_integration_test.cc
zelda3/dungeon_object_renderer_mock_test.cc
zelda3/dungeon_editor_system_integration_test.cc
zelda3/sprite_builder_test.cc
zelda3/sprite_position_test.cc
emu/cpu_test.cc
emu/ppu_test.cc
emu/spc700_test.cc
emu/audio/apu_test.cc
emu/audio/ipl_handshake_test.cc
integration/dungeon_editor_test.cc
dungeon_component_unit_test.cc
integration/asar_integration_test.cc
integration/asar_rom_test.cc
editor/tile16_editor_test.cc
zelda3/object_parser_test.cc
zelda3/object_parser_structs_test.cc
zelda3/test_dungeon_objects.cc
)
# Helper function to create and configure a test executable for a suite of tests.
# This function adds the executable, links common dependencies, discovers the
# tests using gtest_discover_tests, and assigns a label to all discovered tests.
function(yaze_add_test_suite suite_name label is_gui_test)
set(sources ${ARGN})
add_executable(${suite_name} yaze_test.cc ${sources})
# Add vanilla value extraction utility (only for local development with ROM access)
if(NOT YAZE_MINIMAL_BUILD AND YAZE_ENABLE_ROM_TESTS)
add_executable(
extract_vanilla_values
zelda3/extract_vanilla_values.cc
${YAZE_SRC_FILES}
)
target_include_directories(
extract_vanilla_values PUBLIC
${CMAKE_SOURCE_DIR}/src/app/
${CMAKE_SOURCE_DIR}/src/lib/
${CMAKE_SOURCE_DIR}/incl/
${CMAKE_SOURCE_DIR}/src/
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
${CMAKE_SOURCE_DIR}/src/lib/asar/src
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c
${SDL2_INCLUDE_DIR}
${PNG_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}
)
target_link_libraries(
extract_vanilla_values
${SDL_TARGETS}
asar-static
${ABSL_TARGETS}
${PNG_LIBRARIES}
${OPENGL_LIBRARIES}
${CMAKE_DL_LIBS}
)
# Conditionally link yaze_c only when library is built
if(YAZE_BUILD_LIB)
target_link_libraries(extract_vanilla_values yaze_c)
endif()
endif()
target_include_directories(
yaze_test PUBLIC
${CMAKE_SOURCE_DIR}/src/app/
${CMAKE_SOURCE_DIR}/src/lib/
${CMAKE_SOURCE_DIR}/incl/
${CMAKE_SOURCE_DIR}/src/
${CMAKE_SOURCE_DIR}/test/
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
${CMAKE_SOURCE_DIR}/src/lib/asar/src
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar
${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c
${SDL2_INCLUDE_DIR}
${PNG_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}
)
target_link_libraries(
yaze_test
${SDL_TARGETS}
asar-static
${ABSL_TARGETS}
${PNG_LIBRARIES}
${OPENGL_LIBRARIES}
${CMAKE_DL_LIBS}
ImGui
gmock_main
gmock
gtest_main
gtest
)
# Link core library for essential functionality (BPS, ASAR, etc.)
if(YAZE_BUILD_LIB)
target_link_libraries(yaze_test yaze_core)
endif()
# Conditionally link ImGuiTestEngine only when UI tests are enabled
if(YAZE_ENABLE_UI_TESTS)
target_link_libraries(yaze_test ${IMGUI_TEST_ENGINE_TARGET})
target_compile_definitions(yaze_test PRIVATE ${IMGUI_TEST_ENGINE_DEFINITIONS})
endif()
# ROM Testing Configuration
if(YAZE_ENABLE_ROM_TESTS)
target_compile_definitions(yaze_test PRIVATE
YAZE_ENABLE_ROM_TESTS=1
YAZE_TEST_ROM_PATH="${YAZE_TEST_ROM_PATH}"
target_include_directories(${suite_name} PUBLIC
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/incl
${CMAKE_SOURCE_DIR}/test
${CMAKE_SOURCE_DIR}/src/lib
${CMAKE_SOURCE_DIR}/src/lib/imgui
${CMAKE_SOURCE_DIR}/src/lib/imgui/backends
${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine
${CMAKE_SOURCE_DIR}/src/lib/SDL/include
${CMAKE_SOURCE_DIR}/third_party/json/include
${CMAKE_BINARY_DIR}/src/lib/SDL/include
${PROJECT_BINARY_DIR}
)
target_link_libraries(${suite_name} PRIVATE
yaze_test_support
gmock_main
gtest_main
absl::failure_signal_handler
absl::flags
absl::flags_parse
ImGui
${SDL_TARGETS}
)
# Link ImGui Test Engine for GUI tests (always available when tests are built)
if(is_gui_test AND TARGET ImGuiTestEngine)
target_link_libraries(${suite_name} PRIVATE ImGuiTestEngine)
target_compile_definitions(${suite_name} PRIVATE
IMGUI_ENABLE_TEST_ENGINE=1
IMGUI_TEST_ENGINE_ENABLE_COROUTINE_STDTHREAD_IMPL=1
YAZE_GUI_TEST_TARGET=1) # Mark this as a GUI test target
endif()
if(WIN32)
message(STATUS "Configuring Windows stack size for ${suite_name} to 16MB")
if(MSVC)
target_link_options(${suite_name} PRIVATE /STACK:16777216)
# Force whole-archive linking for protobuf to ensure all symbols are included
if(YAZE_WITH_GRPC AND MSVC AND YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
foreach(_yaze_proto_target IN LISTS YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
target_link_options(${suite_name} PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:${_yaze_proto_target}>)
endforeach()
endif()
else()
target_link_options(${suite_name} PRIVATE -Wl,--stack,16777216)
endif()
endif()
include(GoogleTest)
if(WIN32)
gtest_discover_tests(${suite_name}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DISCOVERY_TIMEOUT 60
PROPERTIES LABELS "${label}"
)
else()
gtest_discover_tests(${suite_name}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
PROPERTIES LABELS "${label}"
)
endif()
endfunction()
# --- Stable Test Suite (Valid Contracts) ---
set(STABLE_TEST_SOURCES
test_editor.cc
test_utils.cc
# Unit Tests
unit/core/asar_wrapper_test.cc
unit/core/hex_test.cc
unit/cli/resource_catalog_test.cc
unit/rom/rom_test.cc
unit/gfx/snes_tile_test.cc
unit/gfx/compression_test.cc
unit/gfx/snes_palette_test.cc
unit/snes_color_test.cc
unit/gui/tile_selector_widget_test.cc
unit/gui/canvas_automation_api_test.cc
unit/zelda3/overworld_test.cc
unit/zelda3/object_parser_test.cc
unit/zelda3/object_parser_structs_test.cc
unit/zelda3/sprite_builder_test.cc
unit/zelda3/dungeon_component_unit_test.cc
unit/zelda3/dungeon/room_object_encoding_test.cc
unit/zelda3/dungeon/room_manipulation_test.cc
../src/cli/service/resources/resource_catalog.cc
cli/service/resources/command_context_test.cc
# Integration Tests
integration/asar_integration_test.cc
integration/dungeon_editor_test.cc
integration/dungeon_editor_v2_test.cc
integration/editor/tile16_editor_test.cc
integration/editor/editor_integration_test.cc
integration/zelda3/overworld_integration_test.cc
integration/zelda3/dungeon_editor_system_integration_test.cc
integration/zelda3/room_integration_test.cc
integration/zelda3/dungeon_object_rendering_tests.cc
integration/zelda3/dungeon_room_test.cc
integration/zelda3/sprite_position_test.cc
integration/zelda3/message_test.cc
integration/palette_manager_test.cc
)
yaze_add_test_suite(yaze_test_stable "stable" OFF ${STABLE_TEST_SOURCES})
# --- ROM Dependent Test Suite ---
if(YAZE_ENABLE_ROM_TESTS)
set(ROM_DEPENDENT_TEST_SOURCES
integration/asar_rom_test.cc
e2e/rom_dependent/e2e_rom_test.cc
e2e/zscustomoverworld/zscustomoverworld_upgrade_test.cc
)
yaze_add_test_suite(yaze_test_rom_dependent "rom_dependent" OFF ${ROM_DEPENDENT_TEST_SOURCES})
target_compile_definitions(yaze_test_rom_dependent PRIVATE
YAZE_ENABLE_ROM_TESTS=1
YAZE_TEST_ROM_PATH="${YAZE_TEST_ROM_PATH}"
)
endif()
# --- Experimental & GUI Test Suites ---
# GUI tests always available when tests are built (uses ImGui Test Engine)
set(GUI_TEST_SOURCES
test_utils.cc
e2e/framework_smoke_test.cc
e2e/dungeon_editor_smoke_test.cc
e2e/canvas_selection_test.cc
integration/ai/ai_gui_controller_test.cc
)
yaze_add_test_suite(yaze_test_gui "gui;experimental" ON ${GUI_TEST_SOURCES})
# Add a single test entry to run the entire GUI suite headlessly
add_test(
NAME headless_gui_suite
COMMAND $<TARGET_FILE:yaze_test_gui> -nogui
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
set_tests_properties(headless_gui_suite PROPERTIES LABELS "headless_gui;experimental")
set(EXPERIMENTAL_TEST_SOURCES
test_utils.cc
integration/ai/test_ai_tile_placement.cc
integration/ai/test_gemini_vision.cc
)
yaze_add_test_suite(yaze_test_experimental "experimental" OFF ${EXPERIMENTAL_TEST_SOURCES})
# --- Benchmark Test Suite ---
set(BENCHMARK_TEST_SOURCES
benchmarks/gfx_optimization_benchmarks.cc
)
yaze_add_test_suite(yaze_test_benchmark "benchmark" OFF ${BENCHMARK_TEST_SOURCES})
endif()
# ImGui Test Engine definitions are now handled conditionally above
# Platform-specific definitions
if(UNIX AND NOT APPLE)
target_compile_definitions(yaze_test PRIVATE "linux" "stricmp=strcasecmp")
elseif(APPLE)
target_compile_definitions(yaze_test PRIVATE "MACOS" "stricmp=strcasecmp")
elseif(WIN32)
target_compile_definitions(yaze_test PRIVATE "WINDOWS")
endif()
include(GoogleTest)
# Configure test discovery with efficient labeling for CI/CD
include(GoogleTest)
# Discover all tests with default properties
gtest_discover_tests(yaze_test)
# Add test labels using a simpler approach
# Note: Test names might have prefixes, we'll use regex patterns for CI