Compare ProcessorCount to SystemInformation count. (#11302)

Maximize output to gather data on the dashboards.
Only FATAL_ERROR out once at the bottom if an error
occurred earlier.
This commit is contained in:
David Cole 2010-11-09 14:29:52 -05:00 committed by Brad King
parent 3430955d5f
commit 6259bc4222
1 changed files with 37 additions and 3 deletions

View File

@ -3,11 +3,45 @@ include(ProcessorCount)
ProcessorCount(processor_count)
message("processor_count='${processor_count}'")
if(NOT processor_count MATCHES "^[0-9]+$")
message(FATAL_ERROR "ProcessorCount function returned a non-integer")
execute_process(
COMMAND "@CMAKE_BINARY_DIR@/Source/kwsys/$ENV{CMAKE_CONFIG_TYPE}/cmsysTestsCxx"
testSystemInformation
OUTPUT_VARIABLE out)
string(REGEX REPLACE "(.*)GetNumberOfPhysicalCPU:.([0-9]*)(.*)" "\\2"
system_info_processor_count "${out}")
message("system_info_processor_count='${system_info_processor_count}'")
if(system_info_processor_count EQUAL processor_count)
message("processor count matches system information")
endif()
# Evaluate possible error conditions:
#
set(err 0)
if(processor_count EQUAL 0)
message(FATAL_ERROR "could not determine number of processors
set(err 1)
message("could not determine number of processors
- Additional code for this platform needed in ProcessorCount.cmake?")
endif()
if(NOT system_info_processor_count EQUAL processor_count)
set(err 2)
message("SystemInformation and ProcessorCount.cmake disagree:\n"
"processor_count='${processor_count}'\n"
"SystemInformation processor_count='${system_info_processor_count}'")
endif()
if(NOT processor_count MATCHES "^[0-9]+$")
set(err 3)
message("ProcessorCount function returned a non-integer")
endif()
if(NOT system_info_processor_count MATCHES "^[0-9]+$")
set(err 4)
message("SystemInformation ProcessorCount function returned a non-integer")
endif()
if(err)
message(FATAL_ERROR "err='${err}'")
endif()