mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-25 18:05:12 -04:00
1323 lines
68 KiB
CMake
1323 lines
68 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
project(psxrecomp-runtime C CXX)
|
|
include(CTest)
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
# ---- Native/oracle runtime targets ----
|
|
|
|
set(PSXRECOMP_ROOT "${CMAKE_SOURCE_DIR}/..")
|
|
include("${CMAKE_SOURCE_DIR}/runtime.cmake")
|
|
|
|
psxrecomp_add_runtime_target(psx-runtime
|
|
DEBUG_PORT 4370
|
|
WINDOW_TITLE "psxrecomp - BIOS"
|
|
DEFAULT_BIOS_PATH "${PSXRECOMP_ROOT}/bios/SCPH1001.BIN"
|
|
EXE_NAME "PSXRecomp"
|
|
)
|
|
|
|
# With -DPSX_PGXP_VARIANT=ON, psxrecomp_add_runtime_target auto-clones a
|
|
# psx-runtime-pgxp sibling (PSXRecomp_pgxp.exe) compiled with -DPSX_PGXP=1 —
|
|
# the framework-dev validation surface for the PGXP value-propagation engine
|
|
# (docs/ENHANCEMENTS.md G1.10). Titles get their <exe>_pgxp the same way.
|
|
|
|
if(BUILD_TESTING)
|
|
# Netplay: which BIOS a match boots, and its wire helpers.
|
|
add_executable(netplay_bios_settle_test
|
|
tests/test_netplay_bios_settle.c
|
|
src/netplay_bios_settle.c)
|
|
target_include_directories(netplay_bios_settle_test PRIVATE include)
|
|
add_test(NAME netplay_bios_settle_test COMMAND netplay_bios_settle_test)
|
|
# Netplay: why a match ended, and when a boot-digest mismatch is final.
|
|
add_executable(netplay_exit_reason_test
|
|
tests/test_netplay_exit_reason.c
|
|
src/netplay_exit_reason.c)
|
|
target_include_directories(netplay_exit_reason_test PRIVATE include)
|
|
add_test(NAME netplay_exit_reason_test COMMAND netplay_exit_reason_test)
|
|
add_executable(ws_scene_hold_test tests/test_ws_scene_hold.c)
|
|
target_include_directories(ws_scene_hold_test PRIVATE include)
|
|
add_test(NAME ws_scene_hold_test COMMAND ws_scene_hold_test)
|
|
add_executable(mdec_snapshot_activity_test tests/test_mdec_snapshot_activity.c)
|
|
target_include_directories(mdec_snapshot_activity_test PRIVATE include src)
|
|
add_test(NAME mdec_snapshot_activity_test COMMAND mdec_snapshot_activity_test)
|
|
add_executable(mod_texture_banks_test tests/test_mod_texture_banks.c src/mod_texture_banks.c)
|
|
target_include_directories(mod_texture_banks_test PRIVATE include)
|
|
add_test(NAME mod_texture_banks_test COMMAND mod_texture_banks_test)
|
|
# First-call capture / later-call restore behind main.cpp's
|
|
# reset_mod_owned_presentation() (header-only, no runtime link).
|
|
add_executable(mod_session_baseline_test tests/test_mod_session_baseline.c)
|
|
target_include_directories(mod_session_baseline_test PRIVATE include)
|
|
add_test(NAME mod_session_baseline_test COMMAND mod_session_baseline_test)
|
|
# Netplay: libjuice resolves from third_party/ with the network sealed,
|
|
# and a recomp-net pinning another libjuice stops the configure.
|
|
foreach(_psx_juice_case same other)
|
|
add_test(NAME netplay_libjuice_offline_${_psx_juice_case}
|
|
COMMAND ${CMAKE_COMMAND}
|
|
-S "${CMAKE_CURRENT_SOURCE_DIR}/tests/netplay_libjuice_offline"
|
|
-B "${CMAKE_CURRENT_BINARY_DIR}/netplay_libjuice_offline_${_psx_juice_case}"
|
|
-G "${CMAKE_GENERATOR}"
|
|
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
|
|
-DPSX_DEPS_OFFLINE=ON
|
|
"-DFAKE_RECOMP_NET=${CMAKE_CURRENT_SOURCE_DIR}/tests/netplay_libjuice_offline/recomp-net-${_psx_juice_case}")
|
|
set_tests_properties(netplay_libjuice_offline_${_psx_juice_case} PROPERTIES
|
|
ENVIRONMENT "HTTP_PROXY=http://127.0.0.1:9;HTTPS_PROXY=http://127.0.0.1:9;ALL_PROXY=http://127.0.0.1:9;NO_PROXY=")
|
|
endforeach()
|
|
set_tests_properties(netplay_libjuice_offline_other PROPERTIES
|
|
PASS_REGULAR_EXPRESSION "recomp-net pins libjuice SHA256")
|
|
if(NOT MSVC)
|
|
add_executable(ws_world_scene_test tests/test_ws_world_scene.c
|
|
src/psx_video_timing.c)
|
|
target_include_directories(ws_world_scene_test PRIVATE include src)
|
|
target_compile_options(ws_world_scene_test PRIVATE -O2 -flto -ffunction-sections -fdata-sections)
|
|
target_link_options(ws_world_scene_test PRIVATE -flto -Wl,--gc-sections)
|
|
add_test(NAME ws_world_scene_test COMMAND ws_world_scene_test)
|
|
add_executable(boot_state_handoff_test tests/test_boot_state_handoff.c)
|
|
target_include_directories(boot_state_handoff_test PRIVATE include src)
|
|
target_compile_definitions(boot_state_handoff_test PRIVATE PSX_COSIM=1)
|
|
target_compile_options(boot_state_handoff_test PRIVATE -O2 -flto -ffunction-sections -fdata-sections -UNDEBUG)
|
|
target_link_options(boot_state_handoff_test PRIVATE -flto -Wl,--gc-sections)
|
|
target_link_libraries(boot_state_handoff_test PRIVATE ZLIB::ZLIB)
|
|
add_test(NAME boot_state_handoff_test COMMAND boot_state_handoff_test)
|
|
|
|
add_executable(mod_memory_snapshot_test tests/test_mod_memory_snapshot.c
|
|
src/psx_ram_geometry.c)
|
|
target_include_directories(mod_memory_snapshot_test PRIVATE include src)
|
|
target_compile_options(mod_memory_snapshot_test PRIVATE -O2 -flto -ffunction-sections -fdata-sections)
|
|
target_link_options(mod_memory_snapshot_test PRIVATE -flto -Wl,--gc-sections)
|
|
add_test(NAME mod_memory_snapshot_test COMMAND mod_memory_snapshot_test)
|
|
endif()
|
|
add_executable(sio_card_irq_integrity_test tests/test_sio_card_irq_integrity.c)
|
|
target_include_directories(sio_card_irq_integrity_test PRIVATE include)
|
|
foreach(scenario absent deselect pending coarse)
|
|
add_test(NAME sio_card_irq_integrity_${scenario}
|
|
COMMAND sio_card_irq_integrity_test ${scenario})
|
|
# The retired environment variable must not reactivate the workaround.
|
|
set_tests_properties(sio_card_irq_integrity_${scenario} PROPERTIES
|
|
ENVIRONMENT "PSX_APE_CARD_UNSTICK=1")
|
|
endforeach()
|
|
# Optional real-hardware regression. Configure its dependencies explicitly;
|
|
# absence must remain visible, never counted as a passing GPU test.
|
|
set(PSX_GL_READBACK_SDL_ROOT "" CACHE PATH "SDL3 static build root for GL readback test")
|
|
get_filename_component(_gl_test_default_bin "${CMAKE_C_COMPILER}" DIRECTORY)
|
|
set(PSX_GL_READBACK_COMPILER_BIN "${_gl_test_default_bin}" CACHE PATH "GCC/MinGW bin for GL fixture")
|
|
find_package(Python3 QUIET COMPONENTS Interpreter)
|
|
if(Python3_Interpreter_FOUND)
|
|
add_test(NAME counted_mips_relocations_test COMMAND "${Python3_EXECUTABLE}"
|
|
"${PSXRECOMP_ROOT}/tools/tests/test_counted_mips_relocations.py")
|
|
add_test(NAME interp_mod_entry_guards_test COMMAND "${Python3_EXECUTABLE}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests/test_interp_mod_entry_guards.py")
|
|
add_test(NAME mirror_pc_preserved_guards_test COMMAND "${Python3_EXECUTABLE}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests/test_mirror_pc_preserved_guards.py")
|
|
add_test(NAME segment_miss_wiring_test COMMAND "${Python3_EXECUTABLE}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests/test_segment_miss_wiring.py")
|
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
|
add_test(NAME ws_activation_bias_exec_test COMMAND "${Python3_EXECUTABLE}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests/test_ws_activation_bias_exec.py" "${CMAKE_C_COMPILER}")
|
|
endif()
|
|
add_test(NAME gpu_textured_dot_nw_shift_test COMMAND "${Python3_EXECUTABLE}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests/test_gpu_textured_dot_nw_shift.py")
|
|
add_test(NAME gl_readback_runner_test COMMAND "${Python3_EXECUTABLE}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests/test_gl_readback_runner.py")
|
|
endif()
|
|
if(MINGW AND PSX_GL_READBACK_SDL_ROOT
|
|
AND EXISTS "${PSX_GL_READBACK_COMPILER_BIN}/gcc.exe"
|
|
AND EXISTS "${PSX_GL_READBACK_COMPILER_BIN}/g++.exe"
|
|
AND IS_DIRECTORY "${PSX_GL_READBACK_SDL_ROOT}/sdl3-src/include"
|
|
AND EXISTS "${PSX_GL_READBACK_SDL_ROOT}/sdl3-build/libSDL3.a")
|
|
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
|
add_test(NAME gl_readback_region_test
|
|
COMMAND "${Python3_EXECUTABLE}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests/run_gl_readback_region.py"
|
|
--fixture "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_gl_readback_region.c"
|
|
--compiler-bin "${PSX_GL_READBACK_COMPILER_BIN}"
|
|
--sdl-root "${PSX_GL_READBACK_SDL_ROOT}"
|
|
--output "${CMAKE_CURRENT_BINARY_DIR}/gl-readback-results")
|
|
set_tests_properties(gl_readback_region_test PROPERTIES LABELS "gpu;opengl;hardware" TIMEOUT 180)
|
|
else()
|
|
message(STATUS "gl_readback_region_test: not registered (requires MinGW, SDL3 headers/static library in PSX_GL_READBACK_SDL_ROOT and gcc.exe/g++.exe in PSX_GL_READBACK_COMPILER_BIN)")
|
|
endif()
|
|
# Real-GL internal-resolution invariance (macOS/Linux, hidden window): the
|
|
# guest-visible VRAM is identical at every scale, lines stay one native
|
|
# pixel thick, and an over-limit request clamps inside GL. Needs the SDL3
|
|
# this tree fetched and a GPU session; labelled hardware like the readback
|
|
# test above.
|
|
if(NOT WIN32 AND Python3_Interpreter_FOUND AND TARGET SDL3::SDL3)
|
|
if(DEFINED sdl3_SOURCE_DIR)
|
|
set(_gl_scale_sdl_inc "${sdl3_SOURCE_DIR}/include")
|
|
else()
|
|
set(_gl_scale_sdl_inc "$<TARGET_PROPERTY:SDL3::Headers,INTERFACE_INCLUDE_DIRECTORIES>")
|
|
endif()
|
|
add_test(NAME gl_scale_invariance_test
|
|
COMMAND "${Python3_EXECUTABLE}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests/run_gl_scale_invariance.py"
|
|
--fixture "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_gl_scale_invariance.c"
|
|
--cc "${CMAKE_C_COMPILER}"
|
|
--sdl-include "${_gl_scale_sdl_inc}"
|
|
--sdl-library "$<TARGET_FILE:SDL3::SDL3>"
|
|
--output "${CMAKE_CURRENT_BINARY_DIR}/gl-scale-results")
|
|
set_tests_properties(gl_scale_invariance_test PROPERTIES LABELS "gpu;opengl;hardware" TIMEOUT 300)
|
|
unset(_gl_scale_sdl_inc)
|
|
else()
|
|
message(STATUS "gl_scale_invariance_test: not registered (needs a non-Windows host, Python 3 and SDL3)")
|
|
endif()
|
|
if(Python3_Interpreter_FOUND AND TARGET SDL3::SDL3-static)
|
|
add_test(NAME gl_texture_filter_test
|
|
COMMAND "${Python3_EXECUTABLE}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests/run_gl_texture_filter.py"
|
|
--fixture "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_gl_texture_filter.c"
|
|
--cc "${CMAKE_C_COMPILER}"
|
|
--sdl-include "$<TARGET_PROPERTY:SDL3::Headers,INTERFACE_INCLUDE_DIRECTORIES>"
|
|
--sdl-library "$<TARGET_FILE:SDL3::SDL3-static>"
|
|
--output "${CMAKE_CURRENT_BINARY_DIR}/gl-filter-results")
|
|
set_tests_properties(gl_texture_filter_test PROPERTIES LABELS "gpu;opengl;hardware" TIMEOUT 180)
|
|
endif()
|
|
add_executable(launcher_device_roundtrip_test
|
|
tests/test_launcher_device_roundtrip.cpp)
|
|
target_include_directories(launcher_device_roundtrip_test PRIVATE include)
|
|
add_test(NAME launcher_device_roundtrip_test
|
|
COMMAND launcher_device_roundtrip_test)
|
|
|
|
# Pad-mode resolution at the launcher exit seam: a lock_mode title must
|
|
# boot the pad type its game.toml declared whatever the launcher hands
|
|
# back, an active mod controller-mode override must outrank the lock, and
|
|
# neither may let an unsupported mode reach settings.toml. Header-only, so
|
|
# it needs nothing but runtime/include.
|
|
add_executable(launcher_pad_mode_resolve_test
|
|
tests/test_launcher_pad_mode_resolve.cpp)
|
|
target_include_directories(launcher_pad_mode_resolve_test PRIVATE include)
|
|
add_test(NAME launcher_pad_mode_resolve_test
|
|
COMMAND launcher_pad_mode_resolve_test)
|
|
|
|
# COP0.CAUSE IP2 must mirror the INTC line combinationally, never latch.
|
|
add_executable(cause_ip2_combinational_test
|
|
tests/test_cause_ip2_combinational.c)
|
|
add_test(NAME cause_ip2_combinational_test
|
|
COMMAND cause_ip2_combinational_test)
|
|
|
|
add_executable(psx_cyc_batch_test tests/test_psx_cyc_batch.c)
|
|
target_include_directories(psx_cyc_batch_test PRIVATE include)
|
|
target_compile_definitions(psx_cyc_batch_test PRIVATE
|
|
PSX_ENABLE_BLOCK_CYCLES=1)
|
|
add_test(NAME psx_cyc_batch_test COMMAND psx_cyc_batch_test)
|
|
|
|
# Segment misses in static game code (docs/SEGMENT_AWARE_CODE.md §5.5):
|
|
# classification against the dispatch rows, the ring and the per-PC
|
|
# summary the TCP command and the exit report read.
|
|
add_executable(psx_segment_miss_test
|
|
tests/test_psx_segment_miss.c
|
|
src/psx_segment_miss.c
|
|
)
|
|
target_include_directories(psx_segment_miss_test PRIVATE include)
|
|
add_test(NAME psx_segment_miss_test COMMAND psx_segment_miss_test)
|
|
|
|
add_executable(psx_icache_fastpath_test
|
|
tests/test_psx_icache_fastpath.c
|
|
src/psx_icache.c
|
|
)
|
|
target_include_directories(psx_icache_fastpath_test PRIVATE include)
|
|
# PSX_OVERLAY_DLL_BUILD is the seam psx_cycles.h already provides for a TU
|
|
# that supplies its own psx_advance_cycles (overlay DLLs forward it through
|
|
# a callback shim). Without it the header inlines the production definition
|
|
# and this test's counting stub is a redefinition — the whole runtime test
|
|
# suite stopped building at "redefinition of 'psx_advance_cycles'", which
|
|
# also blocked every test registered after it.
|
|
target_compile_definitions(psx_icache_fastpath_test PRIVATE
|
|
PSX_ENABLE_BLOCK_CYCLES=1
|
|
PSX_OVERLAY_DLL_BUILD=1)
|
|
add_test(NAME psx_icache_fastpath_test COMMAND psx_icache_fastpath_test)
|
|
|
|
add_executable(psx_icache_elision_guard_test
|
|
tests/test_psx_icache_elision_guard.c src/psx_icache.c)
|
|
target_include_directories(psx_icache_elision_guard_test PRIVATE include)
|
|
target_compile_definitions(psx_icache_elision_guard_test PRIVATE
|
|
PSX_ENABLE_BLOCK_CYCLES=1 PSX_OVERLAY_DLL_BUILD=1)
|
|
add_test(NAME psx_icache_elision_guard_test COMMAND psx_icache_elision_guard_test)
|
|
|
|
foreach(_ram_geometry IN ITEMS retail expanded)
|
|
add_executable(psx_memory_geometry_${_ram_geometry}_test
|
|
tests/test_psx_memory_geometry.c)
|
|
target_include_directories(psx_memory_geometry_${_ram_geometry}_test
|
|
PRIVATE include)
|
|
if(_ram_geometry STREQUAL "expanded")
|
|
target_compile_definitions(psx_memory_geometry_${_ram_geometry}_test
|
|
PRIVATE PSX_MEMORY_GEOMETRY_TEST_EXPANDED=1)
|
|
endif()
|
|
add_test(NAME psx_memory_geometry_${_ram_geometry}_test
|
|
COMMAND psx_memory_geometry_${_ram_geometry}_test)
|
|
endforeach()
|
|
|
|
# Live 2/8 MiB geometry end to end through the REAL memory.c accessors,
|
|
# dma.c channel execution and boot_state.c save/load (including the
|
|
# refuse-before-mutation contract). Section GC, as for
|
|
# mod_memory_snapshot_test, drops the hardware routing the test never
|
|
# reaches; psx_ram_runtime_map_stubs.c doubles the rest.
|
|
if(NOT MSVC)
|
|
add_executable(psx_ram_runtime_map_test
|
|
tests/test_psx_ram_runtime_map.c
|
|
tests/psx_ram_runtime_map_stubs.c
|
|
src/memory.c
|
|
src/dma.c
|
|
src/boot_state.c
|
|
src/psx_ram_geometry.c)
|
|
target_include_directories(psx_ram_runtime_map_test PRIVATE include src)
|
|
target_compile_options(psx_ram_runtime_map_test PRIVATE
|
|
-O2 -flto -ffunction-sections -fdata-sections -Wno-lto-type-mismatch)
|
|
target_link_options(psx_ram_runtime_map_test PRIVATE
|
|
-flto -Wl,--gc-sections -Wno-lto-type-mismatch)
|
|
target_link_libraries(psx_ram_runtime_map_test PRIVATE ZLIB::ZLIB)
|
|
add_test(NAME psx_ram_runtime_map_test COMMAND psx_ram_runtime_map_test)
|
|
|
|
# Cache-isolated (SR.IsC) CPU stores through the REAL memory.c store
|
|
# paths and the REAL psx_icache.c tag model, against Beetle's
|
|
# WriteMemory IsC branch: FlushCache invalidation, tag-test valid bits,
|
|
# the D-cache scratchpad write, the BIU and DMA exclusions. Same link
|
|
# doubles as psx_ram_runtime_map_test, minus the I-cache ones.
|
|
add_executable(isc_store_test
|
|
tests/test_isc_store.c
|
|
tests/psx_ram_runtime_map_stubs.c
|
|
src/memory.c
|
|
src/dma.c
|
|
src/boot_state.c
|
|
src/psx_icache.c
|
|
src/psx_ram_geometry.c)
|
|
target_include_directories(isc_store_test PRIVATE include src)
|
|
target_compile_definitions(isc_store_test PRIVATE
|
|
PSX_ENABLE_BLOCK_CYCLES=1 PSX_STUBS_REAL_ICACHE=1)
|
|
target_compile_options(isc_store_test PRIVATE
|
|
-O2 -flto -ffunction-sections -fdata-sections -Wno-lto-type-mismatch)
|
|
target_link_options(isc_store_test PRIVATE -flto -Wno-lto-type-mismatch
|
|
$<IF:$<PLATFORM_ID:Darwin>,-Wl$<COMMA>-dead_strip,-Wl$<COMMA>--gc-sections>)
|
|
target_link_libraries(isc_store_test PRIVATE ZLIB::ZLIB)
|
|
add_test(NAME isc_store_test COMMAND isc_store_test)
|
|
endif()
|
|
|
|
# Loadable BIOS backends (psx_bios_module.h): the host loader against
|
|
# three fake modules built here from one source -- good, wrong ABI tag,
|
|
# wrong codegen hash. Real dlopen/LoadLibrary, real registry, stubbed core.
|
|
if(NOT MSVC)
|
|
foreach(_fake IN ITEMS good bad_abi bad_hash)
|
|
add_library(bios_module_fake_${_fake} SHARED tests/bios_module_fake.c)
|
|
target_include_directories(bios_module_fake_${_fake} PRIVATE include)
|
|
target_compile_definitions(bios_module_fake_${_fake} PRIVATE
|
|
PSX_OVERLAY_DLL_BUILD PSX_NO_DEBUG_TOOLS)
|
|
set_target_properties(bios_module_fake_${_fake} PROPERTIES PREFIX "")
|
|
endforeach()
|
|
target_compile_definitions(bios_module_fake_bad_abi PRIVATE FAKE_ABI_TAG=0x7fff)
|
|
target_compile_definitions(bios_module_fake_bad_hash PRIVATE FAKE_CODEGEN_HASH=0x1u)
|
|
add_executable(bios_module_host_test
|
|
tests/test_bios_module_host.c
|
|
src/psx_bios_module.c
|
|
src/psx_bios_backend.c
|
|
src/overlay_posix.c
|
|
src/crc32.c)
|
|
target_include_directories(bios_module_host_test PRIVATE include src)
|
|
target_compile_definitions(bios_module_host_test PRIVATE
|
|
PSX_NO_DEBUG_TOOLS
|
|
FAKE_GOOD="$<TARGET_FILE:bios_module_fake_good>"
|
|
FAKE_BAD_ABI="$<TARGET_FILE:bios_module_fake_bad_abi>"
|
|
FAKE_BAD_HASH="$<TARGET_FILE:bios_module_fake_bad_hash>")
|
|
target_link_libraries(bios_module_host_test PRIVATE ${CMAKE_DL_LIBS})
|
|
add_dependencies(bios_module_host_test
|
|
bios_module_fake_good bios_module_fake_bad_abi bios_module_fake_bad_hash)
|
|
add_test(NAME bios_module_host_test COMMAND bios_module_host_test)
|
|
endif()
|
|
|
|
add_executable(host_keymap_test
|
|
tests/test_host_keymap.c
|
|
src/host_keymap.c)
|
|
target_include_directories(host_keymap_test PRIVATE
|
|
include ${PSX_SDL_INCLUDE_DIRS})
|
|
target_compile_definitions(host_keymap_test PRIVATE
|
|
SDL_MAIN_HANDLED
|
|
$<$<BOOL:${PSX_SDL3}>:PSX_SDL3=1>)
|
|
target_link_libraries(host_keymap_test PRIVATE ${PSX_SDL_LIBRARIES})
|
|
add_test(NAME host_keymap_test COMMAND host_keymap_test)
|
|
|
|
add_executable(keyboard_pad_chord_test
|
|
tests/test_keyboard_pad_chord.c
|
|
src/psx_keybinds.c)
|
|
target_include_directories(keyboard_pad_chord_test PRIVATE
|
|
include ${PSX_SDL_INCLUDE_DIRS})
|
|
target_compile_definitions(keyboard_pad_chord_test PRIVATE
|
|
SDL_MAIN_HANDLED
|
|
$<$<BOOL:${PSX_SDL3}>:PSX_SDL3=1>)
|
|
target_link_libraries(keyboard_pad_chord_test PRIVATE ${PSX_SDL_LIBRARIES})
|
|
add_test(NAME keyboard_pad_chord_test COMMAND keyboard_pad_chord_test)
|
|
|
|
# Generic external replacement-pack core. The renderer integration is a
|
|
# separate consumer; this target pins pack discovery, deterministic keying,
|
|
# VRAM residency, portable tracking state, and bounded asynchronous decode.
|
|
add_executable(hd_texture_pack_test
|
|
tests/test_hd_texture_pack.cpp
|
|
src/hd_texture_pack.cpp)
|
|
target_include_directories(hd_texture_pack_test PRIVATE include)
|
|
find_package(Threads REQUIRED)
|
|
target_link_libraries(hd_texture_pack_test PRIVATE Threads::Threads)
|
|
add_test(NAME hd_texture_pack_test COMMAND hd_texture_pack_test)
|
|
|
|
# Registered since before this change, but it did NOT LINK on origin/master:
|
|
# sio.c had grown psx_read_word / psx_get_cycle_count / i_mask /
|
|
# g_debug_last_store_pc references that this test's stub block never gained,
|
|
# so `ctest` in a runtime tree could not even build. The stubs are added now
|
|
# (a registered test that cannot compile is worse than an unregistered one —
|
|
# it breaks the whole suite's build), which exposes a real disagreement:
|
|
# 27 checks fail, starting with enter.id expected=0x73 (DualShock analog ID)
|
|
# actual=0xFF (no device). Constant-clock and monotonic-clock stubs give
|
|
# byte-identical results, so the cycle stub is not the discriminator — this
|
|
# is the SIO/peripheral axis, not the harness. DISABLED until owned.
|
|
add_executable(sio_dualshock_rumble_test
|
|
tests/test_sio_dualshock_rumble.c
|
|
src/sio.c)
|
|
target_include_directories(sio_dualshock_rumble_test PRIVATE include)
|
|
add_test(NAME sio_dualshock_rumble_test COMMAND sio_dualshock_rumble_test)
|
|
set_tests_properties(sio_dualshock_rumble_test PROPERTIES DISABLED TRUE)
|
|
|
|
add_executable(gte_register_access_test
|
|
tests/test_gte_register_access.cpp
|
|
src/gte.cpp
|
|
src/pgxp.cpp
|
|
src/psx_ram_geometry.c
|
|
)
|
|
target_include_directories(gte_register_access_test PRIVATE include)
|
|
target_compile_definitions(gte_register_access_test PRIVATE
|
|
PSX_NO_DEBUG_TOOLS=1
|
|
PSX_GTE_REGISTER_TEST=1
|
|
PSX_ENABLE_BLOCK_CYCLES=1)
|
|
add_test(NAME gte_register_access_test COMMAND gte_register_access_test)
|
|
|
|
# PGXP value-propagation engine (docs/ENHANCEMENTS.md G1.2/G1.3): shadow
|
|
# load/store/COP2 roundtrips, half-word semantics, validate-on-read
|
|
# (foreign overwrite + DMA-overwrite rejection), MOVE/repack arithmetic,
|
|
# suppression bracket, invalidate-all, and GetPreciseVertex safeguards
|
|
# (truncation agreement + tolerance clamp). White-box: includes src/pgxp.cpp
|
|
# and stubs the gte.cpp fallback-cache extern.
|
|
add_executable(pgxp_test tests/test_pgxp.cpp src/pgxp.cpp
|
|
src/psx_ram_geometry.c)
|
|
target_include_directories(pgxp_test PRIVATE include)
|
|
add_test(NAME pgxp_test COMMAND pgxp_test)
|
|
|
|
# psx.enhancement.pgxp at session start (docs/ENHANCEMENTS.md G1.11): the
|
|
# real builtin activation (mod API stubbed) and the pgxp_session.h
|
|
# resolver main.cpp's renderer setup uses, in main.cpp's order. Pins that
|
|
# the [video] baseline no longer undoes the mod, that a cleared (netplay)
|
|
# plan keeps the baseline, and that the env overrides win.
|
|
# The session arming main.cpp runs (src/pgxp_session.cpp) against the
|
|
# real mod runtime, the real builtin plugin and the builtin's own
|
|
# manifest: default-on, netplay clear, the off switch, options, env
|
|
# overrides and [video] pgxp_mod_only.
|
|
add_executable(pgxp_session_test tests/test_pgxp_session.cpp
|
|
src/pgxp_session.cpp src/mod_builtin_pgxp.c src/pgxp.cpp
|
|
src/psx_ram_geometry.c
|
|
src/mod_runtime.cpp
|
|
src/mod_packages.cpp
|
|
src/disc_path.cpp
|
|
src/cue_sheet.cpp
|
|
src/iso_reader.cpp
|
|
src/crc32.c
|
|
src/psx_sha256.c)
|
|
target_include_directories(pgxp_session_test PRIVATE
|
|
include
|
|
../recompiler/include
|
|
../recompiler/lib/toml11)
|
|
target_compile_definitions(pgxp_session_test PRIVATE
|
|
PSX_BUILTIN_PGXP_MANIFEST="${CMAKE_CURRENT_SOURCE_DIR}/../mods/builtin/packages/psx.enhancement.pgxp/1.0.0/manifest.toml")
|
|
target_link_libraries(pgxp_session_test PRIVATE chdr-static)
|
|
if(WIN32)
|
|
if(MSVC)
|
|
target_link_options(pgxp_session_test PRIVATE /STACK:16777216)
|
|
else()
|
|
target_link_options(pgxp_session_test PRIVATE -Wl,--stack,16777216)
|
|
endif()
|
|
endif()
|
|
add_test(NAME pgxp_session_test COMMAND pgxp_session_test)
|
|
|
|
add_executable(psx_instr_cost_test tests/test_psx_instr_cost.cpp)
|
|
target_include_directories(psx_instr_cost_test PRIVATE include)
|
|
add_test(NAME psx_instr_cost_test COMMAND psx_instr_cost_test)
|
|
|
|
add_executable(ws_aspect_cone_math_test
|
|
tests/test_ws_aspect_cone_math.c
|
|
src/ws_aspect_cone_math.c)
|
|
target_include_directories(ws_aspect_cone_math_test PRIVATE include)
|
|
if(NOT MSVC)
|
|
target_link_libraries(ws_aspect_cone_math_test PRIVATE m)
|
|
endif()
|
|
add_test(NAME ws_aspect_cone_math_test COMMAND ws_aspect_cone_math_test)
|
|
|
|
add_executable(ws_ui_group_test
|
|
tests/test_ws_ui_group.c
|
|
src/ws_ui_group.c)
|
|
target_include_directories(ws_ui_group_test PRIVATE include)
|
|
add_test(NAME ws_ui_group_test COMMAND ws_ui_group_test)
|
|
|
|
add_executable(ws_prepass_guard_test
|
|
tests/test_ws_prepass_guard.c)
|
|
target_include_directories(ws_prepass_guard_test PRIVATE include)
|
|
add_test(NAME ws_prepass_guard_test COMMAND ws_prepass_guard_test)
|
|
|
|
add_executable(ws_hud_anchor_test
|
|
tests/test_ws_hud_anchor.c)
|
|
target_include_directories(ws_hud_anchor_test PRIVATE include)
|
|
add_test(NAME ws_hud_anchor_test COMMAND ws_hud_anchor_test)
|
|
|
|
add_executable(gpu_textured_dot_nw_shift_exec_test
|
|
tests/test_gpu_textured_dot_nw_shift_exec.c
|
|
src/psx_video_timing.c)
|
|
target_include_directories(gpu_textured_dot_nw_shift_exec_test PRIVATE
|
|
include
|
|
src)
|
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
|
target_compile_options(gpu_textured_dot_nw_shift_exec_test PRIVATE
|
|
-ffunction-sections -fdata-sections)
|
|
# Apple ld has no --gc-sections; -dead_strip is its equivalent (as
|
|
# for isc_store_test above), so the test links and runs on macOS.
|
|
target_link_options(gpu_textured_dot_nw_shift_exec_test PRIVATE
|
|
$<IF:$<PLATFORM_ID:Darwin>,-Wl$<COMMA>-dead_strip,-Wl$<COMMA>--gc-sections>)
|
|
endif()
|
|
add_test(NAME gpu_textured_dot_nw_shift_exec_test
|
|
COMMAND gpu_textured_dot_nw_shift_exec_test)
|
|
|
|
# auto_ui_squash corrects untextured HUD fills with their textured frames.
|
|
add_executable(ws_auto_ui_untextured_exec_test
|
|
tests/test_ws_auto_ui_untextured_exec.c
|
|
src/ws_ui_group.c
|
|
src/psx_video_timing.c)
|
|
target_include_directories(ws_auto_ui_untextured_exec_test PRIVATE
|
|
include
|
|
src)
|
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
|
target_compile_options(ws_auto_ui_untextured_exec_test PRIVATE
|
|
-ffunction-sections -fdata-sections)
|
|
target_link_options(ws_auto_ui_untextured_exec_test PRIVATE
|
|
-Wl,--gc-sections)
|
|
endif()
|
|
add_test(NAME ws_auto_ui_untextured_exec_test
|
|
COMMAND ws_auto_ui_untextured_exec_test)
|
|
|
|
add_executable(ws_shared_split_ui_exec_test
|
|
tests/test_ws_shared_split_ui_exec.c
|
|
src/ws_ui_group.c
|
|
src/psx_video_timing.c)
|
|
target_include_directories(ws_shared_split_ui_exec_test PRIVATE include src)
|
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
|
target_compile_options(ws_shared_split_ui_exec_test PRIVATE
|
|
-ffunction-sections -fdata-sections)
|
|
target_link_options(ws_shared_split_ui_exec_test PRIVATE -Wl,--gc-sections)
|
|
endif()
|
|
add_test(NAME ws_shared_split_ui_exec_test COMMAND ws_shared_split_ui_exec_test)
|
|
|
|
add_executable(ws_view_anchor_test tests/test_ws_view_anchor.c)
|
|
add_executable(ws_view_anchor_gpu_test tests/test_ws_view_anchor_gpu.c
|
|
src/psx_video_timing.c)
|
|
add_executable(native_wide_projection_test tests/test_native_wide_projection.c
|
|
src/psx_video_timing.c)
|
|
foreach(_anchor_test ws_view_anchor ws_view_anchor_gpu native_wide_projection)
|
|
target_include_directories(${_anchor_test}_test PRIVATE include src)
|
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
|
target_compile_options(${_anchor_test}_test PRIVATE -ffunction-sections -fdata-sections)
|
|
if(NOT APPLE)
|
|
target_link_options(${_anchor_test}_test PRIVATE -Wl,--gc-sections)
|
|
endif()
|
|
endif()
|
|
if(NOT WIN32)
|
|
target_link_libraries(${_anchor_test}_test PRIVATE m)
|
|
endif()
|
|
endforeach()
|
|
add_test(NAME ws_view_anchor_test COMMAND ws_view_anchor_test)
|
|
add_test(NAME ws_view_anchor_gpu_test COMMAND ws_view_anchor_gpu_test)
|
|
add_test(NAME native_wide_projection_test COMMAND native_wide_projection_test)
|
|
|
|
add_executable(ws_repeat_rect_test tests/test_ws_repeat_rect.c)
|
|
target_include_directories(ws_repeat_rect_test PRIVATE include)
|
|
add_test(NAME ws_repeat_rect_test COMMAND ws_repeat_rect_test)
|
|
add_executable(ws_screen_mask_test tests/test_ws_screen_mask.c)
|
|
target_include_directories(ws_screen_mask_test PRIVATE include)
|
|
if(UNIX)
|
|
target_link_libraries(ws_screen_mask_test PRIVATE m)
|
|
endif()
|
|
add_test(NAME ws_screen_mask_test COMMAND ws_screen_mask_test)
|
|
|
|
add_executable(mod_gpu_dma_aperture_test
|
|
tests/test_mod_gpu_dma_aperture.c
|
|
src/psx_ram_geometry.c)
|
|
target_include_directories(mod_gpu_dma_aperture_test PRIVATE include)
|
|
add_test(NAME mod_gpu_dma_aperture_test
|
|
COMMAND mod_gpu_dma_aperture_test)
|
|
|
|
# The real-handler fixture relies on LTO pruning its unused syscall paths.
|
|
# Enable only the toolchain on which that link contract is verified; keep
|
|
# the coverage gap visible in CTest for every other compiler/platform.
|
|
if(WIN32 AND MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 8
|
|
AND CMAKE_C_COMPILER_ID STREQUAL "GNU"
|
|
AND CMAKE_C_COMPILER_VERSION VERSION_EQUAL "16.1.0")
|
|
add_executable(exit_critical_section_test
|
|
tests/test_exit_critical_section.c src/traps.c)
|
|
target_include_directories(exit_critical_section_test PRIVATE include)
|
|
target_compile_definitions(exit_critical_section_test PRIVATE PSX_NO_DEBUG_TOOLS=1)
|
|
target_compile_options(exit_critical_section_test PRIVATE -O3 -flto -ffunction-sections)
|
|
target_link_options(exit_critical_section_test PRIVATE -flto -Wl,--gc-sections)
|
|
add_test(NAME exit_critical_section_test COMMAND exit_critical_section_test)
|
|
else()
|
|
add_test(NAME exit_critical_section_test
|
|
COMMAND "${CMAKE_COMMAND}" -E echo
|
|
"SKIP: real-handler LTO fixture is verified only on Windows x64 MinGW GCC 16.1.0; current compiler is ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
|
|
set_tests_properties(exit_critical_section_test PROPERTIES
|
|
SKIP_REGULAR_EXPRESSION "^SKIP:")
|
|
endif()
|
|
|
|
add_executable(dma_gpu_linked_list_timing_test
|
|
tests/test_dma_gpu_linked_list_timing.c
|
|
src/dma_gpu_ll.c)
|
|
target_include_directories(dma_gpu_linked_list_timing_test PRIVATE include)
|
|
add_test(NAME dma_gpu_linked_list_timing_test
|
|
COMMAND dma_gpu_linked_list_timing_test)
|
|
|
|
# Clean-room SPU DSP fidelity (issue #103): SPU IRQ on every RAM access
|
|
# class, reverb (write gating + work-area wrap + CD-only path), noise
|
|
# generator, volume sweeps / direct decode, capture buffers, and
|
|
# savestate coverage of all the new state. Includes src/spu.c directly
|
|
# (white-box) and stubs its externs.
|
|
# src/crc32.c is linked rather than stubbed: spu.c's capture/shadow paths
|
|
# feed real CRCs that this test checks, so a zero-returning stub would make
|
|
# those assertions vacuous. (This target did not link at all before —
|
|
# crc32_update was undefined on origin/master too.)
|
|
add_executable(spu_fidelity_test tests/test_spu_fidelity.c src/crc32.c)
|
|
target_include_directories(spu_fidelity_test PRIVATE include)
|
|
add_test(NAME spu_fidelity_test COMMAND spu_fidelity_test)
|
|
# Same story as sio_dualshock_rumble_test: registered but unlinkable on
|
|
# origin/master (crc32_update undefined), so it never ran. With crc32 linked
|
|
# it now runs 137 checks and fails 4, all in one ADSR sweep region
|
|
# (mid > 0, late > mid, fall_mid < 0x7FFE, fall_late < fall_mid). Rebuilding
|
|
# it against a zero-returning crc32 stub reproduces exactly those 4, so the
|
|
# crc32 linkage is not the cause — the envelope sweep genuinely disagrees.
|
|
set_tests_properties(spu_fidelity_test PROPERTIES DISABLED TRUE)
|
|
|
|
add_executable(overlay_capture_retry_test
|
|
tests/test_overlay_capture_retry.cpp
|
|
src/overlay_capture.c
|
|
src/psx_ram_geometry.c)
|
|
target_include_directories(overlay_capture_retry_test PRIVATE
|
|
include ${PSX_SDL_INCLUDE_DIRS})
|
|
target_compile_definitions(overlay_capture_retry_test PRIVATE
|
|
SDL_MAIN_HANDLED PSX_OVERLAY_CAPTURE_TEST=1
|
|
$<$<BOOL:${PSX_SDL3}>:PSX_SDL3=1>)
|
|
target_link_libraries(overlay_capture_retry_test PRIVATE ${PSX_SDL_LIBRARIES})
|
|
add_test(NAME overlay_capture_retry_test COMMAND overlay_capture_retry_test)
|
|
|
|
add_executable(overlay_path_canon_test
|
|
tests/test_overlay_path_canon.c
|
|
src/overlay_path_canon.c)
|
|
target_include_directories(overlay_path_canon_test PRIVATE include)
|
|
add_test(NAME overlay_path_canon_test COMMAND overlay_path_canon_test)
|
|
|
|
# The kernel-bless verifier must accept a body whose DECLARED patch range
|
|
# the guest has overwritten (Psy-Q's install stubs land inside compiled
|
|
# kernel bodies) and still reject one changed anywhere else. Before this,
|
|
# the whole-body memcmp failed forever on the first install and the BIOS
|
|
# exception handler interpreted for the life of the process.
|
|
add_executable(kernel_patch_ranges_test
|
|
tests/test_kernel_patch_ranges.c
|
|
src/kernel_patch_ranges.c)
|
|
target_include_directories(kernel_patch_ranges_test PRIVATE include)
|
|
add_test(NAME kernel_patch_ranges_test COMMAND kernel_patch_ranges_test)
|
|
|
|
# The player-facing "skip the BIOS" flag must resolve to the same boot
|
|
# behaviour on retail SCPH-1001 and on the bundled OpenBIOS, whose
|
|
# kernel-call HLE is (correctly) refused for want of a DeliverEvent anchor.
|
|
add_executable(bios_hle_plan_test
|
|
tests/test_bios_hle_plan.c
|
|
src/bios_hle_plan.c)
|
|
target_include_directories(bios_hle_plan_test PRIVATE include)
|
|
add_test(NAME bios_hle_plan_test COMMAND bios_hle_plan_test)
|
|
|
|
# A cue, conventional raw image, or Steam .car image is a valid pick; each
|
|
# must mount the same disc and identify off the same data track.
|
|
add_executable(sbi_setup_test tests/test_sbi_setup.cpp src/psx_sha256.c)
|
|
target_include_directories(sbi_setup_test PRIVATE include)
|
|
add_test(NAME sbi_setup_test COMMAND sbi_setup_test ${CMAKE_CURRENT_BINARY_DIR}/sbi-setup-fixture)
|
|
|
|
add_executable(disc_path_resolve_test
|
|
tests/test_disc_path_resolve.cpp
|
|
src/disc_path.cpp
|
|
src/cue_sheet.cpp
|
|
src/iso_reader.cpp)
|
|
target_include_directories(disc_path_resolve_test PRIVATE include ${PSXRECOMP_ROOT}/recompiler/include)
|
|
target_link_libraries(disc_path_resolve_test PRIVATE chdr-static)
|
|
add_test(NAME disc_path_resolve_test COMMAND disc_path_resolve_test)
|
|
|
|
# Both BIOS filename conventions (bare vs region-qualified) resolve, in
|
|
# both directions, so a config and a dump folder may disagree.
|
|
add_executable(bios_rom_alias_test tests/test_bios_rom_alias.cpp)
|
|
target_include_directories(bios_rom_alias_test PRIVATE
|
|
${PSXRECOMP_ROOT}/recompiler/include)
|
|
add_test(NAME bios_rom_alias_test COMMAND bios_rom_alias_test)
|
|
|
|
# The game window opens at a normal size, not maximised.
|
|
add_executable(window_size_test tests/test_window_size.cpp)
|
|
target_include_directories(window_size_test PRIVATE include)
|
|
add_test(NAME window_size_test COMMAND window_size_test)
|
|
option(PSX_WINDOW_FULLSCREEN_TEST "Run fullscreen transitions on a real desktop" OFF)
|
|
if(PSX_WINDOW_FULLSCREEN_TEST)
|
|
add_executable(window_fullscreen_test tests/test_window_fullscreen.cpp)
|
|
target_include_directories(window_fullscreen_test PRIVATE include)
|
|
target_compile_definitions(window_fullscreen_test PRIVATE
|
|
SDL_MAIN_HANDLED=1 $<$<BOOL:${PSX_SDL3}>:PSX_SDL3=1>)
|
|
target_link_libraries(window_fullscreen_test PRIVATE ${PSX_SDL_LIBRARIES})
|
|
add_test(NAME window_fullscreen_test COMMAND window_fullscreen_test)
|
|
set_tests_properties(window_fullscreen_test PROPERTIES LABELS "window;hardware" TIMEOUT 30)
|
|
endif()
|
|
|
|
# Multi-file cue TOC mapping (data track + CD-DA in separate bins).
|
|
add_executable(iso_reader_cdda_test
|
|
tests/test_iso_reader_cdda.cpp
|
|
src/iso_reader.cpp
|
|
src/cue_sheet.cpp)
|
|
target_include_directories(iso_reader_cdda_test PRIVATE include ${PSXRECOMP_ROOT}/recompiler/include)
|
|
target_link_libraries(iso_reader_cdda_test PRIVATE chdr-static)
|
|
add_test(NAME iso_reader_cdda_test COMMAND iso_reader_cdda_test)
|
|
|
|
# Cue PREGAP/POSTGAP (gaps the dump does not store) shift the disc layout.
|
|
add_executable(iso_reader_pregap_test
|
|
tests/test_iso_reader_pregap.cpp
|
|
src/iso_reader.cpp
|
|
src/cue_sheet.cpp)
|
|
target_include_directories(iso_reader_pregap_test PRIVATE include ${PSXRECOMP_ROOT}/recompiler/include)
|
|
target_link_libraries(iso_reader_pregap_test PRIVATE chdr-static)
|
|
add_test(NAME iso_reader_pregap_test COMMAND iso_reader_pregap_test)
|
|
|
|
add_executable(iso_reader_sbi_test
|
|
tests/test_iso_reader_sbi.cpp
|
|
src/iso_reader.cpp
|
|
src/cue_sheet.cpp)
|
|
target_include_directories(iso_reader_sbi_test PRIVATE include ${PSXRECOMP_ROOT}/recompiler/include)
|
|
target_link_libraries(iso_reader_sbi_test PRIVATE chdr-static)
|
|
add_test(NAME iso_reader_sbi_test COMMAND iso_reader_sbi_test)
|
|
|
|
add_executable(mod_packages_test
|
|
tests/test_mod_packages.cpp
|
|
src/mod_packages.cpp
|
|
src/crc32.c
|
|
src/psx_sha256.c)
|
|
target_include_directories(mod_packages_test PRIVATE
|
|
include
|
|
../recompiler/lib/toml11)
|
|
add_test(NAME mod_packages_test COMMAND mod_packages_test)
|
|
|
|
add_executable(builtin_mod_manifests_test
|
|
tests/test_builtin_mod_manifests.cpp
|
|
src/mod_packages.cpp
|
|
src/crc32.c
|
|
src/psx_sha256.c)
|
|
target_include_directories(builtin_mod_manifests_test PRIVATE
|
|
include
|
|
../recompiler/lib/toml11)
|
|
add_test(NAME builtin_mod_manifests_test
|
|
COMMAND builtin_mod_manifests_test
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../mods/builtin/packages")
|
|
|
|
add_executable(text_xlate_fix_only_test
|
|
tests/test_text_xlate_fix_only.cpp
|
|
src/text_xlate.cpp
|
|
src/psx_ram_geometry.c)
|
|
target_include_directories(text_xlate_fix_only_test PRIVATE
|
|
include
|
|
../recompiler/lib/toml11)
|
|
add_test(NAME text_xlate_fix_only_test COMMAND text_xlate_fix_only_test)
|
|
|
|
add_executable(mod_runtime_test
|
|
tests/test_mod_runtime.cpp
|
|
src/iso_reader_c.cpp
|
|
src/mod_runtime.cpp
|
|
src/mod_packages.cpp
|
|
src/disc_path.cpp
|
|
src/cue_sheet.cpp
|
|
src/iso_reader.cpp
|
|
src/crc32.c
|
|
src/psx_sha256.c)
|
|
target_include_directories(mod_runtime_test PRIVATE
|
|
include
|
|
../recompiler/include
|
|
../recompiler/lib/toml11)
|
|
target_link_libraries(mod_runtime_test PRIVATE chdr-static)
|
|
# The real disc hasher uses a 1 MiB scratch buffer. Match the runtime's
|
|
# stack allowance instead of overflowing MinGW's 1 MiB executable default.
|
|
if(WIN32)
|
|
if(MSVC)
|
|
target_link_options(mod_runtime_test PRIVATE /STACK:16777216)
|
|
else()
|
|
target_link_options(mod_runtime_test PRIVATE -Wl,--stack,16777216)
|
|
endif()
|
|
endif()
|
|
add_test(NAME mod_runtime_test COMMAND mod_runtime_test)
|
|
|
|
if(WIN32)
|
|
add_executable(autocompile_publication_test
|
|
tests/test_autocompile_publication.c
|
|
src/autocompile.c)
|
|
target_include_directories(autocompile_publication_test PRIVATE include)
|
|
target_compile_definitions(autocompile_publication_test PRIVATE
|
|
PSX_AUTOCOMPILE_TEST=1)
|
|
add_test(NAME autocompile_publication_test
|
|
COMMAND autocompile_publication_test)
|
|
|
|
# A misconfigured overlay_autocompile_cmd must be reported on a channel
|
|
# that exists: the stdout warnings reach nobody under -mwindows, so a
|
|
# broken autocompile silently degrades the whole run to the interpreter.
|
|
add_executable(autocompile_degraded_test
|
|
tests/test_autocompile_degraded.c
|
|
src/autocompile.c)
|
|
target_include_directories(autocompile_degraded_test PRIVATE include)
|
|
add_test(NAME autocompile_degraded_test
|
|
COMMAND autocompile_degraded_test)
|
|
endif()
|
|
|
|
# ---- previously-unregistered standalone tests -------------------------
|
|
# These 16 existed in runtime/tests/ with no add_test() entry. Their only
|
|
# build instructions were a gcc command line in each file's header comment,
|
|
# which nothing executes — so when the runtime API moved under them they
|
|
# broke silently and stayed broken. Four had already rotted when they were
|
|
# collected here (2026-08-11):
|
|
#
|
|
# test_netplay_snap_ring.c duplicate TU in the documented command;
|
|
# no stubs for the VRAM-incremental
|
|
# boot_state queries (PR #134)
|
|
# test_psx_cycle_event_boundaries.c
|
|
# psx_cycles_resync_after_restore() grew a
|
|
# CPUState* parameter; psx_cycles.c grew
|
|
# three externs the stub block never did
|
|
# test_spu_end_without_repeat.c spu.c grew psx_irq_raise / crc32_update
|
|
# test_sio_card_protocol.c repaired below: the harness now walks
|
|
# shift/ACK edges and clears INTC IRQ7
|
|
#
|
|
# Registering them is only half the fix; check_test_registration.cmake at
|
|
# the end of this file is what stops the next one from going unnoticed.
|
|
# Each test's build recipe now lives HERE and nowhere else — the header
|
|
# comments were reduced to a `ctest -R <name>` pointer so there is exactly
|
|
# one description of how a test is built, and it is one the build executes.
|
|
|
|
add_executable(cdrom_irq_mask_test tests/test_cdrom_irq_mask.c)
|
|
target_include_directories(cdrom_irq_mask_test PRIVATE src)
|
|
add_test(NAME cdrom_irq_mask_test COMMAND cdrom_irq_mask_test)
|
|
|
|
add_executable(cdrom_lid_state_test tests/test_cdrom_lid_state.c)
|
|
target_include_directories(cdrom_lid_state_test PRIVATE src)
|
|
add_test(NAME cdrom_lid_state_test COMMAND cdrom_lid_state_test)
|
|
|
|
# Cross-device I_STAT ownership: a memory-card ACK IRQ (SIO0) must not
|
|
# clear another device's pending source — pinned on SPU (I_STAT bit 9)
|
|
# staying set across card ACK delivery until the guest acknowledges it.
|
|
# Scratch working dir for the same reason as sio_card_protocol_test: the
|
|
# test self-provisions test_dir/card1.mcd relative to its cwd.
|
|
add_executable(sio_spu_istat_ownership_test
|
|
tests/test_sio_spu_istat_ownership.c
|
|
src/sio.c
|
|
src/memcard.c)
|
|
target_include_directories(sio_spu_istat_ownership_test PRIVATE include src)
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sio_spu_istat_scratch)
|
|
add_test(NAME sio_spu_istat_ownership_test COMMAND sio_spu_istat_ownership_test
|
|
WORKING_DIRECTORY
|
|
${CMAKE_CURRENT_BINARY_DIR}/sio_spu_istat_scratch)
|
|
|
|
# Mirrors func_00005A08 (BIOS card READ chain handler) against a mock CPU,
|
|
# so it pins the disassembly reading without linking the recompiled BIOS.
|
|
add_executable(chain_handler_check_test tests/test_chain_handler_check.c)
|
|
target_include_directories(chain_handler_check_test PRIVATE include src)
|
|
add_test(NAME chain_handler_check_test COMMAND chain_handler_check_test)
|
|
|
|
# Bug B: the pacing decision must take ONE counter sample, so the unsigned
|
|
# subtraction cannot underflow into a ~24.7-day SDL_Delay.
|
|
add_executable(frame_pacing_test tests/test_frame_pacing.c)
|
|
target_include_directories(frame_pacing_test PRIVATE include)
|
|
add_test(NAME frame_pacing_test COMMAND frame_pacing_test)
|
|
|
|
# Same family of bug as frame_pacing: the starvation watchdog's staleness
|
|
# gap must not wrap when the (cross-thread) heartbeat is newer than the
|
|
# clock sample taken by the emu thread.
|
|
add_executable(starvation_watchdog_test tests/test_starvation_watchdog.c)
|
|
target_include_directories(starvation_watchdog_test PRIVATE include)
|
|
add_test(NAME starvation_watchdog_test COMMAND starvation_watchdog_test)
|
|
|
|
add_executable(freeze_dump_policy_test
|
|
tests/test_freeze_dump_policy.c
|
|
src/freeze_dump_policy.c)
|
|
target_include_directories(freeze_dump_policy_test PRIVATE src)
|
|
add_test(NAME freeze_dump_policy_test COMMAND freeze_dump_policy_test)
|
|
|
|
add_executable(frame_interpolation_schedule_test
|
|
tests/test_frame_interpolation_schedule.c
|
|
src/frame_interpolation.c)
|
|
target_include_directories(frame_interpolation_schedule_test PRIVATE include)
|
|
if(NOT MSVC)
|
|
target_link_libraries(frame_interpolation_schedule_test PRIVATE m)
|
|
endif()
|
|
add_test(NAME frame_interpolation_schedule_test
|
|
COMMAND frame_interpolation_schedule_test)
|
|
|
|
add_executable(render_pass_plan_test
|
|
tests/test_render_pass_plan.c
|
|
src/render_pass_plan.c)
|
|
target_include_directories(render_pass_plan_test PRIVATE include)
|
|
if(NOT MSVC)
|
|
target_link_libraries(render_pass_plan_test PRIVATE m)
|
|
endif()
|
|
add_test(NAME render_pass_plan_test COMMAND render_pass_plan_test)
|
|
|
|
# Motion kit and per-frame driver for render-pass plugins: blending,
|
|
# identity matching, limits and the crossfade fallback, on mock RAM.
|
|
add_executable(render_pass_motion_test
|
|
tests/test_render_pass_motion.c
|
|
src/render_pass_motion.c
|
|
src/render_pass_frame.c)
|
|
target_include_directories(render_pass_motion_test PRIVATE include)
|
|
if(NOT MSVC)
|
|
target_link_libraries(render_pass_motion_test PRIVATE m)
|
|
endif()
|
|
add_test(NAME render_pass_motion_test COMMAND render_pass_motion_test)
|
|
add_executable(render_pass_projection_test
|
|
tests/test_render_pass_projection.cpp
|
|
src/render_pass_projection.cpp
|
|
src/render_pass_motion.c)
|
|
target_include_directories(render_pass_projection_test PRIVATE include)
|
|
if(NOT MSVC)
|
|
target_link_libraries(render_pass_projection_test PRIVATE m)
|
|
endif()
|
|
add_test(NAME render_pass_projection_test COMMAND render_pass_projection_test)
|
|
|
|
# Render-pass time freeze against mock devices (psx_cycles.c only).
|
|
add_executable(render_pass_freeze_test
|
|
tests/test_render_pass_freeze.c
|
|
src/psx_cycles.c)
|
|
target_include_directories(render_pass_freeze_test PRIVATE include)
|
|
add_test(NAME render_pass_freeze_test COMMAND render_pass_freeze_test)
|
|
|
|
# Render-pass watchdog abort from nested guest frames: the real
|
|
# render_pass.c and psx_cycles.c against mock memory, devices and
|
|
# presenter (the frames use GCC/Clang cleanup handlers, as generated
|
|
# code does).
|
|
if(NOT MSVC)
|
|
add_executable(render_pass_abort_test
|
|
tests/test_render_pass_abort.c
|
|
src/render_pass.c
|
|
src/psx_cycles.c)
|
|
target_include_directories(render_pass_abort_test PRIVATE include)
|
|
add_test(NAME render_pass_abort_test COMMAND render_pass_abort_test)
|
|
endif()
|
|
|
|
# Render-pass sandbox: the store policy memory.c uses, a real pass
|
|
# (render_pass.c, psx_cycles.c, timers.c) that makes device stores and
|
|
# runs frozen cycles, and the out-of-rect VRAM journal.
|
|
add_executable(render_pass_sandbox_test
|
|
tests/test_render_pass_sandbox.c
|
|
src/render_pass.c
|
|
src/render_pass_plan.c
|
|
src/psx_cycles.c
|
|
src/timers.c
|
|
src/psx_video_timing.c)
|
|
target_include_directories(render_pass_sandbox_test PRIVATE include)
|
|
if(NOT MSVC)
|
|
target_link_libraries(render_pass_sandbox_test PRIVATE m)
|
|
endif()
|
|
add_test(NAME render_pass_sandbox_test COMMAND render_pass_sandbox_test)
|
|
|
|
add_executable(gpu_primitive_reject_test tests/test_gpu_primitive_reject.c)
|
|
target_include_directories(gpu_primitive_reject_test PRIVATE include)
|
|
add_test(NAME gpu_primitive_reject_test COMMAND gpu_primitive_reject_test)
|
|
|
|
add_executable(gpu_sw_edges_test tests/test_gpu_sw_edges.c)
|
|
target_include_directories(gpu_sw_edges_test PRIVATE src)
|
|
add_test(NAME gpu_sw_edges_test COMMAND gpu_sw_edges_test)
|
|
|
|
add_executable(gpu_vk_upload_alignment_test
|
|
tests/test_gpu_vk_upload_alignment.c)
|
|
target_include_directories(gpu_vk_upload_alignment_test PRIVATE src)
|
|
add_test(NAME gpu_vk_upload_alignment_test
|
|
COMMAND gpu_vk_upload_alignment_test)
|
|
|
|
# Portable rollback helpers — required for MotK netplay unit tests that use
|
|
# the netplay_* compatibility shims. The peer-facing ones (hash_confirm,
|
|
# input_hist, rb_post) live in recomp-net; the snap ring in retcomm-rbengine.
|
|
set(_RBE_ROOT "${PSXRECOMP_ROOT}/lib/retcomm-rbengine")
|
|
set(_RNET_ROOT "${PSXRECOMP_ROOT}/lib/recomp-net")
|
|
if(EXISTS "${_RBE_ROOT}/CMakeLists.txt" AND EXISTS "${_RNET_ROOT}/CMakeLists.txt")
|
|
if(NOT TARGET recomp_net)
|
|
set(RNET_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
set(RNET_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
set(RNET_ENABLE_ICE OFF CACHE BOOL "" FORCE)
|
|
add_subdirectory("${_RNET_ROOT}" "${CMAKE_BINARY_DIR}/recomp-net-tests")
|
|
endif()
|
|
if(NOT TARGET retcomm_rbengine)
|
|
set(RBE_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
set(RECOMP_NET_ROOT "${_RNET_ROOT}" CACHE PATH "" FORCE)
|
|
add_subdirectory("${_RBE_ROOT}" "${CMAKE_BINARY_DIR}/retcomm-rbengine-tests")
|
|
endif()
|
|
set(PSXRECOMP_TEST_HAS_RBENGINE TRUE)
|
|
else()
|
|
set(PSXRECOMP_TEST_HAS_RBENGINE FALSE)
|
|
message(STATUS
|
|
"netplay_*_tests: lib/retcomm-rbengine or lib/recomp-net absent - skipped")
|
|
endif()
|
|
|
|
if(PSXRECOMP_TEST_HAS_RBENGINE)
|
|
add_executable(netplay_hash_confirm_test
|
|
tests/test_netplay_hash_confirm.c)
|
|
target_include_directories(netplay_hash_confirm_test PRIVATE include)
|
|
target_link_libraries(netplay_hash_confirm_test PRIVATE recomp_net)
|
|
add_test(NAME netplay_hash_confirm_test COMMAND netplay_hash_confirm_test)
|
|
|
|
# save/load glue #included from the test; ring ops come from rbengine.
|
|
add_executable(netplay_snap_ring_test tests/test_netplay_snap_ring.c)
|
|
target_include_directories(netplay_snap_ring_test PRIVATE include)
|
|
target_compile_definitions(netplay_snap_ring_test PRIVATE
|
|
NETPLAY_SNAP_RING_TEST_STUB_BOOT_STATE
|
|
PSX_HAS_RECOMP_NET=1)
|
|
target_link_libraries(netplay_snap_ring_test PRIVATE retcomm_rbengine)
|
|
add_test(NAME netplay_snap_ring_test COMMAND netplay_snap_ring_test)
|
|
|
|
# Lobby chat ring. #includes psx_lobby_client.c, so it needs the same
|
|
# guard define and include roots the runtime build uses; the two WS
|
|
# calls that TU makes are stubbed in the test and abort if reached.
|
|
if(EXISTS "${PSXRECOMP_ROOT}/runtime/src/lobby_ws/rnet_ws.c")
|
|
add_executable(lobby_chat_ring_test tests/test_lobby_chat_ring.c)
|
|
target_include_directories(lobby_chat_ring_test PRIVATE
|
|
include
|
|
src
|
|
"${PSXRECOMP_ROOT}/runtime/src/lobby_ws"
|
|
${_RNET_ROOT}/include)
|
|
target_compile_definitions(lobby_chat_ring_test PRIVATE
|
|
PSX_HAS_LOBBY_CLIENT=1
|
|
PSX_HAS_RECOMP_NET=1)
|
|
# Links the REAL recomp_net and the real WS helpers rather than a
|
|
# wall of stubs. Nothing in this test reaches a socket, so no fake
|
|
# is needed and none can drift from what the runtime links.
|
|
target_sources(lobby_chat_ring_test PRIVATE
|
|
"${PSXRECOMP_ROOT}/runtime/src/lobby_ws/rnet_ws.c"
|
|
"${PSXRECOMP_ROOT}/runtime/src/lobby_ws/rnet_sha1.c"
|
|
"${PSXRECOMP_ROOT}/runtime/src/netplay_bios_settle.c")
|
|
target_link_libraries(lobby_chat_ring_test PRIVATE recomp_net)
|
|
add_test(NAME lobby_chat_ring_test COMMAND lobby_chat_ring_test)
|
|
add_executable(netplay_bios_wire_test
|
|
tests/test_netplay_bios_wire.c
|
|
src/netplay_bios_settle.c
|
|
src/lobby_ws/rnet_ws.c
|
|
src/lobby_ws/rnet_sha1.c)
|
|
target_include_directories(netplay_bios_wire_test PRIVATE
|
|
include src src/lobby_ws ${_RNET_ROOT}/include)
|
|
target_compile_definitions(netplay_bios_wire_test PRIVATE
|
|
PSX_HAS_LOBBY_CLIENT=1 PSX_HAS_RECOMP_NET=1)
|
|
target_link_libraries(netplay_bios_wire_test PRIVATE recomp_net)
|
|
add_test(NAME netplay_bios_wire_test COMMAND netplay_bios_wire_test)
|
|
endif()
|
|
|
|
add_executable(rb_post_tip_filter_test tests/test_rb_post_tip_filter.c)
|
|
target_include_directories(rb_post_tip_filter_test PRIVATE include)
|
|
target_link_libraries(rb_post_tip_filter_test PRIVATE recomp_net)
|
|
add_test(NAME rb_post_tip_filter_test COMMAND rb_post_tip_filter_test)
|
|
|
|
add_executable(netplay_input_hist_test
|
|
tests/test_netplay_input_hist.c
|
|
src/netplay_input_hist.c)
|
|
target_include_directories(netplay_input_hist_test PRIVATE
|
|
include
|
|
${_RNET_ROOT}/include)
|
|
target_compile_definitions(netplay_input_hist_test PRIVATE
|
|
PSX_HAS_RECOMP_NET=1)
|
|
target_link_libraries(netplay_input_hist_test PRIVATE recomp_net)
|
|
add_test(NAME netplay_input_hist_test COMMAND netplay_input_hist_test)
|
|
endif()
|
|
|
|
add_executable(overlay_store_cycle_barrier_test
|
|
tests/test_overlay_store_cycle_barrier.c)
|
|
target_include_directories(overlay_store_cycle_barrier_test PRIVATE include)
|
|
add_test(NAME overlay_store_cycle_barrier_test
|
|
COMMAND overlay_store_cycle_barrier_test)
|
|
|
|
# Overlay stores update the host's store-PC breadcrumb (ABI v24). Built
|
|
# with the defines compile_overlays.py gives every shard.
|
|
add_executable(overlay_store_pc_forwarding_test
|
|
tests/test_overlay_store_pc_forwarding.c)
|
|
target_include_directories(overlay_store_pc_forwarding_test PRIVATE include)
|
|
target_compile_definitions(overlay_store_pc_forwarding_test PRIVATE
|
|
PSX_OVERLAY_DLL_BUILD PSX_NO_DEBUG_TOOLS PSX_ENABLE_BLOCK_CYCLES=1)
|
|
add_test(NAME overlay_store_pc_forwarding_test
|
|
COMMAND overlay_store_pc_forwarding_test)
|
|
|
|
# frame_fingerprint judge columns are blind to device-write service order.
|
|
add_executable(frame_fingerprint_test tests/test_frame_fingerprint.c)
|
|
target_include_directories(frame_fingerprint_test PRIVATE include)
|
|
add_test(NAME frame_fingerprint_test COMMAND frame_fingerprint_test)
|
|
|
|
add_executable(psx_cycle_event_boundaries_test
|
|
tests/test_psx_cycle_event_boundaries.c
|
|
src/psx_cycles.c)
|
|
target_include_directories(psx_cycle_event_boundaries_test PRIVATE include)
|
|
add_test(NAME psx_cycle_event_boundaries_test
|
|
COMMAND psx_cycle_event_boundaries_test)
|
|
|
|
add_executable(psx_vblank_clock_test
|
|
tests/test_psx_vblank_clock.c
|
|
src/psx_vblank_clock.c)
|
|
target_include_directories(psx_vblank_clock_test PRIVATE include)
|
|
add_test(NAME psx_vblank_clock_test COMMAND psx_vblank_clock_test)
|
|
|
|
add_executable(psx_video_timing_test
|
|
tests/test_psx_video_timing.c
|
|
src/psx_video_timing.c)
|
|
target_include_directories(psx_video_timing_test PRIVATE include)
|
|
add_test(NAME psx_video_timing_test COMMAND psx_video_timing_test)
|
|
|
|
add_executable(spu_end_without_repeat_test
|
|
tests/test_spu_end_without_repeat.c)
|
|
target_include_directories(spu_end_without_repeat_test PRIVATE include)
|
|
add_test(NAME spu_end_without_repeat_test
|
|
COMMAND spu_end_without_repeat_test)
|
|
|
|
add_executable(spu_pitch_zero_test
|
|
tests/test_spu_pitch_zero.c)
|
|
target_include_directories(spu_pitch_zero_test PRIVATE include)
|
|
add_test(NAME spu_pitch_zero_test
|
|
COMMAND spu_pitch_zero_test)
|
|
|
|
add_executable(spu_gaussian_test tests/test_spu_gaussian.c)
|
|
target_include_directories(spu_gaussian_test PRIVATE include)
|
|
add_test(NAME spu_gaussian_test COMMAND spu_gaussian_test)
|
|
|
|
find_package(Python3 COMPONENTS Interpreter)
|
|
if(Python3_Interpreter_FOUND)
|
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND NOT MSVC
|
|
AND NOT CMAKE_CROSSCOMPILING)
|
|
add_test(NAME audio_trace_pcm_guard_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_audio_trace_pcm_guard.py
|
|
--cc ${CMAKE_C_COMPILER})
|
|
add_test(NAME gpu_gp0_history_guard_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_gpu_gp0_history_guard.py
|
|
--cc ${CMAKE_C_COMPILER})
|
|
add_test(NAME memory_debug_trace_guard_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_memory_debug_trace_guard.py
|
|
--cc ${CMAKE_C_COMPILER})
|
|
endif()
|
|
add_test(NAME fntrace_c_linkage_test COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_fntrace_c_linkage.py)
|
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
|
add_test(NAME overlay_retry_c11_test COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_overlay_retry_c11.py --compiler ${CMAKE_C_COMPILER})
|
|
endif()
|
|
add_test(NAME setup_bios_assets_test COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_setup_bios_assets.py)
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
add_test(NAME launch_disc_path_test COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_launch_disc_path.py --compiler ${CMAKE_CXX_COMPILER})
|
|
add_test(NAME persisted_settings_paths_test COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_persisted_settings_paths.py --compiler ${CMAKE_CXX_COMPILER})
|
|
endif()
|
|
add_test(NAME disc_picker_ascii_test COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_disc_picker_ascii.py)
|
|
add_test(NAME disc_companion_test COMMAND ${Python3_EXECUTABLE} ${PSXRECOMP_ROOT}/tools/tests/test_disc_companion.py)
|
|
add_test(NAME sbi_registry_test COMMAND ${Python3_EXECUTABLE} ${PSXRECOMP_ROOT}/tools/tests/test_sbi_registry.py)
|
|
add_test(NAME perf_campaign_test COMMAND ${Python3_EXECUTABLE} ${PSXRECOMP_ROOT}/tools/tests/test_perf_campaign.py)
|
|
add_test(NAME perf_host_test COMMAND ${Python3_EXECUTABLE} ${PSXRECOMP_ROOT}/tools/tests/test_perf_host.py)
|
|
add_test(NAME frame_interpolation_context_ownership_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_frame_interpolation_context_ownership.py)
|
|
add_test(NAME present_skip_cadence_guard_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_present_skip_cadence_guard.py)
|
|
add_test(NAME mod_bezel_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_mod_bezel.py)
|
|
add_test(NAME rewind_toggle_combo_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_rewind_toggle_combo.py)
|
|
add_test(NAME savestate_status_protocol_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_savestate_status_protocol.py)
|
|
add_test(NAME overlay_region_floor_config_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_overlay_region_floor_config.py)
|
|
add_test(NAME screenshot_hires_pitch_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_screenshot_hires_pitch.py)
|
|
add_test(NAME gl_depth24_upload_order_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_gl_depth24_upload_order.py)
|
|
add_test(NAME pal_cadence_host_refresh_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_pal_cadence_host_refresh.py)
|
|
add_test(NAME mixed_refresh_display_cadence_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_mixed_refresh_display_cadence.py)
|
|
add_test(NAME cdrom_lid_integration_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_cdrom_lid_integration.py)
|
|
add_test(NAME bios_registry_zero_entry_guard_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_bios_registry_zero_entry.py)
|
|
# Exercises runtime/psx_check_mod_catalog.cmake -- the build-time guard
|
|
# that fails a build when a title's mod packages land in the legacy
|
|
# mods/packages layout instead of mods/bundled (bead beads-eio.3.101).
|
|
# Needs the cmake executable, since the guard is a cmake -P script.
|
|
add_test(NAME mod_catalog_layout_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_mod_catalog_layout.py
|
|
--cmake ${CMAKE_COMMAND})
|
|
# psxrecomp_add_game_runtime(... PGXP): the real function body under
|
|
# cmake -P, forwarding the hook-flavor option for the title's one
|
|
# runtime (docs/ENHANCEMENTS.md G1.11).
|
|
add_test(NAME game_runtime_pgxp_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_game_runtime_pgxp.py
|
|
--cmake ${CMAKE_COMMAND})
|
|
# tools/mod_channel_filter.py strips developer features from a staged
|
|
# catalog; every entry that served one ([[requirement]] included) must
|
|
# leave with it.
|
|
add_test(NAME mod_channel_filter_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${PSXRECOMP_ROOT}/tools/tests/test_mod_channel_filter.py)
|
|
# The overlay cache tag may be formatted in exactly two files. Three
|
|
# release packagers hand-built it instead, the flavor-suffix fix reached
|
|
# one of them, and the other two could not stage a matching Linux cache
|
|
# at all -- Tomba 2 v0.0.9 shipped with no AppImage as a result.
|
|
# bead beads-eio.3.102. This test is also the SHARED check a title's own
|
|
# suite runs against its own tree (pass --root <repo>), so the rule has
|
|
# one implementation like the staging it guards.
|
|
add_test(NAME packagers_never_format_cache_tag_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_packagers_never_format_cache_tag.py)
|
|
# Behavioural half of the same bead: tools/release_stage.py must select
|
|
# shards by the tag DIRECTORY's identity (the old `-path "*/<tag>/*"`
|
|
# substring match rejected the real ..._f0 directory and staged zero),
|
|
# must never ship .abi_<tag>.ok / .c / .pair-lock, and must fail rather
|
|
# than warn on an empty selection. Hermetic: synthetic cache trees, no
|
|
# recompiler or captures needed.
|
|
add_test(NAME release_stage_cache_test
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/test_release_stage_cache.py)
|
|
endif()
|
|
|
|
# Full card protocol regression: read, write, address echo, per-slot state,
|
|
# pad interruption, terminal ACK behavior and persistent FLAG semantics.
|
|
add_executable(sio_card_protocol_test
|
|
tests/test_sio_card_protocol.c
|
|
src/sio.c
|
|
src/memcard.c)
|
|
target_include_directories(sio_card_protocol_test PRIVATE include src)
|
|
# Runs in a build-tree scratch dir, NOT in tests/: the test writes
|
|
# test_dir/card1.mcd relative to the working directory (self-provisioning it
|
|
# via mkdir if absent), and tests/test_dir/card1.mcd is a TRACKED fixture —
|
|
# running it from tests/ overwrites that file and leaves the repo dirty.
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sio_card_protocol_scratch)
|
|
add_test(NAME sio_card_protocol_test COMMAND sio_card_protocol_test
|
|
WORKING_DIRECTORY
|
|
${CMAKE_CURRENT_BINARY_DIR}/sio_card_protocol_scratch)
|
|
|
|
# POSIX-only: dlopen()s a fixture .so out of a synthetic cache tree, so it
|
|
# cannot link under MinGW/MSVC (-ldl). run_overlay_posix_test.sh already
|
|
# stages the cache tree, builds the fixture and the test, and runs it — so
|
|
# register THAT rather than reimplementing its fixture staging here.
|
|
if(UNIX)
|
|
find_program(BASH_EXECUTABLE bash)
|
|
if(BASH_EXECUTABLE)
|
|
add_test(NAME overlay_posix_test
|
|
COMMAND ${BASH_EXECUTABLE}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/run_overlay_posix_test.sh)
|
|
else()
|
|
message(STATUS "overlay_posix_test: bash not found - skipped")
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
# ---- test-registration completeness guard (must stay LAST) ------------------
|
|
# Fails configure if a file in runtime/tests/ or recompiler/tests/ is neither
|
|
# registered as a test nor listed as a deliberate exception. See the module
|
|
# header for the rot story this exists to prevent.
|
|
include(${CMAKE_CURRENT_SOURCE_DIR}/check_test_registration.cmake)
|
|
psxrecomp_check_all_tests_registered()
|
|
|
|
if(NOT MSVC)
|
|
psxrecomp_add_runtime_target(psx-oracle
|
|
ORACLE
|
|
DEBUG_PORT 4371
|
|
WINDOW_TITLE "psxrecomp - Oracle"
|
|
DEFAULT_BIOS_PATH "${PSXRECOMP_ROOT}/bios/SCPH1001.BIN"
|
|
)
|
|
endif()
|
|
|
|
# ---- psx-beetle target (Beetle PSX libretro standalone; MinGW, Linux, macOS) ----
|
|
#
|
|
# Standalone binary that runs Beetle PSX (mednafen-psx libretro core) with
|
|
# a debug server exposing the SAME wire-protocol commands as psx-runtime,
|
|
# on its own port (default 4382, set in beetle_main.cpp; --port N). No recomp
|
|
# code linked.
|
|
#
|
|
# Requires beetle-psx with the docs/beetle_*.patch hooks, built via:
|
|
# cd beetle-psx && make platform=mingw_x86_64 STATIC_LINKING=1 HAVE_LIGHTREC=0
|
|
# (platform=unix on Linux, platform=osx on macOS; there the archive is named
|
|
# mednafen_psx_libretro.so/.dylib; copy it to libmednafen_psx.a). Recipes:
|
|
# docs/beetle-linux.md, docs/beetle-macos.md.
|
|
|
|
set(BEETLE_LIB "${CMAKE_SOURCE_DIR}/../beetle-psx/libmednafen_psx.a")
|
|
|
|
if(NOT MSVC AND EXISTS "${BEETLE_LIB}")
|
|
message(STATUS "psx-beetle: found ${BEETLE_LIB}")
|
|
|
|
set(BEETLE_DIR "${CMAKE_SOURCE_DIR}/../beetle-psx")
|
|
set(LRC "${BEETLE_DIR}/libretro-common")
|
|
set(LIBRETRO_COMMON_SOURCES
|
|
${LRC}/streams/file_stream.c
|
|
${LRC}/streams/file_stream_transforms.c
|
|
${LRC}/vfs/vfs_implementation.c
|
|
${LRC}/file/file_path.c
|
|
${LRC}/compat/compat_strl.c
|
|
${LRC}/compat/fopen_utf8.c
|
|
${LRC}/compat/compat_posix_string.c
|
|
${LRC}/string/stdstring.c
|
|
${LRC}/lists/string_list.c
|
|
${LRC}/encodings/encoding_utf.c
|
|
${LRC}/time/rtime.c
|
|
${LRC}/rthreads/rthreads.c
|
|
${LRC}/memmap/memalign.c
|
|
${LRC}/hash/rhash.c
|
|
)
|
|
|
|
add_executable(psx-beetle
|
|
src/beetle_main.cpp
|
|
src/beetle_libretro.cpp
|
|
src/beetle_debug_server.c
|
|
src/frame_pacing.c
|
|
src/host_time.c
|
|
src/parity_trace.c
|
|
src/device_trace.c
|
|
src/audio_trace.c
|
|
${LIBRETRO_COMMON_SOURCES}
|
|
)
|
|
|
|
target_include_directories(psx-beetle PRIVATE
|
|
include
|
|
${PSX_SDL_INCLUDE_DIRS}
|
|
${CMAKE_SOURCE_DIR}/../beetle-psx/libretro-common/include
|
|
${CMAKE_SOURCE_DIR}/../beetle-psx
|
|
)
|
|
|
|
target_compile_definitions(psx-beetle PRIVATE
|
|
PSX_BEETLE_BUILD=1
|
|
DEFAULT_DEBUG_PORT=4380
|
|
$<$<BOOL:${PSX_SDL3}>:PSX_SDL3=1>
|
|
)
|
|
if(NOT PSX_DEBUG_TOOLS)
|
|
target_compile_definitions(psx-beetle PRIVATE PSX_NO_DEBUG_TOOLS=1)
|
|
endif()
|
|
|
|
target_link_libraries(psx-beetle PRIVATE
|
|
"${BEETLE_LIB}"
|
|
${PSX_SDL_LIBRARIES}
|
|
)
|
|
|
|
if(WIN32 OR MINGW)
|
|
target_link_libraries(psx-beetle PRIVATE ws2_32 -lpthread)
|
|
endif()
|
|
|
|
if(MINGW)
|
|
target_link_options(psx-beetle PRIVATE -Wl,--stack,67108864)
|
|
endif()
|
|
elseif(NOT MSVC)
|
|
message(STATUS "psx-beetle: libmednafen_psx.a not found - skipping psx-beetle")
|
|
endif()
|