if(DEFINED ENV{EVO_TEST_TMPDIR} AND NOT "$ENV{EVO_TEST_TMPDIR}" STREQUAL "") string(RANDOM LENGTH 16 ALPHABET 0123456789abcdef run_id) set(TEST_DIR "$ENV{EVO_TEST_TMPDIR}/population-restart-${run_id}") endif() file(MAKE_DIRECTORY "${TEST_DIR}") execute_process(COMMAND "${POPULATION_TEST}" --checkpoint "${TEST_DIR}/checkpoint.pop" "${TEST_DIR}/expected.pop" RESULT_VARIABLE prepared) if(NOT prepared EQUAL 0) message(FATAL_ERROR "Population checkpoint preparation failed: ${prepared}") endif() execute_process(COMMAND "${POPULATION_TEST}" --resume "${TEST_DIR}/checkpoint.pop" "${TEST_DIR}/resumed.pop" RESULT_VARIABLE resumed) if(NOT resumed EQUAL 0) message(FATAL_ERROR "Fresh-process population recovery failed: ${resumed}") endif() execute_process(COMMAND "${CMAKE_COMMAND}" -E compare_files "${TEST_DIR}/expected.pop" "${TEST_DIR}/resumed.pop" RESULT_VARIABLE compared) if(NOT compared EQUAL 0) message(FATAL_ERROR "Population state diverged across process recovery") endif()