Files
Build-System/tests/SdkRegistration.cmake
T
faumaray 3cac890ce9 bootstrap
Signed-off-by: faumaray <faumaray@gmail.com>
2026-11-25 01:32:43 +03:00

45 lines
2.1 KiB
CMake

cmake_minimum_required(VERSION 4.0)
execute_process(COMMAND "${SDK_TESTS}" --list --no-color
RESULT_VARIABLE code OUTPUT_VARIABLE out ERROR_VARIABLE err TIMEOUT 20)
if(NOT "${code}" STREQUAL "0" OR NOT "${err}" STREQUAL "")
message(FATAL_ERROR "SDK test discovery failed: ${code}\n${out}\n${err}")
endif()
set(expected
SdkDeclarations.default_profiles_and_overrides
SdkDeclarations.rejects_invalid_profiles
SdkDeclarations.declaration_records_and_visibility
SdkDeclarations.sources_are_symbolic
SdkDeclarations.handles_survive_record_growth
SdkDeclarations.rejects_cross_project_links
SdkDeclarations.rejects_expired_handles_and_owner_moves
SdkDeclarations.rejects_empty_and_duplicate_identifiers
SdkDeclarations.rejects_contradictory_providers
SdkDeclarations.json_schema_types_and_escaping
SdkDeclarations.json_preserves_valid_utf8
SdkDeclarations.json_rejects_malformed_utf8
SdkDeclarations.independent_projects_and_contexts
SdkDeclarations.rejects_option_errors_without_mutation
ExampleContexts.example_uses_runtime_compiler
ExampleContexts.example_profile_options_are_separate
ExampleContexts.example_records_sources_links_and_pin)
string(REPLACE "\n" ";" discovered "${out}")
list(FILTER discovered EXCLUDE REGEX "^$")
foreach(name IN LISTS expected)
if(NOT name IN_LIST discovered)
message(FATAL_ERROR "Missing SDK regression case: ${name}\n${out}")
endif()
endforeach()
list(LENGTH discovered count)
if(count LESS 17)
message(FATAL_ERROR "Expected at least 17 SDK cases, found ${count}")
endif()
# Observe that filtering executes a named registered body, rather than only listing it.
execute_process(COMMAND "${SDK_TESTS}" --no-color --filter "^SdkDeclarations.json_schema_types_and_escaping$"
RESULT_VARIABLE code OUTPUT_VARIABLE out ERROR_VARIABLE err TIMEOUT 20)
if(NOT "${code}" STREQUAL "0" OR NOT out MATCHES "1 tests:" OR
NOT out MATCHES "json_schema_types_and_escaping")
message(FATAL_ERROR "Named SDK case did not execute successfully: ${code}\n${out}\n${err}")
endif()
message(STATUS "${count} SDK test registrations verified; named JSON case executed")