Files
aevolution/CMakeLists.txt
T
dingoandClaude Opus 5.5 76d21b4815
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 31s
Foundation / server-image (push) Successful in 4m24s
Foundation / image (push) Successful in 5m3s
feat(cellular): rules 13 feeding, matter as energy, spent pool and predation
Phase 2 of the cellular revamp build plan (ADR-0179), server half.

- Matter as energy: when an energy cost exceeds the reserve's energy, reserve
  matter stands in for the rest at each channel's burn rate (pJ per 1,000 fg,
  scaled by the genome's burn efficiency), largest channel first. Upkeep may
  burn any channel; thrust only channels the player has not excluded. Burned
  matter adds no heat; it goes to the region's spent pool. A cell dies only when
  nothing can pay its upkeep.
- Collection: per-channel limits scaled by the genome's collection indices, a
  shared limit on all matter, a tunable cost per membrane point, and only the
  genome's kept share (energy conversion) of bubble energy reaching the reserve.
- Predation: engulf mass carries a tunable share of reserve matter, the
  predator's engulf capacity scales its side and the prey's membrane (now in
  nanometres) its own; kill absorption scales the predator's intake; the kill's
  remainder is split between bubbles at the prey and the spent pool, and a full
  habitat sends overflow to the pool.
- The spent pool is owner format 11 state, counted in conservation, and drips
  back as seeded random bubbles every interval tick.
- Reserve matter is carried as load: slower thrust and turning, costlier thrust.
- Channel exclusions are a 4-bit step intent field, trace byte 14; only owned
  lives under rules 13 may send them.

All values come from the revamp tuning file. Rules up to 12 are unchanged. Tests
cover payments and their conservation over 400 seeds, the rules-13 region step
(collection, membrane, kept energy, burning, engulfment and kill splits with
closure), the drip, load, exclusions, a 700-tick run with closure and exact
restore, and trace replay with exclusions. Session v14 and the client follow
the server phases (build plan). Refreshes the DEV session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:35:31 -04:00

932 lines
57 KiB
CMake

