From 6259bc4222d7eb391a76ab5fd5e0460be238241e Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 9 Nov 2010 14:29:52 -0500 Subject: 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. --- Tests/CMakeTests/ProcessorCountTest.cmake.in | 40 +++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/Tests/CMakeTests/ProcessorCountTest.cmake.in b/Tests/CMakeTests/ProcessorCountTest.cmake.in index ac7a1da..6550973 100644 --- a/Tests/CMakeTests/ProcessorCountTest.cmake.in +++ b/Tests/CMakeTests/ProcessorCountTest.cmake.in @@ -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() -- cgit v0.12