Enhance CI testing framework and documentation
- Updated CI workflow to include the new MessageTest in core tests and refined additional unit tests for better information capture. - Introduced a simplified CI test executable (`yaze_test_ci.cc`) to improve reliability by excluding ROM-dependent and E2E tests. - Expanded documentation to detail the testing system, including categories, execution methods, and configuration options for local and CI environments. - Improved CMake configuration to differentiate between minimal and full-featured test builds, ensuring appropriate test execution based on the build type.
This commit is contained in:
@@ -12,53 +12,106 @@ foreach (file
|
||||
endforeach()
|
||||
|
||||
# Main test executable with enhanced argument handling for AI agents
|
||||
add_executable(
|
||||
yaze_test
|
||||
yaze_test.cc
|
||||
test_editor.cc
|
||||
test_editor.h
|
||||
testing.h
|
||||
test_utils.h
|
||||
# Use CI version for minimal builds, full version for development
|
||||
if(YAZE_MINIMAL_BUILD)
|
||||
# CI/Minimal build: use simplified test executable
|
||||
add_executable(
|
||||
yaze_test
|
||||
yaze_test_ci.cc
|
||||
test_editor.cc
|
||||
test_editor.h
|
||||
testing.h
|
||||
test_utils.h
|
||||
|
||||
# Unit Tests
|
||||
unit/core/asar_wrapper_test.cc
|
||||
unit/core/hex_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/zelda3/message_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/sprite_position_test.cc
|
||||
unit/zelda3/test_dungeon_objects.cc
|
||||
unit/zelda3/dungeon_component_unit_test.cc
|
||||
|
||||
# Integration Tests
|
||||
integration/asar_integration_test.cc
|
||||
integration/asar_rom_test.cc
|
||||
integration/dungeon_editor_test.cc
|
||||
integration/dungeon_editor_test.h
|
||||
integration/editor/tile16_editor_test.cc
|
||||
integration/editor/editor_integration_test.cc
|
||||
integration/editor/editor_integration_test.h
|
||||
|
||||
# E2E Tests
|
||||
e2e/rom_dependent/e2e_rom_test.cc
|
||||
e2e/zscustomoverworld/zscustomoverworld_upgrade_test.cc
|
||||
|
||||
# Legacy Integration Tests (to be migrated)
|
||||
unit/zelda3/comprehensive_integration_test.cc
|
||||
unit/zelda3/overworld_integration_test.cc
|
||||
unit/zelda3/dungeon_integration_test.cc
|
||||
unit/zelda3/dungeon_editor_system_integration_test.cc
|
||||
unit/zelda3/dungeon_object_renderer_integration_test.cc
|
||||
unit/zelda3/dungeon_object_renderer_mock_test.cc
|
||||
unit/zelda3/dungeon_object_rendering_tests.cc
|
||||
unit/zelda3/dungeon_room_test.cc
|
||||
)
|
||||
# Unit Tests
|
||||
unit/core/asar_wrapper_test.cc
|
||||
unit/core/hex_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/zelda3/message_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/sprite_position_test.cc
|
||||
unit/zelda3/test_dungeon_objects.cc
|
||||
unit/zelda3/dungeon_component_unit_test.cc
|
||||
|
||||
# Integration Tests
|
||||
integration/asar_integration_test.cc
|
||||
integration/asar_rom_test.cc
|
||||
integration/dungeon_editor_test.cc
|
||||
integration/dungeon_editor_test.h
|
||||
integration/editor/tile16_editor_test.cc
|
||||
integration/editor/editor_integration_test.cc
|
||||
integration/editor/editor_integration_test.h
|
||||
|
||||
# E2E Tests (excluded in CI builds)
|
||||
e2e/rom_dependent/e2e_rom_test.cc
|
||||
e2e/zscustomoverworld/zscustomoverworld_upgrade_test.cc
|
||||
|
||||
# Legacy Integration Tests (to be migrated)
|
||||
unit/zelda3/comprehensive_integration_test.cc
|
||||
unit/zelda3/overworld_integration_test.cc
|
||||
unit/zelda3/dungeon_integration_test.cc
|
||||
unit/zelda3/dungeon_editor_system_integration_test.cc
|
||||
unit/zelda3/dungeon_object_renderer_integration_test.cc
|
||||
unit/zelda3/dungeon_object_renderer_mock_test.cc
|
||||
unit/zelda3/dungeon_object_rendering_tests.cc
|
||||
unit/zelda3/dungeon_room_test.cc
|
||||
)
|
||||
else()
|
||||
# Development build: use full-featured test executable
|
||||
add_executable(
|
||||
yaze_test
|
||||
yaze_test.cc
|
||||
test_editor.cc
|
||||
test_editor.h
|
||||
testing.h
|
||||
test_utils.h
|
||||
|
||||
# Unit Tests
|
||||
unit/core/asar_wrapper_test.cc
|
||||
unit/core/hex_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/zelda3/message_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/sprite_position_test.cc
|
||||
unit/zelda3/test_dungeon_objects.cc
|
||||
unit/zelda3/dungeon_component_unit_test.cc
|
||||
|
||||
# Integration Tests
|
||||
integration/asar_integration_test.cc
|
||||
integration/asar_rom_test.cc
|
||||
integration/dungeon_editor_test.cc
|
||||
integration/dungeon_editor_test.h
|
||||
integration/editor/tile16_editor_test.cc
|
||||
integration/editor/editor_integration_test.cc
|
||||
integration/editor/editor_integration_test.h
|
||||
|
||||
# E2E Tests (included in development builds)
|
||||
e2e/rom_dependent/e2e_rom_test.cc
|
||||
e2e/zscustomoverworld/zscustomoverworld_upgrade_test.cc
|
||||
|
||||
# Legacy Integration Tests (to be migrated)
|
||||
unit/zelda3/comprehensive_integration_test.cc
|
||||
unit/zelda3/overworld_integration_test.cc
|
||||
unit/zelda3/dungeon_integration_test.cc
|
||||
unit/zelda3/dungeon_editor_system_integration_test.cc
|
||||
unit/zelda3/dungeon_object_renderer_integration_test.cc
|
||||
unit/zelda3/dungeon_object_renderer_mock_test.cc
|
||||
unit/zelda3/dungeon_object_rendering_tests.cc
|
||||
unit/zelda3/dungeon_room_test.cc
|
||||
)
|
||||
endif()
|
||||
|
||||
# Add vanilla value extraction utility (only for local development with ROM access)
|
||||
if(NOT YAZE_MINIMAL_BUILD AND YAZE_ENABLE_ROM_TESTS)
|
||||
|
||||
46
test/yaze_test_ci.cc
Normal file
46
test/yaze_test_ci.cc
Normal file
@@ -0,0 +1,46 @@
|
||||
// Simplified test executable for CI/CD builds
|
||||
// This version removes complex argument parsing and SDL initialization
|
||||
// to ensure reliable test discovery and execution in automated environments
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "absl/debugging/failure_signal_handler.h"
|
||||
#include "absl/debugging/symbolize.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
// Initialize symbolizer for better error reporting
|
||||
absl::InitializeSymbolizer(argv[0]);
|
||||
|
||||
// Configure failure signal handler to be less aggressive for CI
|
||||
absl::FailureSignalHandlerOptions options;
|
||||
options.symbolize_stacktrace = true;
|
||||
options.use_alternate_stack = false;
|
||||
options.alarm_on_failure_secs = false;
|
||||
options.call_previous_handler = true;
|
||||
options.writerfn = nullptr;
|
||||
absl::InstallFailureSignalHandler(options);
|
||||
|
||||
// Initialize Google Test with minimal configuration
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
// Set up basic test environment
|
||||
::testing::FLAGS_gtest_color = "yes";
|
||||
::testing::FLAGS_gtest_print_time = true;
|
||||
|
||||
// For CI builds, skip ROM-dependent tests by default
|
||||
// These tests require actual ROM files which aren't available in CI
|
||||
std::string filter = ::testing::GTEST_FLAG(filter);
|
||||
if (filter.empty()) {
|
||||
// Default filter for CI: exclude ROM-dependent and E2E tests
|
||||
::testing::GTEST_FLAG(filter) = "-*RomTest*:-*E2E*:-*ZSCustomOverworld*";
|
||||
}
|
||||
|
||||
std::cout << "Running YAZE tests in CI mode..." << std::endl;
|
||||
std::cout << "Test filter: " << ::testing::GTEST_FLAG(filter) << std::endl;
|
||||
|
||||
// Run tests
|
||||
int result = RUN_ALL_TESTS();
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user