32 lines
1.5 KiB
CMake
32 lines
1.5 KiB
CMake
if(NOT DEFINED EVO_WORLD_PROOF OR NOT DEFINED TEST_DIR)
|
|
message(FATAL_ERROR "EVO_WORLD_PROOF and TEST_DIR are required")
|
|
endif()
|
|
string(RANDOM LENGTH 16 ALPHABET 0123456789abcdef run_id)
|
|
set(run_dir "${TEST_DIR}/${run_id}")
|
|
file(MAKE_DIRECTORY "${run_dir}")
|
|
# Every command launches a fresh process. Retain build-local evidence; never delete roots.
|
|
foreach(workload IN ITEMS uniform sparse heavy)
|
|
foreach(phase IN ITEMS prepare compact verify)
|
|
execute_process(COMMAND "${EVO_WORLD_PROOF}" "${phase}" "${workload}" "${run_dir}/${workload}"
|
|
RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE error TIMEOUT 30)
|
|
if(NOT result STREQUAL "0")
|
|
message(FATAL_ERROR "${workload}/${phase}: ${result}: ${error}")
|
|
endif()
|
|
file(WRITE "${run_dir}/${workload}-${phase}.json" "${output}")
|
|
string(JSON hash GET "${output}" hash)
|
|
string(JSON debris GET "${output}" debris_volume)
|
|
if(phase STREQUAL "prepare")
|
|
set(expected_hash "${hash}")
|
|
set(expected_debris "${debris}")
|
|
elseif(NOT hash STREQUAL expected_hash OR NOT debris STREQUAL expected_debris)
|
|
message(FATAL_ERROR "State differs across processes for ${workload}")
|
|
endif()
|
|
endforeach()
|
|
execute_process(COMMAND "${EVO_WORLD_PROOF}" prepare "${workload}" "${run_dir}/${workload}"
|
|
RESULT_VARIABLE repeat OUTPUT_QUIET ERROR_QUIET TIMEOUT 30)
|
|
if(NOT repeat STREQUAL "1")
|
|
message(FATAL_ERROR "prepare must refuse an existing proof directory")
|
|
endif()
|
|
endforeach()
|
|
message(STATUS "World proof reports: ${run_dir}")
|