cmake_minimum_required(VERSION 3.28)
project(AeternalisEvolution VERSION 0.1.0 LANGUAGES CXX)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "Use an out-of-source build, e.g. cmake --preset debug")
endif()
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("#include <expected>
#if !defined(__cpp_lib_expected) || __cpp_lib_expected < 202202L
#error std::expected is required
#endif
int main() { std::expected<int, int> result{42}; return *result == 42 ? 0 : 1; }"
EVO_HAS_EXPECTED)
if(NOT EVO_HAS_EXPECTED)
message(FATAL_ERROR "This compiler/standard-library pair lacks the required C++23 std::expected")
endif()
option(EVO_WARNINGS_AS_ERRORS "Treat owned-code warnings as errors" ON)
option(EVO_ENABLE_TIDY "Run clang-tidy during compilation" OFF)
option(EVO_BUILD_FUZZER "Build the Clang libFuzzer snapshot target" OFF)
option(EVO_BUILD_ECS_EXPERIMENT "Build the isolated EnTT comparison (explicit preparation required)" OFF)
option(EVO_BUILD_POSTGRES "Build the isolated Linux PostgreSQL persistence adapter" OFF)
option(EVO_BUILD_UI_PROBE "Build the isolated M9.8a Dear ImGui compatibility probe" OFF)
option(EVO_BUILD_CLIENT_PROBE "Build the isolated M9.1 SDL dependency probe" OFF)
option(EVO_BUILD_CLIENT "Build the native M9 engineering client" OFF)
option(EVO_BUILD_NETWORK "Build the M9.6 dev session protocol and TLS adapter (explicit Mbed TLS preparation required)" OFF)
option(EVO_BUILD_QUIC "Build the M10.2 msquic transport (explicit msquic preparation required)" OFF)
# M9.8e Windows package (ADR-0086): identity printed by `evo-client --version`, set by
# tools/client/package-windows.ps1; deterministic MSVC objects/binaries for packaging.
set(EVO_BUILD_IDENTITY "unpackaged" CACHE STRING "evo-client build identity")
string(LENGTH "${EVO_BUILD_IDENTITY}" evo_identity_length)
if(NOT EVO_BUILD_IDENTITY MATCHES "^[0-9A-Za-z.+-]+$" OR evo_identity_length GREATER 64)
message(FATAL_ERROR "EVO_BUILD_IDENTITY must be 1-64 characters of [0-9A-Za-z.+-]")
endif()
option(EVO_REPRODUCIBLE "MSVC: deterministic objects and binaries (/Brepro)" OFF)
if(MSVC AND EVO_REPRODUCIBLE)
# Before any dependency is added, so SDL, Mbed TLS and Dear ImGui are covered too.
add_compile_options(/Brepro)
add_link_options(/Brepro)
endif()
set(EVO_SANITIZER "none" CACHE STRING "none, address (ASan/UBSan), or thread")
set_property(CACHE EVO_SANITIZER PROPERTY STRINGS none address thread)
include(cmake/ProjectOptions.cmake)
if(EVO_BUILD_CLIENT OR EVO_BUILD_POSTGRES)
add_library(evo_json STATIC src/serialization/json.cpp)
target_include_directories(evo_json PUBLIC "${PROJECT_SOURCE_DIR}/include")
evo_owned_target(evo_json)
endif()
set(evo_simulation_sources src/simulation/world.cpp src/simulation/snapshot.cpp src/simulation/scheduler.cpp src/simulation/spatial.cpp)
add_library(evo_simulation STATIC ${evo_simulation_sources})
add_library(evo::simulation ALIAS evo_simulation)
target_include_directories(evo_simulation PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(evo_simulation PUBLIC cxx_std_23)
evo_owned_target(evo_simulation)
set(evo_world_sources src/world/coordinates.cpp src/world/generation.cpp src/world/chunks.cpp src/world/edits.cpp src/world/codec.cpp src/world/local_files.cpp src/world/environment_units.cpp src/world/fields.cpp src/world/environment.cpp src/world/transfers.cpp src/world/transfer_codec.cpp)
add_library(evo_world STATIC ${evo_world_sources})
add_library(evo::world ALIAS evo_world)
target_include_directories(evo_world PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(evo_world PUBLIC cxx_std_23)
evo_owned_target(evo_world)
add_library(evo_accounting STATIC src/accounting/ledger.cpp src/accounting/rates.cpp)
add_library(evo::accounting ALIAS evo_accounting)
target_include_directories(evo_accounting PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(evo_accounting PUBLIC cxx_std_23)
evo_owned_target(evo_accounting)
add_library(evo_biology STATIC
src/biology/genome.cpp src/biology/development.cpp src/biology/metabolism.cpp
src/biology/mutation.cpp src/biology/lineage.cpp src/biology/founder.cpp
src/biology/cellular_motion.cpp src/biology/cellular_kinematics.cpp
src/biology/cellular_tuning.cpp src/biology/cellular_revamp_tuning.cpp
src/biology/cellular_burn.cpp
src/biology/cellular_currents.cpp
src/biology/cellular_deposit_motion.cpp
src/biology/cellular_uptake.cpp
src/biology/cellular_habitat.cpp src/biology/cellular_step.cpp
src/biology/cellular_region_step.cpp src/biology/budding.cpp)
add_library(evo::biology ALIAS evo_biology)
target_include_directories(evo_biology PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(evo_biology PUBLIC evo::accounting)
target_compile_features(evo_biology PUBLIC cxx_std_23)
evo_owned_target(evo_biology)
# M11.2 portable lifecycle orchestration; no dependency from the foundation proof.
add_library(evo_lifecycle STATIC src/server/lifecycle/primitive_lives.cpp
src/server/lifecycle/primitive_batch.cpp src/server/lifecycle/cellular_lives.cpp
src/server/lifecycle/cellular_migration.cpp
src/server/lifecycle/cellular_migration_trace.cpp
src/server/lifecycle/cellular_census.cpp
src/server/lifecycle/cellular_census_set.cpp
src/server/lifecycle/cellular_batch.cpp src/server/lifecycle/wildlife_controller.cpp
src/server/lifecycle/cellular_play_summary.cpp src/server/lifecycle/cellular_population.cpp
src/server/lifecycle/cellular_population_codec.cpp src/server/lifecycle/cellular_population_policy.cpp
src/server/lifecycle/cellular_schedule.cpp src/server/lifecycle/cellular_population_batch.cpp
src/server/lifecycle/cellular_environment.cpp src/server/lifecycle/cellular_environment_batch.cpp
src/server/lifecycle/cellular_light.cpp src/server/lifecycle/cellular_liquid.cpp
src/server/lifecycle/cellular_revamp.cpp)
add_library(evo::lifecycle ALIAS evo_lifecycle)
target_link_libraries(evo_lifecycle PUBLIC evo::biology evo::world)
evo_owned_target(evo_lifecycle)
add_library(evo_ecology STATIC src/ecology/cohort.cpp src/ecology/collapse.cpp src/ecology/population.cpp src/ecology/materialize.cpp)
add_library(evo::ecology ALIAS evo_ecology)
target_include_directories(evo_ecology PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(evo_ecology PUBLIC evo::accounting evo::biology)
target_compile_features(evo_ecology PUBLIC cxx_std_23)
evo_owned_target(evo_ecology)
add_library(evo_processes STATIC src/processes/producer.cpp src/processes/feeding.cpp src/processes/ecosystem.cpp src/processes/genome_strategy.cpp src/processes/ensemble.cpp src/processes/environmental_community.cpp src/processes/environmental_codec.cpp src/processes/environmental_schedule.cpp src/processes/lineage_region.cpp src/processes/development_opening.cpp)
add_library(evo::processes ALIAS evo_processes)
target_link_libraries(evo_processes PUBLIC evo::accounting evo::biology evo::world)
evo_owned_target(evo_processes)
add_executable(evo-sim apps/evo-sim/main.cpp)
target_link_libraries(evo-sim PRIVATE evo::simulation evo::processes)
evo_owned_target(evo-sim)
# Portable host-side lease timing contract; no database or simulation dependency.
add_library(evo_region_lease STATIC src/persistence/region_lease.cpp)
add_library(evo::region_lease ALIAS evo_region_lease)
target_include_directories(evo_region_lease PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(evo_region_lease PUBLIC cxx_std_23)
evo_owned_target(evo_region_lease)
# Portable host status and bounded operational exposition (M7.8).
add_library(evo_ops STATIC src/server/ops.cpp src/server/load_governor.cpp)
add_library(evo::ops ALIAS evo_ops)
target_include_directories(evo_ops PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_features(evo_ops PUBLIC cxx_std_23)
evo_owned_target(evo_ops)
# Portable checkpoint manifest codec and environmental-v1 payload validation.
add_library(evo_region_checkpoint STATIC src/persistence/region_checkpoint.cpp src/persistence/region_batch.cpp
src/persistence/population_checkpoint.cpp src/persistence/environment_checkpoint.cpp)
add_library(evo::region_checkpoint ALIAS evo_region_checkpoint)
target_link_libraries(evo_region_checkpoint PUBLIC evo::region_lease evo::processes evo::lifecycle)
evo_owned_target(evo_region_checkpoint)
include(CTest)
if(EVO_BUILD_CLIENT OR EVO_BUILD_NETWORK)
# SDL-free client value contracts (M9.3-M9.5), shared by the client and the dev
# session codec. They copy read-only world/biology views, never the reverse.
add_library(evo_client_controls STATIC src/client/camera/camera.cpp src/client/input/input.cpp src/client/input/bindings.cpp src/client/ui/ui_state.cpp src/client/ui/outcome_log.cpp)
target_include_directories(evo_client_controls PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
evo_owned_target(evo_client_controls)
if(BUILD_TESTING)
add_executable(evo-client-state-tests tests/client_ui_state.cpp)
target_link_libraries(evo-client-state-tests PRIVATE evo_client_controls)
evo_owned_target(evo-client-state-tests)
add_test(NAME client-ui-state COMMAND evo-client-state-tests)
set_tests_properties(client-ui-state PROPERTIES TIMEOUT 30 LABELS "client")
add_executable(evo-client-bindings-tests tests/client_bindings.cpp)
target_link_libraries(evo-client-bindings-tests PRIVATE evo_client_controls)
evo_owned_target(evo-client-bindings-tests)
add_test(NAME client-bindings COMMAND evo-client-bindings-tests)
set_tests_properties(client-bindings PROPERTIES TIMEOUT 30 LABELS "client")
endif()
add_library(evo_client_views STATIC src/client/views/environment_view.cpp src/client/views/organism_view.cpp)
target_link_libraries(evo_client_views PUBLIC evo::world evo::biology)
evo_owned_target(evo_client_views)
endif()
if(EVO_BUILD_NETWORK)
include(cmake/Network.cmake)
endif()
if(EVO_BUILD_QUIC)
# M10.2 (ADR-0090). Tests reuse the dev credential generator from the network build.
if(NOT EVO_BUILD_NETWORK)
message(FATAL_ERROR "EVO_BUILD_QUIC requires EVO_BUILD_NETWORK")
endif()
include(cmake/Quic.cmake)
# M10.2b transport: bounded channels and exact CA pinning over msquic.
add_library(evo_network_quic STATIC src/network/transport/quic_endpoint.cpp
src/network/transport/host_lookup.cpp)
target_include_directories(evo_network_quic PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_link_libraries(evo_network_quic PUBLIC evo_msquic PRIVATE mbedtls)
if(WIN32)
target_link_libraries(evo_network_quic PRIVATE ws2_32) # Host name lookup.
endif()
evo_owned_target(evo_network_quic)
# M10.3b session login over QUIC (ADR-0091): region side and client side.
add_library(evo_session_server STATIC src/server/session/region_sessions.cpp)
target_link_libraries(evo_session_server PUBLIC evo_network_quic evo_network_tls)
evo_owned_target(evo_session_server)
add_library(evo_session_client STATIC src/client/session/region_session.cpp)
target_link_libraries(evo_session_client PUBLIC evo_network_quic evo_network_protocol)
evo_owned_target(evo_session_client)
# M11.3d: bind reliable cellular session actions to the complete life-ordered trace.
add_library(evo_cellular_session_adapter STATIC
src/server/session/cellular_session_batch.cpp)
target_link_libraries(evo_cellular_session_adapter PUBLIC evo::lifecycle evo_network_protocol)
evo_owned_target(evo_cellular_session_adapter)
# M10.4c headless session client (development and test only; ADR-0092).
add_executable(evo-session-probe apps/evo-session-probe/main.cpp)
target_link_libraries(evo-session-probe PRIVATE evo_session_client evo_network_tls)
evo_owned_target(evo-session-probe)
evo_msquic_runtime(evo-session-probe)
# M10.9b multi-client load generator (development and qualification; ADR-0097).
find_package(Threads REQUIRED)
add_executable(evo-load tools/network/load.cpp)
target_link_libraries(evo-load PRIVATE evo_session_client evo_network_tls evo_client_prediction
Threads::Threads)
evo_owned_target(evo-load)
evo_msquic_runtime(evo-load)
if(BUILD_TESTING)
# Owned impairment relay (tests and measurements only).
add_library(evo_network_impair STATIC tools/network/impair/udp_relay.cpp)
target_include_directories(evo_network_impair PUBLIC "${PROJECT_SOURCE_DIR}/tools/network/impair")
if(WIN32)
target_link_libraries(evo_network_impair PUBLIC ws2_32 winmm)
endif()
evo_owned_target(evo_network_impair)
add_executable(evo-quic-transport-tests tests/quic_transport.cpp)
target_link_libraries(evo-quic-transport-tests PRIVATE evo_network_quic evo_network_impair evo_network_tls)
evo_owned_target(evo-quic-transport-tests)
evo_msquic_runtime(evo-quic-transport-tests)
# M10.2c measurement tool (development reference; not a test).
add_executable(evo-quic-hol-measure tools/network/quic_hol.cpp)
target_link_libraries(evo-quic-hol-measure PRIVATE evo_network_quic evo_network_impair evo_network_tls)
evo_owned_target(evo-quic-hol-measure)
evo_msquic_runtime(evo-quic-hol-measure)
add_test(NAME quic-transport COMMAND evo-quic-transport-tests)
set_tests_properties(quic-transport PROPERTIES TIMEOUT 180 LABELS "quic")
add_executable(evo-quic-session-tests tests/quic_sessions.cpp)
target_link_libraries(evo-quic-session-tests PRIVATE evo_session_server evo_session_client)
evo_owned_target(evo-quic-session-tests)
evo_msquic_runtime(evo-quic-session-tests)
add_test(NAME quic-sessions COMMAND evo-quic-session-tests)
set_tests_properties(quic-sessions PROPERTIES TIMEOUT 120 LABELS "quic;quic-session")
add_executable(evo-cellular-session-batch-tests tests/cellular_session_batch_tests.cpp)
target_link_libraries(evo-cellular-session-batch-tests PRIVATE evo_cellular_session_adapter)
evo_owned_target(evo-cellular-session-batch-tests)
add_test(NAME cellular-session-batch COMMAND evo-cellular-session-batch-tests)
set_tests_properties(cellular-session-batch PROPERTIES TIMEOUT 60 LABELS "quic;cellular")
add_executable(evo-quic-smoke-tests tests/quic_smoke.cpp)
target_link_libraries(evo-quic-smoke-tests PRIVATE evo_msquic evo_network_tls)
evo_owned_target(evo-quic-smoke-tests)
evo_msquic_runtime(evo-quic-smoke-tests)
add_test(NAME quic-smoke COMMAND evo-quic-smoke-tests)
set_tests_properties(quic-smoke PROPERTIES TIMEOUT 60 LABELS "quic")
endif()
endif()
if(EVO_BUILD_CLIENT_PROBE OR EVO_BUILD_CLIENT OR EVO_BUILD_UI_PROBE)
include(cmake/ClientProbe.cmake)
endif()
if(EVO_BUILD_POSTGRES)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL_ERROR "The initial PostgreSQL adapter is qualified on Linux only")
endif()
find_package(PostgreSQL 18.6 EXACT REQUIRED)
find_package(Threads REQUIRED)
add_library(evo_postgres STATIC src/persistence/postgres.cpp src/persistence/region_lease_store.cpp
src/persistence/population_interval_store.cpp)
add_library(evo::postgres ALIAS evo_postgres)
target_include_directories(evo_postgres PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(evo_postgres PUBLIC evo::region_lease PRIVATE PostgreSQL::PostgreSQL)
evo_owned_target(evo_postgres)
# SHA-256 via system OpenSSL libcrypto (already required by libpq TLS; ADR-0061).
find_package(OpenSSL 3 REQUIRED COMPONENTS Crypto)
add_library(evo_region_store STATIC src/persistence/sha256.cpp src/persistence/object_store.cpp
src/persistence/checkpoint_store.cpp src/persistence/primitive_checkpoint_store.cpp
src/persistence/cellular_checkpoint_store.cpp src/persistence/population_checkpoint_store.cpp
src/persistence/environment_checkpoint_store.cpp
src/persistence/cellular_history_store.cpp
src/persistence/cellular_census_snapshot.cpp
src/persistence/region_clone.cpp src/persistence/cellular_migration_store.cpp)
add_library(evo::region_store ALIAS evo_region_store)
target_link_libraries(evo_region_store PUBLIC evo::postgres evo::region_checkpoint
PRIVATE OpenSSL::Crypto)
evo_owned_target(evo_region_store)
# M7.6 authoritative region host and its process (ADR-0064).
add_library(evo_region_host STATIC src/server/region_host.cpp
src/server/primitive_region_host.cpp src/server/cellular_region_host.cpp
src/server/ops_http.cpp)
add_library(evo::region_host ALIAS evo_region_host)
target_link_libraries(evo_region_host PUBLIC evo::region_store evo::ops)
evo_owned_target(evo_region_host)
add_executable(evo-server apps/evo-server/main.cpp)
target_link_libraries(evo-server PRIVATE evo::region_host)
if(EVO_BUILD_NETWORK)
# M9.7 dev sessions inside the region process (ADR-0083).
target_link_libraries(evo-server PRIVATE evo_network_session)
target_compile_definitions(evo-server PRIVATE EVO_SERVER_SESSIONS=1)
endif()
if(EVO_BUILD_QUIC)
# M10.4c QUIC sessions inside the region process (ADR-0091/0092); opt-in by flags.
target_link_libraries(evo-server PRIVATE evo_session_server evo_control_ledger_postgres
evo_cellular_session_adapter)
target_compile_definitions(evo-server PRIVATE EVO_SERVER_M10=1)
endif()
evo_owned_target(evo-server)
if(EVO_BUILD_NETWORK)
# M10.3c durable account control, M10.4b durable action records and M10.8b ticket
# handoffs for region sessions (ADR-0091 schema v10, ADR-0092 v11, ADR-0096 v12).
add_library(evo_control_ledger_postgres STATIC src/server/session/postgres_control_ledger.cpp
src/server/session/postgres_action_ledger.cpp src/server/session/postgres_handoff_ledger.cpp)
target_link_libraries(evo_control_ledger_postgres PUBLIC evo::postgres evo_network_protocol)
evo_owned_target(evo_control_ledger_postgres)
# ADR-0131 Keycloak grant broker (schema v39).
add_library(evo_grant_broker STATIC
src/server/broker/access_token.cpp src/server/broker/grant_broker.cpp)
target_link_libraries(evo_grant_broker PUBLIC evo_json evo::region_host evo_network_tls
PRIVATE OpenSSL::Crypto)
evo_owned_target(evo_grant_broker)
add_executable(evo-grant-broker apps/evo-grant-broker/main.cpp)
target_link_libraries(evo-grant-broker PRIVATE evo_grant_broker)
evo_owned_target(evo-grant-broker)
endif()
# M7.9 clone and history audit tool (ADR-0067).
add_executable(evo-world-clone apps/evo-world-clone/main.cpp)
target_link_libraries(evo-world-clone PRIVATE evo::region_store)
evo_owned_target(evo-world-clone)
if(BUILD_TESTING)
# Contention tests use one thread and one connection per contender.
add_executable(evo-postgres-tests tests/postgres_tests.cpp tests/region_lease_store_tests.cpp
tests/cellular_publication_tests.cpp
tests/population_publication_tests.cpp tests/environment_publication_tests.cpp
tests/fixtures/postgres_relay.cpp
tests/account_control_store_tests.cpp tests/probe_handoff_store_tests.cpp
tests/life_reservation_store_tests.cpp
tests/primitive_publication_tests.cpp
tests/region_action_tests.cpp
tests/region_checkpoint_store_tests.cpp tests/region_host_tests.cpp
tests/region_server_process_tests.cpp tests/region_recovery_tests.cpp
tests/region_ops_tests.cpp tests/region_clone_tests.cpp
tests/region_migration_tests.cpp tests/region_store_tests.cpp
tests/region_load_tests.cpp tests/region_upgrade_tests.cpp)
target_link_libraries(evo-postgres-tests PRIVATE evo::region_host Threads::Threads)
if(EVO_BUILD_NETWORK)
# M9.7: real evo-server sessions over TLS (ADR-0083).
target_sources(evo-postgres-tests PRIVATE tests/region_session_tests.cpp
tests/grant_broker_tests.cpp)
target_link_libraries(evo-postgres-tests PRIVATE evo_network_session evo_control_ledger_postgres
evo_grant_broker OpenSSL::Crypto)
target_compile_definitions(evo-postgres-tests PRIVATE EVO_POSTGRES_SESSIONS=1)
endif()
if(EVO_BUILD_QUIC)
# M10.4c: evo-server with the QUIC listener, real clients and the probe (ADR-0092).
# M10.8d: two evo-server processes handing probes over (ADR-0096).
target_sources(evo-postgres-tests PRIVATE tests/region_m10_session_tests.cpp
tests/region_handoff_process_tests.cpp)
target_link_libraries(evo-postgres-tests PRIVATE evo_session_client
evo_cellular_session_adapter)
target_compile_definitions(evo-postgres-tests PRIVATE EVO_POSTGRES_M10=1)
add_dependencies(evo-postgres-tests evo-session-probe evo-load)
endif()
add_dependencies(evo-postgres-tests evo-server evo-world-clone) # Spawned by process tests.
evo_owned_target(evo-postgres-tests)
# Intentionally not an ordinary CTest: tools/ci/postgres-check.sh owns its private DB.
endif()
endif()
if(BUILD_TESTING)
add_executable(evo-session-window-tests tests/session_window_tests.cpp)
target_include_directories(evo-session-window-tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
evo_owned_target(evo-session-window-tests)
add_test(NAME session-window-contracts COMMAND evo-session-window-tests)
set_tests_properties(session-window-contracts PROPERTIES TIMEOUT 30)
add_executable(evo-region-lease-tests tests/region_lease_tests.cpp)
target_link_libraries(evo-region-lease-tests PRIVATE evo::region_lease)
evo_owned_target(evo-region-lease-tests)
add_test(NAME region-lease-contracts COMMAND evo-region-lease-tests)
set_tests_properties(region-lease-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-lineage-region-tests tests/lineage_region_tests.cpp)
target_link_libraries(evo-lineage-region-tests PRIVATE evo::processes)
evo_owned_target(evo-lineage-region-tests)
add_test(NAME lineage-region-contracts COMMAND evo-lineage-region-tests)
set_tests_properties(lineage-region-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-ops-tests tests/ops_tests.cpp)
target_link_libraries(evo-ops-tests PRIVATE evo::ops)
evo_owned_target(evo-ops-tests)
add_test(NAME ops-contracts COMMAND evo-ops-tests)
set_tests_properties(ops-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-region-batch-tests tests/region_batch_tests.cpp)
target_link_libraries(evo-region-batch-tests PRIVATE evo::region_checkpoint)
evo_owned_target(evo-region-batch-tests)
add_test(NAME region-batch-contracts COMMAND evo-region-batch-tests)
set_tests_properties(region-batch-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-region-checkpoint-tests tests/region_checkpoint_tests.cpp)
target_link_libraries(evo-region-checkpoint-tests PRIVATE evo::region_checkpoint)
evo_owned_target(evo-region-checkpoint-tests)
add_test(NAME region-checkpoint-contracts COMMAND evo-region-checkpoint-tests)
set_tests_properties(region-checkpoint-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-environmental-qualification tests/environmental_qualification.cpp)
target_link_libraries(evo-environmental-qualification PRIVATE evo::processes)
evo_owned_target(evo-environmental-qualification)
add_test(NAME environmental-qualification COMMAND evo-environmental-qualification)
set_tests_properties(environmental-qualification PROPERTIES TIMEOUT 120)
add_executable(evo-environmental-community-tests tests/environmental_community_tests.cpp)
target_link_libraries(evo-environmental-community-tests PRIVATE evo::processes)
evo_owned_target(evo-environmental-community-tests)
add_test(NAME environmental-community-contracts COMMAND evo-environmental-community-tests)
set_tests_properties(environmental-community-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-environment-transfers-tests tests/environment_transfers_tests.cpp)
target_link_libraries(evo-environment-transfers-tests PRIVATE evo::world)
evo_owned_target(evo-environment-transfers-tests)
add_test(NAME environment-transfers-contracts COMMAND evo-environment-transfers-tests)
set_tests_properties(environment-transfers-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-environment-views-tests tests/environment_views_tests.cpp)
target_link_libraries(evo-environment-views-tests PRIVATE evo::world)
evo_owned_target(evo-environment-views-tests)
add_test(NAME environment-views-contracts COMMAND evo-environment-views-tests)
set_tests_properties(environment-views-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-world-fields-tests tests/world_fields_tests.cpp)
target_link_libraries(evo-world-fields-tests PRIVATE evo::world)
evo_owned_target(evo-world-fields-tests)
add_test(NAME world-fields-contracts COMMAND evo-world-fields-tests)
set_tests_properties(world-fields-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-environment-units-tests tests/environment_units_tests.cpp)
target_link_libraries(evo-environment-units-tests PRIVATE evo::world evo::accounting)
evo_owned_target(evo-environment-units-tests)
add_test(NAME environment-units-contracts COMMAND evo-environment-units-tests)
set_tests_properties(environment-units-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-world-codec-fuzz-smoke tests/fuzz/world_codec_fuzz.cpp tests/fuzz/world_codec_smoke.cpp)
target_link_libraries(evo-world-codec-fuzz-smoke PRIVATE evo::world)
evo_owned_target(evo-world-codec-fuzz-smoke)
add_test(NAME world-codec-fuzz-smoke COMMAND evo-world-codec-fuzz-smoke)
set_tests_properties(world-codec-fuzz-smoke PROPERTIES TIMEOUT 120)
add_executable(evo-world-codec-tests tests/world_codec_tests.cpp)
target_link_libraries(evo-world-codec-tests PRIVATE evo::world)
evo_owned_target(evo-world-codec-tests)
add_test(NAME world-codec-contracts COMMAND evo-world-codec-tests)
set_tests_properties(world-codec-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-world-local-files-tests tests/world_local_files_tests.cpp)
target_link_libraries(evo-world-local-files-tests PRIVATE evo::world)
evo_owned_target(evo-world-local-files-tests)
add_test(NAME world-local-files-contracts COMMAND evo-world-local-files-tests)
set_tests_properties(world-local-files-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-world-edit-tests tests/world_edit_tests.cpp)
target_link_libraries(evo-world-edit-tests PRIVATE evo::world)
evo_owned_target(evo-world-edit-tests)
add_test(NAME world-edit-contracts COMMAND evo-world-edit-tests)
set_tests_properties(world-edit-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-world-chunk-tests tests/world_chunk_tests.cpp)
target_link_libraries(evo-world-chunk-tests PRIVATE evo::world)
evo_owned_target(evo-world-chunk-tests)
add_test(NAME world-chunk-contracts COMMAND evo-world-chunk-tests)
set_tests_properties(world-chunk-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-world-generation-tests tests/world_generation_tests.cpp)
target_link_libraries(evo-world-generation-tests PRIVATE evo::world)
evo_owned_target(evo-world-generation-tests)
add_test(NAME world-generation-contracts COMMAND evo-world-generation-tests)
set_tests_properties(world-generation-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-world-coordinate-tests tests/world_coordinates_tests.cpp)
target_link_libraries(evo-world-coordinate-tests PRIVATE evo::world)
evo_owned_target(evo-world-coordinate-tests)
add_test(NAME world-coordinate-contracts COMMAND evo-world-coordinate-tests)
set_tests_properties(world-coordinate-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-feeding-tests tests/feeding_tests.cpp)
target_link_libraries(evo-feeding-tests PRIVATE evo::processes)
evo_owned_target(evo-feeding-tests)
add_test(NAME feeding-contracts COMMAND evo-feeding-tests)
set_tests_properties(feeding-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-ecosystem-tests tests/ecosystem_tests.cpp)
target_link_libraries(evo-ecosystem-tests PRIVATE evo::processes)
evo_owned_target(evo-ecosystem-tests)
add_test(NAME ecosystem-contracts COMMAND evo-ecosystem-tests)
set_tests_properties(ecosystem-contracts PROPERTIES TIMEOUT 300)
add_executable(evo-genome-tests tests/genome_tests.cpp)
target_link_libraries(evo-genome-tests PRIVATE evo::biology)
evo_owned_target(evo-genome-tests)
add_test(NAME genome-contracts COMMAND evo-genome-tests)
set_tests_properties(genome-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-development-tests tests/development_tests.cpp)
target_link_libraries(evo-development-tests PRIVATE evo::biology)
evo_owned_target(evo-development-tests)
add_test(NAME development-contracts COMMAND evo-development-tests)
set_tests_properties(development-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-metabolism-tests tests/metabolism_tests.cpp)
add_executable(evo-cellular-motion-tests tests/cellular_motion_tests.cpp)
target_link_libraries(evo-cellular-motion-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-motion-tests)
add_test(NAME cellular-motion-contracts COMMAND evo-cellular-motion-tests)
set_tests_properties(cellular-motion-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cellular-kinematics-tests tests/cellular_kinematics_tests.cpp)
target_link_libraries(evo-cellular-kinematics-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-kinematics-tests)
add_test(NAME cellular-kinematics-contracts COMMAND evo-cellular-kinematics-tests)
set_tests_properties(cellular-kinematics-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cellular-tuning-tests tests/cellular_tuning_tests.cpp)
target_link_libraries(evo-cellular-tuning-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-tuning-tests)
# The DEV tuning file is absent from native CI images, which copy no deploy/ tree.
set(evo_dev_tuning "${CMAKE_CURRENT_SOURCE_DIR}/deploy/kubernetes/region/dev/tuning/cellular.tuning")
if(EXISTS "${evo_dev_tuning}")
add_test(NAME cellular-tuning-contracts COMMAND evo-cellular-tuning-tests "${evo_dev_tuning}")
else()
add_test(NAME cellular-tuning-contracts COMMAND evo-cellular-tuning-tests)
endif()
add_executable(evo-cellular-revamp-step-tests tests/cellular_revamp_step_tests.cpp)
target_link_libraries(evo-cellular-revamp-step-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-revamp-step-tests)
add_test(NAME cellular-revamp-step-contracts COMMAND evo-cellular-revamp-step-tests)
add_executable(evo-cellular-burn-tests tests/cellular_burn_tests.cpp)
target_link_libraries(evo-cellular-burn-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-burn-tests)
add_test(NAME cellular-burn-contracts COMMAND evo-cellular-burn-tests)
add_executable(evo-cellular-revamp-tuning-tests tests/cellular_revamp_tuning_tests.cpp)
target_link_libraries(evo-cellular-revamp-tuning-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-revamp-tuning-tests)
set(evo_dev_revamp_tuning
"${CMAKE_CURRENT_SOURCE_DIR}/deploy/kubernetes/region/dev/tuning/cellular-revamp.tuning")
if(EXISTS "${evo_dev_revamp_tuning}")
add_test(NAME cellular-revamp-tuning-contracts
COMMAND evo-cellular-revamp-tuning-tests "${evo_dev_revamp_tuning}")
else()
add_test(NAME cellular-revamp-tuning-contracts COMMAND evo-cellular-revamp-tuning-tests)
endif()
set_tests_properties(cellular-tuning-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cellular-currents-tests tests/cellular_currents_tests.cpp)
target_link_libraries(evo-cellular-currents-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-currents-tests)
add_test(NAME cellular-currents-contracts COMMAND evo-cellular-currents-tests)
set_tests_properties(cellular-currents-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-cellular-deposit-motion-tests tests/cellular_deposit_motion_tests.cpp)
target_link_libraries(evo-cellular-deposit-motion-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-deposit-motion-tests)
add_test(NAME cellular-deposit-motion-contracts COMMAND evo-cellular-deposit-motion-tests)
set_tests_properties(cellular-deposit-motion-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-cellular-liquid-step-tests tests/cellular_liquid_step_tests.cpp)
target_link_libraries(evo-cellular-liquid-step-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-liquid-step-tests)
add_test(NAME cellular-liquid-step-contracts COMMAND evo-cellular-liquid-step-tests)
set_tests_properties(cellular-liquid-step-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cellular-uptake-tests tests/cellular_uptake_tests.cpp)
target_link_libraries(evo-cellular-uptake-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-uptake-tests)
add_test(NAME cellular-uptake-contracts COMMAND evo-cellular-uptake-tests)
set_tests_properties(cellular-uptake-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cellular-habitat-tests tests/cellular_habitat_tests.cpp)
target_link_libraries(evo-cellular-habitat-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-habitat-tests)
add_test(NAME cellular-habitat-contracts COMMAND evo-cellular-habitat-tests)
set_tests_properties(cellular-habitat-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cellular-step-tests tests/cellular_step_tests.cpp)
target_link_libraries(evo-cellular-step-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-step-tests)
add_test(NAME cellular-step-contracts COMMAND evo-cellular-step-tests)
set_tests_properties(cellular-step-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cellular-region-step-tests tests/cellular_region_step_tests.cpp)
target_link_libraries(evo-cellular-region-step-tests PRIVATE evo::biology)
evo_owned_target(evo-cellular-region-step-tests)
add_test(NAME cellular-region-step-contracts COMMAND evo-cellular-region-step-tests)
set_tests_properties(cellular-region-step-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-primitive-lives-tests tests/primitive_lives_tests.cpp)
target_link_libraries(evo-primitive-lives-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-primitive-lives-tests)
add_test(NAME primitive-lives COMMAND evo-primitive-lives-tests)
add_executable(evo-cellular-lives-tests tests/cellular_lives_tests.cpp)
target_link_libraries(evo-cellular-lives-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-lives-tests)
add_test(NAME cellular-lives-owner COMMAND evo-cellular-lives-tests)
set_tests_properties(cellular-lives-owner PROPERTIES TIMEOUT 60)
target_link_libraries(evo-metabolism-tests PRIVATE evo::processes)
evo_owned_target(evo-metabolism-tests)
add_test(NAME metabolism-contracts COMMAND evo-metabolism-tests)
set_tests_properties(metabolism-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-mutation-tests tests/mutation_tests.cpp)
target_link_libraries(evo-mutation-tests PRIVATE evo::biology)
evo_owned_target(evo-mutation-tests)
add_test(NAME mutation-contracts COMMAND evo-mutation-tests)
set_tests_properties(mutation-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-budding-tests tests/budding_tests.cpp)
target_link_libraries(evo-budding-tests PRIVATE evo::biology)
evo_owned_target(evo-budding-tests)
add_test(NAME budding-contracts COMMAND evo-budding-tests)
set_tests_properties(budding-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-offspring-tests tests/offspring_tests.cpp)
target_link_libraries(evo-offspring-tests PRIVATE evo::biology)
evo_owned_target(evo-offspring-tests)
add_test(NAME offspring-inherited-funding COMMAND evo-offspring-tests)
set_tests_properties(offspring-inherited-funding PROPERTIES TIMEOUT 120)
add_executable(evo-lineage-tests tests/lineage_tests.cpp)
target_link_libraries(evo-lineage-tests PRIVATE evo::biology)
evo_owned_target(evo-lineage-tests)
add_test(NAME lineage-contracts COMMAND evo-lineage-tests)
set_tests_properties(lineage-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-ensemble-tests tests/ensemble_tests.cpp)
target_link_libraries(evo-ensemble-tests PRIVATE evo::processes)
evo_owned_target(evo-ensemble-tests)
add_test(NAME ensemble-contracts COMMAND evo-ensemble-tests)
set_tests_properties(ensemble-contracts PROPERTIES TIMEOUT 300)
add_executable(evo-producer-tests tests/producer_tests.cpp)
target_link_libraries(evo-producer-tests PRIVATE evo::processes)
evo_owned_target(evo-producer-tests)
add_test(NAME producer-contracts COMMAND evo-producer-tests)
set_tests_properties(producer-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-cohort-tests tests/cohort_tests.cpp)
target_link_libraries(evo-cohort-tests PRIVATE evo::ecology)
evo_owned_target(evo-cohort-tests)
add_test(NAME cohort-contracts COMMAND evo-cohort-tests)
set_tests_properties(cohort-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-collapse-tests tests/collapse_tests.cpp)
target_link_libraries(evo-collapse-tests PRIVATE evo::ecology)
evo_owned_target(evo-collapse-tests)
add_test(NAME collapse-contracts COMMAND evo-collapse-tests)
set_tests_properties(collapse-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-population-tests tests/population_tests.cpp)
target_link_libraries(evo-population-tests PRIVATE evo::ecology)
evo_owned_target(evo-population-tests)
add_test(NAME population-contracts COMMAND evo-population-tests)
set_tests_properties(population-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-materialize-tests tests/materialize_tests.cpp)
target_link_libraries(evo-materialize-tests PRIVATE evo::ecology)
evo_owned_target(evo-materialize-tests)
add_test(NAME materialize-contracts COMMAND evo-materialize-tests)
set_tests_properties(materialize-contracts PROPERTIES TIMEOUT 120)
add_executable(evo-equivalence-tests tests/equivalence_tests.cpp)
target_link_libraries(evo-equivalence-tests PRIVATE evo::ecology)
evo_owned_target(evo-equivalence-tests)
add_test(NAME resolution-equivalence COMMAND evo-equivalence-tests)
set_tests_properties(resolution-equivalence PROPERTIES TIMEOUT 600)
add_executable(evo-ledger-tests tests/ledger_tests.cpp)
target_link_libraries(evo-ledger-tests PRIVATE evo::accounting)
evo_owned_target(evo-ledger-tests)
add_test(NAME ledger-contracts COMMAND evo-ledger-tests)
set_tests_properties(ledger-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-rate-tests tests/rate_tests.cpp)
target_link_libraries(evo-rate-tests PRIVATE evo::accounting)
evo_owned_target(evo-rate-tests)
add_test(NAME rate-contracts COMMAND evo-rate-tests)
set_tests_properties(rate-contracts PROPERTIES TIMEOUT 60)
add_executable(evo-tests tests/simulation_tests.cpp)
target_link_libraries(evo-tests PRIVATE evo::simulation)
evo_owned_target(evo-tests)
add_test(NAME simulation-contracts COMMAND evo-tests)
add_test(NAME test-harness-failure COMMAND evo-tests --self-test-failure)
set_tests_properties(test-harness-failure PROPERTIES WILL_FAIL TRUE)
add_test(NAME cli-replay COMMAND evo-sim --seed 123456 --ticks 1000 --entities 8 --verify-replay)
set_tests_properties(cli-replay PROPERTIES PASS_REGULAR_EXPRESSION "d61ad5bf0c928c76")
add_test(NAME cli-invalid-number COMMAND evo-sim --ticks -1)
set_tests_properties(cli-invalid-number PROPERTIES WILL_FAIL TRUE)
add_test(NAME cli-ecosystem COMMAND evo-sim --ecosystem --seed 0 --episodes 32)
set_tests_properties(cli-ecosystem PROPERTIES TIMEOUT 120
PASS_REGULAR_EXPRESSION "2cd4a15f9fbe9949")
# An option belonging to the other mode must be rejected, never accepted and ignored.
add_test(NAME cli-ecosystem-conflict COMMAND evo-sim --ecosystem --verify-replay)
add_test(NAME cli-ecosystem-rejects-ticks COMMAND evo-sim --ecosystem --seed 0 --ticks 1)
add_test(NAME cli-ecosystem-rejects-entities COMMAND evo-sim --ecosystem --entities 4)
add_test(NAME cli-ecosystem-rejects-save COMMAND evo-sim --ecosystem --save episodes.evo)
add_test(NAME cli-episodes-require-ecosystem COMMAND evo-sim --episodes 2 --tick-limit 1)
add_test(NAME cli-tick-limit-requires-ecosystem COMMAND evo-sim --ticks 10 --tick-limit 1)
add_test(NAME cli-ecosystem-rejects-seeds-per-cell COMMAND evo-sim --ecosystem --seeds-per-cell 4)
set_tests_properties(cli-ecosystem-conflict cli-ecosystem-rejects-ticks
cli-ecosystem-rejects-entities cli-ecosystem-rejects-save
cli-episodes-require-ecosystem cli-tick-limit-requires-ecosystem
cli-ecosystem-rejects-seeds-per-cell
PROPERTIES WILL_FAIL TRUE)
add_test(NAME cli-ensemble COMMAND evo-sim --ensemble --seed 0 --seeds-per-cell 4
--strategies 3 --tick-limit 400)
# Repinned when survivors stopped being recorded as deaths and the report gained
# deaths/survivors/observed_ticks with a summed shortfall. The reported facts
# changed, so the old value describes a report this build no longer produces.
set_tests_properties(cli-ensemble PROPERTIES TIMEOUT 120
PASS_REGULAR_EXPRESSION "5ec59d390909b526")
# The two measurement modes are separate workloads, and neither may borrow the
# other's options: --episodes counts episodes, --seeds-per-cell counts seeds.
add_test(NAME cli-ensemble-conflict COMMAND evo-sim --ensemble --verify-replay)
add_test(NAME cli-ensemble-excludes-ecosystem COMMAND evo-sim --ensemble --ecosystem)
add_test(NAME cli-ensemble-rejects-episodes COMMAND evo-sim --ensemble --episodes 2)
add_test(NAME cli-ensemble-rejects-ticks COMMAND evo-sim --ensemble --ticks 1)
add_test(NAME cli-ensemble-rejects-entities COMMAND evo-sim --ensemble --entities 4)
# Halves need at least one seed each, and the driver caps strategies at four.
add_test(NAME cli-ensemble-rejects-single-seed COMMAND evo-sim --ensemble --seeds-per-cell 1)
add_test(NAME cli-ensemble-rejects-excess-strategies COMMAND evo-sim --ensemble --strategies 5)
add_test(NAME cli-seeds-per-cell-requires-ensemble COMMAND evo-sim --seeds-per-cell 4)
add_test(NAME cli-strategies-requires-ensemble COMMAND evo-sim --strategies 3)
set_tests_properties(cli-ensemble-conflict cli-ensemble-excludes-ecosystem
cli-ensemble-rejects-episodes cli-ensemble-rejects-ticks cli-ensemble-rejects-entities
cli-ensemble-rejects-single-seed cli-ensemble-rejects-excess-strategies
cli-seeds-per-cell-requires-ensemble cli-strategies-requires-ensemble
PROPERTIES WILL_FAIL TRUE)
add_test(NAME cli-file-integration COMMAND "${CMAKE_COMMAND}"
"-DEVO_SIM=$<TARGET_FILE:evo-sim>" "-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/cli-integration"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cli_integration.cmake")
set_tests_properties(simulation-contracts cli-replay cli-file-integration PROPERTIES TIMEOUT 60)
endif()
add_executable(evo-benchmark tests/benchmarks/simulation_benchmark.cpp)
target_link_libraries(evo-benchmark PRIVATE evo::simulation)
evo_owned_target(evo-benchmark)
add_executable(evo-world-proof apps/evo-tools/world_proof.cpp)
target_link_libraries(evo-world-proof PRIVATE evo::world)
evo_owned_target(evo-world-proof)
if(BUILD_TESTING)
add_test(NAME world-process-restart COMMAND "${CMAKE_COMMAND}"
"-DEVO_WORLD_PROOF=$<TARGET_FILE:evo-world-proof>"
"-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/world-proof"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/world_process_restart.cmake")
set_tests_properties(world-process-restart PROPERTIES TIMEOUT 120)
endif()
add_executable(evo-resolution-benchmark tests/benchmarks/resolution_benchmark.cpp)
target_link_libraries(evo-resolution-benchmark PRIVATE evo::ecology)
evo_owned_target(evo-resolution-benchmark)
if(BUILD_TESTING)
add_test(NAME resolution-sensitivity COMMAND evo-resolution-benchmark --verify)
set_tests_properties(resolution-sensitivity PROPERTIES TIMEOUT 120)
endif()
add_executable(evo-reserve-strata experiments/resolution/reserve_strata.cpp)
target_link_libraries(evo-reserve-strata PRIVATE evo::ecology)
evo_owned_target(evo-reserve-strata)
if(BUILD_TESTING)
add_test(NAME reserve-strata-qualification COMMAND evo-reserve-strata --verify)
set_tests_properties(reserve-strata-qualification PROPERTIES TIMEOUT 120)
endif()
add_executable(evo-cellular-reference experiments/resolution/cellular_reference.cpp)
target_link_libraries(evo-cellular-reference PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-reference)
add_executable(evo-cellular-generations experiments/resolution/cellular_generations.cpp)
target_link_libraries(evo-cellular-generations PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-generations)
if(BUILD_TESTING)
add_test(NAME cellular-population-reference COMMAND evo-cellular-reference --verify)
set_tests_properties(cellular-population-reference PROPERTIES TIMEOUT 180)
add_test(NAME cellular-unscripted-generations COMMAND evo-cellular-generations --verify)
set_tests_properties(cellular-unscripted-generations PROPERTIES TIMEOUT 180)
endif()
add_executable(evo-cellular-cohorts experiments/resolution/cellular_cohorts.cpp)
target_link_libraries(evo-cellular-cohorts PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-cohorts)
if(BUILD_TESTING)
# Sanitizer instrumentation and shared CI runner contention are not product
# performance gates. Keep the full matrix, with bounded instrumented budgets.
set(evo_cohort_timeout 180)
set(evo_migration_timeout 180)
if(EVO_SANITIZER STREQUAL "address")
set(evo_cohort_timeout 600)
set(evo_migration_timeout 360)
elseif(EVO_SANITIZER STREQUAL "thread")
set(evo_cohort_timeout 900)
set(evo_migration_timeout 600)
endif()
add_test(NAME cellular-cohort-qualification COMMAND evo-cellular-cohorts --verify)
set_tests_properties(cellular-cohort-qualification PROPERTIES TIMEOUT ${evo_cohort_timeout})
endif()
if(BUILD_TESTING)
add_executable(evo-cellular-population-tests tests/cellular_population_tests.cpp)
add_executable(evo-cellular-plan-population-tests tests/cellular_plan_population_tests.cpp)
target_link_libraries(evo-cellular-plan-population-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-plan-population-tests)
add_test(NAME cellular-retained-plan-population COMMAND evo-cellular-plan-population-tests)
add_test(NAME cellular-retained-plan-population-restart COMMAND "${CMAKE_COMMAND}"
"-DPOPULATION_TEST=$<TARGET_FILE:evo-cellular-plan-population-tests>"
"-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/plan-population-restart"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cellular_population_restart.cmake")
set_tests_properties(cellular-retained-plan-population cellular-retained-plan-population-restart
PROPERTIES TIMEOUT ${evo_cohort_timeout})
add_executable(evo-cellular-liquid-owner-tests tests/cellular_liquid_owner_tests.cpp)
target_include_directories(evo-cellular-liquid-owner-tests PRIVATE tests)
target_link_libraries(evo-cellular-liquid-owner-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-liquid-owner-tests)
add_test(NAME cellular-liquid-owner-contracts COMMAND evo-cellular-liquid-owner-tests)
set_tests_properties(cellular-liquid-owner-contracts PROPERTIES TIMEOUT 300)
add_executable(evo-cellular-revamp-owner-tests tests/cellular_revamp_owner_tests.cpp)
target_include_directories(evo-cellular-revamp-owner-tests PRIVATE tests)
target_link_libraries(evo-cellular-revamp-owner-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-revamp-owner-tests)
add_test(NAME cellular-revamp-owner-contracts COMMAND evo-cellular-revamp-owner-tests)
set_tests_properties(cellular-revamp-owner-contracts PROPERTIES TIMEOUT 300)
add_executable(evo-photosynthesis-tests tests/photosynthesis_tests.cpp)
target_link_libraries(evo-photosynthesis-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-photosynthesis-tests)
add_test(NAME photosynthesis-contracts COMMAND evo-photosynthesis-tests)
add_executable(evo-cellular-environment-tests tests/cellular_environment_tests.cpp)
target_link_libraries(evo-cellular-environment-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-environment-tests)
add_test(NAME cellular-environment-contracts COMMAND evo-cellular-environment-tests)
add_test(NAME cellular-environment-restart COMMAND "${CMAKE_COMMAND}"
"-DPOPULATION_TEST=$<TARGET_FILE:evo-cellular-environment-tests>"
"-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/environment-restart"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cellular_population_restart.cmake")
set_tests_properties(cellular-environment-contracts cellular-environment-restart
PROPERTIES TIMEOUT ${evo_cohort_timeout})
add_executable(evo-cellular-inheritance-tests tests/cellular_inheritance_tests.cpp)
target_link_libraries(evo-cellular-inheritance-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-inheritance-tests)
add_test(NAME cellular-inherited-plans COMMAND evo-cellular-inheritance-tests)
set_tests_properties(cellular-inherited-plans PROPERTIES TIMEOUT ${evo_cohort_timeout})
add_test(NAME cellular-inheritance-process-restart COMMAND "${CMAKE_COMMAND}"
"-DPOPULATION_TEST=$<TARGET_FILE:evo-cellular-inheritance-tests>"
"-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/inheritance-restart"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cellular_population_restart.cmake")
set_tests_properties(cellular-inheritance-process-restart PROPERTIES TIMEOUT ${evo_cohort_timeout})
add_executable(evo-cellular-inheritance-replay-tests tests/cellular_inheritance_replay_tests.cpp)
target_link_libraries(evo-cellular-inheritance-replay-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-inheritance-replay-tests)
add_test(NAME cellular-inherited-replay COMMAND evo-cellular-inheritance-replay-tests)
set_tests_properties(cellular-inherited-replay PROPERTIES TIMEOUT ${evo_cohort_timeout})
add_test(NAME cellular-inherited-replay-process-restart COMMAND "${CMAKE_COMMAND}"
"-DPOPULATION_TEST=$<TARGET_FILE:evo-cellular-inheritance-replay-tests>"
"-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/inheritance-replay-restart"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cellular_population_restart.cmake")
set_tests_properties(cellular-inherited-replay-process-restart PROPERTIES TIMEOUT ${evo_cohort_timeout})
add_executable(evo-cellular-inheritance-checkpoint-tests tests/cellular_inheritance_checkpoint_tests.cpp)
target_link_libraries(evo-cellular-inheritance-checkpoint-tests PRIVATE evo::region_checkpoint)
evo_owned_target(evo-cellular-inheritance-checkpoint-tests)
add_test(NAME cellular-inherited-checkpoint-upgrade COMMAND evo-cellular-inheritance-checkpoint-tests)
set_tests_properties(cellular-inherited-checkpoint-upgrade PROPERTIES TIMEOUT ${evo_cohort_timeout})
add_test(NAME cellular-inherited-upgrade-process-restart COMMAND "${CMAKE_COMMAND}"
"-DPOPULATION_TEST=$<TARGET_FILE:evo-cellular-inheritance-checkpoint-tests>"
"-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/inheritance-upgrade-restart"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cellular_population_restart.cmake")
set_tests_properties(cellular-inherited-upgrade-process-restart PROPERTIES TIMEOUT ${evo_cohort_timeout})
add_executable(evo-cellular-maturation-tests tests/cellular_maturation_tests.cpp)
target_link_libraries(evo-cellular-maturation-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-maturation-tests)
add_test(NAME cellular-funded-maturation COMMAND evo-cellular-maturation-tests)
set_tests_properties(cellular-funded-maturation PROPERTIES TIMEOUT ${evo_cohort_timeout})
add_test(NAME cellular-maturation-process-restart COMMAND "${CMAKE_COMMAND}"
"-DPOPULATION_TEST=$<TARGET_FILE:evo-cellular-maturation-tests>"
"-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/maturation-restart"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cellular_population_restart.cmake")
set_tests_properties(cellular-maturation-process-restart PROPERTIES TIMEOUT ${evo_cohort_timeout})
target_link_libraries(evo-cellular-population-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-population-tests)
add_test(NAME cellular-population-transitions COMMAND evo-cellular-population-tests)
set_tests_properties(cellular-population-transitions PROPERTIES TIMEOUT 180)
add_executable(evo-cellular-census-tests tests/cellular_census_tests.cpp)
add_executable(evo-cellular-plan-census-tests tests/cellular_plan_census_tests.cpp)
target_link_libraries(evo-cellular-plan-census-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-plan-census-tests)
add_test(NAME cellular-retained-plan-census COMMAND evo-cellular-plan-census-tests)
set_tests_properties(cellular-retained-plan-census PROPERTIES TIMEOUT ${evo_cohort_timeout})
target_link_libraries(evo-cellular-census-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-census-tests)
add_test(NAME cellular-census-contract COMMAND evo-cellular-census-tests)
set_tests_properties(cellular-census-contract PROPERTIES TIMEOUT 180)
add_test(NAME cellular-population-process-restart COMMAND "${CMAKE_COMMAND}"
"-DPOPULATION_TEST=$<TARGET_FILE:evo-cellular-population-tests>"
"-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/population-restart"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cellular_population_restart.cmake")
set_tests_properties(cellular-population-process-restart PROPERTIES TIMEOUT 180)
add_executable(evo-cellular-schedule-tests tests/cellular_schedule_tests.cpp)
target_link_libraries(evo-cellular-schedule-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-schedule-tests)
add_test(NAME cellular-unattended-schedule COMMAND evo-cellular-schedule-tests)
add_executable(evo-cellular-migration-tests tests/cellular_migration_tests.cpp)
target_link_libraries(evo-cellular-migration-tests PRIVATE evo::lifecycle)
evo_owned_target(evo-cellular-migration-tests)
add_test(NAME cellular-migration-contract COMMAND evo-cellular-migration-tests)
set_tests_properties(cellular-migration-contract PROPERTIES TIMEOUT ${evo_migration_timeout})
add_test(NAME cellular-migration-process-restart COMMAND "${CMAKE_COMMAND}"
"-DMIGRATION_TEST=$<TARGET_FILE:evo-cellular-migration-tests>"
"-DTEST_DIR=${CMAKE_CURRENT_BINARY_DIR}/migration-restart"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/cellular_migration_restart.cmake")
set_tests_properties(cellular-migration-process-restart PROPERTIES TIMEOUT 180)
add_executable(evo-population-checkpoint-tests tests/population_checkpoint_tests.cpp)
target_link_libraries(evo-population-checkpoint-tests PRIVATE evo::region_checkpoint)
evo_owned_target(evo-population-checkpoint-tests)
add_test(NAME population-checkpoint-contract COMMAND evo-population-checkpoint-tests)
add_executable(evo-environment-checkpoint-tests tests/environment_checkpoint_tests.cpp)
target_link_libraries(evo-environment-checkpoint-tests PRIVATE evo::region_checkpoint)
evo_owned_target(evo-environment-checkpoint-tests)
add_test(NAME environment-checkpoint-contract COMMAND evo-environment-checkpoint-tests)
set_tests_properties(population-checkpoint-contract PROPERTIES TIMEOUT 180)
endif()
add_executable(evo-chunk-layout experiments/world/chunk_layout.cpp)
target_link_libraries(evo-chunk-layout PRIVATE evo::world)
evo_owned_target(evo-chunk-layout)
if(BUILD_TESTING)
add_test(NAME chunk-layout-contracts COMMAND evo-chunk-layout --verify)
set_tests_properties(chunk-layout-contracts PROPERTIES TIMEOUT 120)
endif()
add_executable(evo-spatial-benchmark tests/benchmarks/spatial_benchmark.cpp)
target_link_libraries(evo-spatial-benchmark PRIVATE evo::simulation)
evo_owned_target(evo-spatial-benchmark)
if(EVO_BUILD_FUZZER)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR MSVC OR EVO_SANITIZER STREQUAL "thread")
message(FATAL_ERROR "Fuzzing requires Linux Clang and is incompatible with TSan")
endif()
add_executable(evo-world-codec-fuzz tests/fuzz/world_codec_fuzz.cpp ${evo_world_sources})
target_include_directories(evo-world-codec-fuzz PRIVATE include)
evo_owned_target(evo-world-codec-fuzz)
target_compile_options(evo-world-codec-fuzz PRIVATE -fsanitize=fuzzer,address,undefined -fno-omit-frame-pointer)
target_link_options(evo-world-codec-fuzz PRIVATE -fsanitize=fuzzer,address,undefined)
# Compile the kernel itself with coverage and sanitizer instrumentation.
add_executable(evo-snapshot-fuzz tests/fuzz/snapshot_fuzz.cpp ${evo_simulation_sources})
target_include_directories(evo-snapshot-fuzz PRIVATE include)
evo_owned_target(evo-snapshot-fuzz)
target_compile_options(evo-snapshot-fuzz PRIVATE -fsanitize=fuzzer,address,undefined -fno-omit-frame-pointer)
target_link_options(evo-snapshot-fuzz PRIVATE -fsanitize=fuzzer,address,undefined)
endif()
if(EVO_BUILD_ECS_EXPERIMENT)
include(tools/entt-pin.cmake)
set(entt_root "${CMAKE_SOURCE_DIR}/build/external/entt")
if(NOT EXISTS "${entt_root}/include/entt/entt.hpp" OR NOT EXISTS "${entt_root}/LICENSE")
message(FATAL_ERROR "Run cmake -P tools/prepare-entt.cmake explicitly before configuring the experiment")
endif()
file(SHA256 "${entt_root}/include/entt/entt.hpp" entt_header_hash)
file(SHA256 "${entt_root}/LICENSE" entt_license_hash)
if(NOT entt_header_hash STREQUAL EVO_ENTT_HEADER_SHA256 OR NOT entt_license_hash STREQUAL EVO_ENTT_LICENSE_SHA256)
message(FATAL_ERROR "Experimental EnTT dependency failed integrity validation")
endif()
add_executable(evo-ecs-experiment experiments/ecs/comparison.cpp)
target_include_directories(evo-ecs-experiment PRIVATE include)
target_include_directories(evo-ecs-experiment SYSTEM PRIVATE "${entt_root}/include")
evo_owned_target(evo-ecs-experiment)
if(BUILD_TESTING)
add_test(NAME ecs-experiment-contracts COMMAND evo-ecs-experiment --verify)
set_tests_properties(ecs-experiment-contracts PROPERTIES TIMEOUT 120)
endif()
endif()
find_program(EVO_CLANG_FORMAT NAMES clang-format-19 clang-format)
add_custom_target(format-check COMMAND "${CMAKE_COMMAND}"
"-DFORMATTER=${EVO_CLANG_FORMAT}" "-DSOURCE_ROOT=${CMAKE_CURRENT_SOURCE_DIR}"
-P "${CMAKE_CURRENT_SOURCE_DIR}/tools/check-format.cmake" VERBATIM)